coder_mario coder_mario -4 years ago 102
C Question

ARM Linker Error: Heap was used, but no heap region was defined

I'm porting a code base to a new build environment and am running into this issue at link-time.

Error: L6915E: Library reports error: Heap was used, but no heap region was defined

The target is a 32-bit Arm Cortex R5. Not using malloc or free anywhere in the code base. In the past during a similar build environment port I had gotten past this issue by using microlib. No such luck this time though.

EDIT: Turns out I could have resolved the issue just by using microlib at compile-time. I thought I tried that when I had asked the question, but actually didn't.

Answer Source

Resolved the issue by re-targeting fputc and re-defining __stdout and __stdin. fputc() seems to have been using malloc(), so after retargeting fputc to use my UART driver, there were no heap-accessing functions in my code.

struct __FILE { int handle;   /* Add whatever you need here */};
FILE __stdout;
FILE __stdin;

int fputc(int ch, FILE *f)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download