I am trying to execute the following code on lpc2138:
float a = 10.2;
a = a/2.0;
Debugger stops on second operation (division).
I’m using YAGARTO.
How to enable floating point support in YAGARTO?
I am trying to execute the following code on lpc2138:
float a = 10.2;
a = a/2.0;
Debugger stops on second operation (division).
I’m using YAGARTO.
How to enable floating point support in YAGARTO?
Please post the generated assembly code.
When I use the current YAGARTO gcc without additional parameters, it generates a call to __divsf3, which is correct for the fpu-less LPC2138 (unless you intend to run the code in Linux with fpu emulator or an EABI environment).
Heres my code:
0x000002a8 <AdjustIMU+88>: ldr r3, [pc, #92] ; 0x30c <AdjustIMU+188>
0x000002ac <AdjustIMU+92>: str r3, [r11, #-16]
0x000002b0 <AdjustIMU+96>: ldr r0, [r11, #-16]
0x000002b4 <AdjustIMU+100>: ldr r1, [pc, #84] ; 0x310 <AdjustIMU+192>
0x000002b8 <AdjustIMU+104>: bl 0x3330 <__divsf3>
0x000002bc <AdjustIMU+108>: mov r3, r0
0x000002c0 <AdjustIMU+112>: str r3, [r11, #-16]
So this problem have an evolution…
when I use -msoft-float in gcc option, linker reports this error:
yagarto/lib/gcc/arm-elf/4.2.2\libgcc.a(_muldivsf3.o) uses hardware FP, whereas main.elf uses software FP
arm-elf-objcopy -p libgcc.a shows:
_divsi3.o: file format elf32-littlearm
private flags = 0: [APCS-32] [FPA float format]
Maybe libgcc.a was built without software floating point support?
2denial Can you post your libgcc.a and libm.a here?
Hello Vitaliy,
please take a look here:
http://en.mikrocontroller.net/topic/162806#715107
It is difficult to answer if you post in two forums.
Best regards,
Michael