[ECOS] gcc miscompiles HAL_DISABLE_INTERRUPTS on Cortex-M3

Stanislav Meduna stano@meduna.org
Wed Feb 16 14:27:00 GMT 2011


On 16.02.2011 15:21, Christophe Coutand wrote:

> What happens if you change the macro to this:
> 
> # define HAL_DISABLE_INTERRUPTS(__old)          \
>     __asm__ volatile (                          \
>         "mrs    %0, basepri             \n"     \
>         "mov    r1,%1                   \n"     \
>         "msr    basepri,r1              \n"     \
>         : "=r" (__old)                          \
>         :  "I" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
>         : "r1"                                  \
>         );
> 
> I usually use I (Immediate value) but I am not so use to ARM processor.

Yup. Either this or
  "=&r" (__old)
(earlyclobber - clobbering before using all inputs) work.

Thanks, I am going to submit the bugreport.

-- 
                                         Stano

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list