Nick Garnett wrote:
Simon Kallweit <[email protected]> writes:Hello Would it make sense to include support for sleeping ("wfi" instruction) in idle thread for the cortex m3 architecture? The current code in hal_arch.h looks like: #if 0 //ndef HAL_IDLE_THREAD_ACTION #define HAL_IDLE_THREAD_ACTION(__count) __asm__ volatile ( "wfi\n" ) #else #define HAL_IDLE_THREAD_ACTION(__count) CYG_EMPTY_STATEMENT #endif I guess this is not what it was meant to be. I would propose to add an option like CYGHWR_HAL_CORTEXM_IDLE_SLEEP to enable the wfi instruction: #ifndef HAL_IDLE_THREAD_ACTION # ifdef CYGHWR_HAL_CORTEXM_IDLE_SLEEP # define HAL_IDLE_THREAD_ACTION(__count) __asm__ volatile ( "wfi\n" ) # else # define HAL_IDLE_THREAD_ACTION(__count) CYG_EMPTY_STATEMENT # endif #endif Also, currently var_arch.h gets not included in the hal_arch.h header, so it's impossible to override for example the HAL_IDLE_THREAD_ACTION macro. I guess this was just overlooked, or is it intentional? I can provide a patch if there are no objections.The "#if 0" is an oversight on my part. When debugging via JTAG I was having difficulties breaking in to an idle system. Stopping it using WFI solved this. The #else part is also a consequence of this, so that code should really be:
Well that's actually the reason for me to propose a CYGHWR_HAL_CORTEXM_IDLE_SLEEP configuration option. During debugging, wfi is rather troublesome, so I thought it might be a good idea to make it configurable. Or is this too much cruft?
Simon -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
