1

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.

sdmello
  • 431
  • 2
  • 6
  • 14
  • Please provide a [mcve], at least V for those who have the same tool chain, compilable for others. – Yunnosch May 19 '17 at 07:13
  • There might be a possibility that the `startup.s` in creating and initializing a heap memory but the linker script doesn't have heap section defined in it. – Gaurav Pathak May 19 '17 at 12:05

1 Answers1

0

Resolved the issue by re-targeting fputc and re-defining __stdout and __stdin. The ARM C library implementation of 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)
{
}
sdmello
  • 431
  • 2
  • 6
  • 14