Hi,
I'm using the MCU MC9S12XF512MLM. And with my application I'm doing, i would like to know how much free memory i have to compute my application.
I'm explaining my problem : I want to creat a buffer with the maximum of space that i could take from the memory of my MCU. But i don't know how many spaces i can use.
Because like in MPLAB X (Microchip), the software give to the user, the memory space of their program. Here ine Code Warrior i don't know.
Thanks you in advance,
You should look into generated map file. Scroll to the end of file and find smth like this
Total size of all blocks to be downloaded: 133
,where 133 is code size in bytes. You also may be interested in these strings, which are in the middle of map file:
Summary of section sizes per section type:
READ_ONLY (R): 85 (dec: 133)
READ_WRITE (R/W): 2100 (dec: 8448)
NO_INIT (N/I): 27F (dec: 639)
READ_ONLY displays amount of code.
READ_WRITE displays amount of part of RAM, which is zeroed up at program startup. With default PRM file, this string displays total amount of used RAM. You may prevent initializing of some variables in RAM, allocating selected variables in NO_INIT segments. In this case NO_INIT variables will be c ounted in NO_INIT string.
NO_INIT displays space, occupied by peripherals registers and variables, allocated in NO_INIT segments.
Hi,
The summary of my generated file is like this :
Summary of section sizes per section type:
READ_ONLY (R): 27BF (dec: 10175)
READ_WRITE (R/W): 7D2 (dec: 2002)
NO_INIT (N/I): 2BC (dec: 700)Summary of section sizes per section type:
But, how i can know how many available space I have?
Regards
You take the amount of device flash (512kB in your case), subtract READ_ONLY figure and get the amount of available flash. The same wuth RAM. You take total amount of RAM, subtract READ_WRITE.
Even if compiler calculated that for you, most likely you will need more figures like amount of spare nonbanked flash left, amount of spare nonbanked RAM etc.