Friday, 17 July 2015

Solve ARM GCC error "register may not be same – ‘strexb r3,r2,[r3]’"




This error arises because strexb and strexh is undefined when two registers are same. The problems would be in lines 736 and 753 of inc/core_support/core_cm3.c.

 Solution



To solve this issue go >>Your project>>firmware>>CMSIS>>CM3>>CoreSupport>>open core_cm3.c.




Search  : uint32_t __STREXB(uint8_t value, uint8_t *addr)
then Add ‘&’ as shown  below




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) );
   return(result);
}


And search for: uint32_t __STREXH(uint16_t value, uint16_t *addr) or just scroll down and add ‘&’ as shown below




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) );
   return(result);
}





1 comment: