Skip to main content
tushar_tp
Associate III
March 10, 2019
Question

alternative malloc implementation

  • March 10, 2019
  • 1 reply
  • 679 views

Hello,

I am using Truestudio 9.2.0 with FreeRTOS 10.2.0

I want to add custom malloc implementation in my project.

I declared

void * malloc( size_t xSize )

{

//please add your own code

}

in my c files but it gives me error.

c:/program files (x86)/atollic/truestudio for stm32 9.2.0/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/lib/armv7e-m/fpu/fpv5-d16\libc_nano.a(lib_a-malloc.o): In function `malloc':

malloc.c:(.text.malloc+0x0): multiple definition of `malloc'

Is there any other definition or settings missing in my project?

Tushar

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
March 11, 2019

Yeah, you're going to need to figure the settings so it doesn't pull in the nano libraries. The allocation routine is usually _sbrk in syscalls.c or an equivalent file.

Perhaps check Atollic documentation, and/or tutorial videos

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..