Hi there, I'm currently facing the problem, that an example as simple as
volatile float sum;
extern "C" int _start()
{
float a = 1.0;
double d = 2.2;
sum = a + d;
for(;;);
}
is causing problems.
The compiler is invoked with -mcpu=cortex-m0 -mabi=aapcs -mthumb -msoft-float -mfloat-abi=soft (and many othere switches). The generated assembler looks like this:
extern "C" int _start()
...
d6: f000 fb33 bl 740 <____aeabi_f2d_from_thumb>
...
00000740 <____aeabi_f2d_from_thumb>:
740: 4778 bx pc
742: 46c0 nop ; (mov r8, r8)
744: eaffffa3 b 5d8 <__aeabi_f2d>
When I step through this using a JLink-Debug, the last instructions are:
000000D6: 00 F0 33 FB BL #+0x666
J-Link>s
00000740: 78 47 BX PC
Then the cpu is cycling in the HardFault handler. To me it looks like, the gcc is emitting wrong code, right? But how can I fix it? We use the binaries offered by ARM:
$ arm-none-eabi-gcc -v
...
gcc version 4.8.4 20140526 (release) [ARM/embedded-4_8-branch revision 211358] (GNU Tools for ARM Embedded Processors)
The target device is a 51422.
Any help, idea, pointers are highly appreciated.
Kind regards, Torsten