其实是使用GCC编译的问题。对GCC还是要多了解些。
修改STM32的固件库V3.5的core_cm3.c文件:
uint32_t __STREXB(uint8_t value, uint8_t *addr)
{
uint32_t result=0;
//__ASM volatile ("strexb %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );//yiming del 2012.04.09
__ASM volatile ("strexb %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );//yiming add 2012.04.09
return(result);
}
uint32_t __STREXH(uint16_t value, uint16_t *addr)
{
uint32_t result=0;
//__ASM volatile ("strexh %0, %2, [%1]" : "=r" (result) : "r" (addr), "r" (value) );//yiming del 2012.04.09
__ASM volatile ("strexh %0, %2, [%1]" : "=&r" (result) : "r" (addr), "r" (value) );//yiming add 2012.04.09
return(result);
}