This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ld: region RAM overflowed with stack

I have a project in which I've started from the proximity app example code and added some UART stuff using app_uart.c. The linker is giving me this error immediately after building app_uart.c:

ld: region RAM overflowed with stack

Can this be true? The RAM is 8kB, right? Attaching linker scripts and a screenshot that shows everything included in the project.

screenshot_eclipse.png

Parents
  • I had a similar problem.

    One thing I did was to decrease the heap size by changing the default heap size to 512 bytes from 2048 in gcc_startup_nrf51.S (saves 1.5k, I don't use malloc):

    #ifdef __HEAP_SIZE .equ Heap_Size, __HEAP_SIZE #else .equ Heap_Size, 512 // was 2048 #endif

    I also noticed that some C library functions (such as sprintf) pull in C library parts that use significant amounts of RAM.

    You could also try decreasing the stack size in the same file.

    To exactly see what's eating your RAM, you'd have to post your entire map file, or at least everything related to the .bss segment.

    Good luck!

    /Erland

Reply
  • I had a similar problem.

    One thing I did was to decrease the heap size by changing the default heap size to 512 bytes from 2048 in gcc_startup_nrf51.S (saves 1.5k, I don't use malloc):

    #ifdef __HEAP_SIZE .equ Heap_Size, __HEAP_SIZE #else .equ Heap_Size, 512 // was 2048 #endif

    I also noticed that some C library functions (such as sprintf) pull in C library parts that use significant amounts of RAM.

    You could also try decreasing the stack size in the same file.

    To exactly see what's eating your RAM, you'd have to post your entire map file, or at least everything related to the .bss segment.

    Good luck!

    /Erland

Children
No Data
Related