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

Unable to Debug due to Application Size?

Hi,

I am unable to compile any debug versions of my code, as result I'm not able to step-through and debug my code.

On a normal compile, get the following error: "region RAM overflowed with stack"

However in my Makefile is have set "ASMFLAGS := -D__HEAP_SIZE=0" ?????

The compiler won't debug compile unless I set LDFLAGS := -Wl,--gc-sections

however this causes the debug code to not run at all on the chip. Release compiles are fine, but then I can't debug my code, so this is a critical problem for me trying verify encryption functionality. Hope someone can please help. Thanks

-DC

Parents
  • Well you need to figure out where all the RAM is going in your debug compiles. Usually debug compiles makes the code larger, not the RAM it uses, but if you have stuff in your debug compiles you don't have in the release ones, that can make a difference. For instance, I often compile my debug code with Segger RTT in it, which uses a RAM buffer, do you have something similar, anything commented out with #ifdef s?

    Is your stack the same size in both debug and release builds? I use a larger stack in debug builds because debug code uses more stack (it keeps variable copies there so the debugger can find them). Do you?

    The linker produces a map file which shows what's using flash and what's using RAM .. now there's a problem that if the link didn't finish, there's no map file which is super annoying. One thing you can do is cheat, tell the linker you have more RAM than you do, link and generate the map file, code won't work, but the map file will tell you what's using RAM, then you do it the hard way and start looking for where the map files differ.

Reply
  • Well you need to figure out where all the RAM is going in your debug compiles. Usually debug compiles makes the code larger, not the RAM it uses, but if you have stuff in your debug compiles you don't have in the release ones, that can make a difference. For instance, I often compile my debug code with Segger RTT in it, which uses a RAM buffer, do you have something similar, anything commented out with #ifdef s?

    Is your stack the same size in both debug and release builds? I use a larger stack in debug builds because debug code uses more stack (it keeps variable copies there so the debugger can find them). Do you?

    The linker produces a map file which shows what's using flash and what's using RAM .. now there's a problem that if the link didn't finish, there's no map file which is super annoying. One thing you can do is cheat, tell the linker you have more RAM than you do, link and generate the map file, code won't work, but the map file will tell you what's using RAM, then you do it the hard way and start looking for where the map files differ.

Children
No Data
Related