I would like to dynamically allocate memory for arrays in my embedded application using the malloc-function. I am having this problem with undefined reference to a function named _sbrk:
/opt/gcc-arm-none-eabi-4_9-2014q4/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7e-m/softfp/libc.a(lib_a-sbrkr.o): In function `_sbrk_r': sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
As shown above, I use the gcc-arm-none-eabi toolchain.
I have searched the internet and found out that _sbrk is a function that will ask the operating system for memory. Maybe it does not work because there is no OS on the microcontroller? I am used to program AVR 8-bit and malloc works fine using gcc on these microcontrollers.
How do I solve this problem?
Thanks in advance :-)