Hi, I am currently programming an embedded application on the Atmel SAML21J18A Board, which has the following characteristics:
- 256KB Flash
- 40KB RAM
When I program the board, I have the following message :
Program Memory Usage 66428 bytes 24,6 % Full
Data Memory Usage 29112 bytes 71,1 % Full
Tell me if I am wrong, but it seems that even before my application starts, I
already have 71% or my SRAM that is consumed, which seems huge.
So, I have several questions for you guys :
- Do I really have 71% of my RAM that is taken at the very beginning of the
application ? If yes, do you think that having only 10KB left is sufficient
for my application ? (I personnaly don't think so, even tho it has no
graphical stuff, 10KB seems really low)
- I have ony 24% of my flash that is used, how could I use more of it ? Does
it change something if I use the "malloc" function ? Will it store it in the
flash instead of the RAM ? Is the only difference between Flash and SRAM the
time taken to access the data ?
- How does the Atmel memory allocation works ? If I declare a variable but the
SRAM is already at 100%, will it allocate it in the flash ? What decides
what is in the flash and what is in the SRAM Anyway ?
- I am using FreeRTOS and I saw that changing the value of the
configTOTAL_HEAP_SIZE can change the "Data Memory Usage" percentage, what
does it mean ?
- I found the file "saml21j18a_flash.ld" which decides the sizes of the rom,
rom, ram, lpram and picoram, and also the "STACK_SIZE". If I want a higher
stack size, should I change the value in this file or is it dangerous ? Why
doesn't it already use the maximum size available ?
Thank you guys for taking the time to answer to those questions, and I would
be glad to take any advice about memory usage and optimisation, thanks.