I have a question about allocating memory in an Atmel Studio Project. I have been suffering from stack overflows in my project and I was looking-
for some feedback on my process of allocating the two.
My process is composed of the following steps:
1.) set stack and heap size to 0x01 in my linker script compile and see the size of the .bss section.
The purpose of this step is to find the size of all the global variables in my application.
here is the output:
2.) allocate enough heap for the maximum amount of ram that could be taken by calls to malloc()
for this, I used the mem_size of my LWIP and leave a little bit of cushion.
3.) allocate the remainder of RAM to the stack, I calculate this using the formula
RAM SIZE - .bss - stack. Below you can see my calculations and compiler output
I'm wondering if this seems like a good approach for allocating heap and stack, also curious if there's an easier way to do it!
Also, I'm curious, is it normal for the data section to be 0? Finally, I was wondering as to why the .bss section grows as I allocate
my heap and stack, any ideas?
For reference, I am using Atmel studio 7, ASF, and in case it is relevant, the application is going on a ATSAME70N19B.
Also, I attached my linker script as a .txt :)