Other Parts Discussed in Thread: MSP430F2274, TEST2
Hello,
today with a rather simple question: How do i exactly know what memory space i got left in my MSP430. To make it easy for you I post everything i know:
I am using the MSP430F2274, it is supposed to have 32 kB Flash and 1 kB RAM.
I know my *.map file and so can determine some memory:
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
SFR 00000000 00000010 00000000 00000010 RWIX
PERIPHERALS_8BIT 00000010 000000f0 00000000 000000f0 RWIX
PERIPHERALS_16BIT 00000100 00000100 00000000 00000100 RWIX
RAM 00000200 00000400 0000030d 000000f3 RWIX <---------- so i know 0x0400 means 1 kB of total RAM
as i can also read out i assume my used RAM space is 0x030D which is 781 Bytes.
So i can do my math and get a free RAM usage of around 243 Byte, is that true? Of course i assume there might be other memory segments not listet in the RAM above which also use RAM, but i dont know that for sure, and i can think of a growing Stack, which i dont know how big it gets in total, in the CCS it is set to 80 Bytes maximum, so perhaps i have around 243 - 80 = 163 Bytes left.
Am i right there?
Now comes the questioning part:
For implementation of a ModBus-Stack, i want to define an rather big array of values, so i can manipulate and read them out.
so when i define a new array,e.g.
static unsigned short modbus_array[N];
my maximum N should be the calculated BYtes which are left, or in this example because short is 16 bit it should be half of the calculated Bytes?
As a little help, CCS tells me when i am exceeding my RAM, can anyone please tell me if i have to look for my Stack usage for my own, since the Stack is growing from one side to the other, so my Code wont destroy itself? And perhaps someone has some good ideas on how to look out for memory usage in an easy way.
Since CCS is only telling some strange codes sizes when you trying to debug:
MSP430: Program loaded. Code Size - Text: 6300 bytes Data: 602 bytes
So i suppose Text means the Flash usage and Data means the RAM usage.
Thanks for taking interest.
Seb