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.

Best regards
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

Reply via email to