Hi,
I wonder if there is a way to figure out the code size after building a project? specifically, the total flash that is used and total ram is used? I guess I can add them up in the .map file but doing it every build is a bit cumbersome...
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I wonder if there is a way to figure out the code size after building a project? specifically, the total flash that is used and total ram is used? I guess I can add them up in the .map file but doing it every build is a bit cumbersome...
The MAP file has all the info. Totals usually are not all that usefull since when resources run low things have to be moved around between blocks or segments anyway and the totals could be misleading.
If the information was really of value, you could output a hex file and write a script to read the file and calculate the flash usage. For RAM, stack usage is typically more critical and you can't get that even from the map.
You could also re-arrange the configuration in your linker command file so that the flash is one large section. The columns in the map file would then reflect the totals. You could do the same for contiguous parts of RAM.
Wally, Thanks
So I will stick with the .map file.
On a separate note, in the other thread you mentioned you are using flash api with s-record. I once had to do that with 2809. The S-record generated from the C2000 util has two files, one has hi-word and other one lo-word and they are interleaved. I had to program one at a time. Is there a better way of doing it (other than writing another program to merge the two files)?
Thanks
Leong
The hex2000 utility will generate a correct S record file if you use the parameters:
"${CG_TOOL_ROOT}/bin/hex${CG_TOOL_SUFFIX}.exe" -m "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.hex" -romwidth 16
You do this in the project settings for the post-build step in CCS4
This gives you S2 records with 3 byte addresses and 16 bit words.
The C2000 had a flash target size of 16 bits.
The file will also be correct with -romwidth 32. Actually, it is not correct in that it will output SRecords that may be only 16 bits so I suspect that the utility always outputs S Records the same way - S2 records with 16 bit data.