stellaris-launchpad-template-gcc icon indicating copy to clipboard operation
stellaris-launchpad-template-gcc copied to clipboard

Hard fault when using libc functions

Open zehortigoza opened this issue 9 years ago • 0 comments

Hi I just moved from another Stellaris build template to this one but I'm getting hard fault when using libc functions like snprintf().

Breakpoint 1, hardfault_handler () at src/LM4F_startup.c:292 292 } (gdb) bt #0 hardfault_handler () at src/LM4F_startup.c:292 #1 <signal handler called> #2 0x00002be4 in strlen () #3 0x00002c56 in _svfprintf_r () #4 0x00002abc in snprintf () #5 0x000015ce in main () at src/main.c:46

What is strange is that a simple call to "strlen("test");" works maybe this run because compiler is optimizing the code and alread replacing this call to 4.

I'm using arm-none-eabi toolchain from Linux Arch.

Here the linking line: Linking... arm-none-eabi-ld -T LM4F.ld --gc-sections -o bin/starquad.axf src/protocol.o src/mpu6050.o src/pid.o src/blackbox.o src/motors.o src/syscalls.o src/config.o src/LM4F_startup.o src/MadgwickAHRS.o src/radio.o src/main.o src/agent.o src/MahonyAHRS.o src/i2c.o thirdparty/stellarisware/driverlib/gcc-cm4f/libdriver-cm4f.a /usr/lib/gcc/arm-none-eabi/5.2.0/../../../../arm-none-eabi/lib/armv7e-m/softfp/libm.a /usr/lib/gcc/arm-none-eabi/5.2.0/../../../../arm-none-eabi/lib/armv7e-m/softfp/libc.a /usr/lib/gcc/arm-none-eabi/5.2.0/armv7e-m/softfp/libgcc.a

Anyone got this?

If you want to see my changes here is https://github.com/zehortigoza/stellaris-quad/commits/new-build-system, the first patch using this template is 'Use a better build template'.

Thanks

zehortigoza avatar Jul 26 '15 19:07 zehortigoza