2024-03-07 02:51 AM - edited 2024-03-07 02:52 AM
Hello
STM8S microcontroller. Cosmic compiler. How can I find out how much memory my C program is using and for what purposes?
Solved! Go to Solution.
2024-03-17 03:00 AM
I wrote to Cosmic technical support and they responded with the following: "It's described in the linker section of the compiler manual (CXSTM8_UsersGuide.pdf)."
2024-03-07 03:01 AM
If the Linker generates a .MAP file perhaps review that.
2024-03-07 05:12 AM - edited 2024-03-07 05:14 AM
Yes, the linker generates a .map file. It is not particularly clear what these segments mean (see Figure 1 below)?
What do the numbers near the parentheses and in the parentheses mean? What do the arrows (>) next to some numbers mean (see Figure 2 bellow)?
What do the arrows such (>) and such (-->) mean (see Figure 3 bellow)?
Is there information on this topic somewhere? I did not find it in the Cosmic compiler documentation.
2024-03-07 05:54 AM
@MykolaLevun wrote:I did not find it in the Cosmic compiler documentation.
Did you try https://www.cosmicsoftware.com/support.php ?
2024-03-07 07:42 AM
Yes, I looked on the official website. Found nothing.
2024-03-07 07:52 AM
So give them a call: https://www.cosmicsoftware.com/contact.php
2024-03-07 10:10 AM
I don't think they make enough money from this deal, and the deal probably was that ST owned the support burden.. I'm sure Luca/Cosmic would provide support at reasonable engineering rates
https://www.cosmicsoftware.com/manuals.php
For Stack I think numbers referred to auto/locals and then parameters
For Call Tree there's a top-level count of functions in brackets, and then probably some call/stack type impact
I'm not using STM8 parts, but contextually the importance should be relevant to someone who is.
For the Object file it's showing all the sections, the debug/info likely not contributing to data pushed into the device, but text/const
MAP files are the place to look for Linker output, you can also likely unpack the Object file directly with a suitable dump tool, or generate .HEX or .BIN you can import or view independently too.
Quick Google
https://hw-by-design.blogspot.com/2018/07/8-bit-cosmic-c-memory-usage-report.html
https://community.st.com/t5/stm8-mcus/how-to-read-the-map-file/td-p/542058
2024-03-17 03:00 AM
I wrote to Cosmic technical support and they responded with the following: "It's described in the linker section of the compiler manual (CXSTM8_UsersGuide.pdf)."