problem with malloc
Hi
I'm trying to execute some C++ code on an LPC1768, an ARM Cortex-M3 driven microcontroller.
The C++ code uses malloc and free, so I included <stdlib.h>. While building and compiling the code with arm-none-eabi-gcc gave no errors, the binary does not execute. The Cortex-M3 goes into HardFault.
When compiling the exact same code with the online compiler of mbed (https:/
This leads me to believe that my compilation process, when I use arm-none-eabi-gcc, is not correct. Could it be that the wrong <stdlib.h> and thus the wrong implementation of malloc() and free() are included into the binary, causing the hardfault?
here are the contents of the makefile:
--> dijkstra.cpp includes the code that calls malloc() and free()
$(cpp) -I(...) dijkstra.cpp -o algorithms/
--> linker to create the elf (the binary is extracted from the .elf )
$(cpp) -T"lpc1768.ld" -nostartfiles -Xlinker --gc-sections -WL,-Map,
Could you please let me know what I do wrong?
Thanks in advance.
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Jens Vankeirsbilck for more information if necessary.