Hello, so recently I've been working on a project and I successfully implemented multiple UARTs using Direct Memory Access and other drivers like timers, I/O pins and others.
in the start up I had 0 heap which caused the uC not to work then I changed it as shown in the next code section then it worked during callocating (dynamic memory allocation using calloc) so I changed the configuration to the following
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;****************************************************************************** Stack EQU 0x00000800 ;****************************************************************************** ; ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;****************************************************************************** Heap EQU 0x00000400
then my program worked fine, but I realized my GPRS module keeps resetting on its own multiple times so I doubted it's a memory issue
in KEIL u4 compiler I could see the following information after I compile my code
Program Size: Code=7168 RO-data=744 RW-data=312 ZI-data=4856
so I tried to increase the following section as shown
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;****************************************************************************** Stack EQU 0x000002710 ;****************************************************************************** ; ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> ; ;****************************************************************************** Heap EQU 0x00001338
so I wanted to allocate 5kB for the heap and 10kB for the stack, but once I implemented that then it was the havoc and program acted in a completely mess and wasn't stable like it is behaving completely wrong.
Questions are :
1- how to manage my memory and the whole 32KB SRAM in the right way? ( I am using SRAM to save data when there is no internet connection)
2- is changing those 2 lines in the startup file enough or they should be followed with other changes?
3- after compiling the program as shown in the screenshot, RAM data = ZI + RW ,and ROM data = RO data, or I'm wrong here?