cancel
Showing results for 
Search instead for 
Did you mean: 

Output Size in IDE (ROM & RAM Usage)

MuratUrsavas
Associate III
Posted on May 18, 2012 at 10:20

Hi everyone,

I can't find a solution to a very simple problem. STVD does not show the output size (ROM and RAM usage) when I compile with Cosmic Compiler (32K limited version). I tried many things and can see the output size in the generated map file. But I want to see it in the ''Build'' tab of STVD.

Is there any way to see it after a successful compilation?

Thanks in advance.

Toolchain:

IDE: STVD v4.3.1

Compiler: Cosmic STM8 32K v4.3.7

Debugger: ST-Link V2+

#stvd-cosmic-compiler-stm8l
13 REPLIES 13
luca239955_stm1_st
Senior II
Posted on May 18, 2012 at 21:30

this information is in the map file produced by the linker, first section (the first 20 lines or so).

Look in the user manual for more details.

MuratUrsavas
Associate III
Posted on May 20, 2012 at 10:08

Thanks Luca, but as you can see I mentioned the map file already and asked for a way about seeing the info in the build tab of STVD.

steven239955_st
Associate II
Posted on May 23, 2012 at 16:28

Hi Murat,

I don't have a direct solution, but I had the same issue of wanting to see the memory usage in STVD after a build, but I'm using the Raisonance tool chain. I found that adding the following Post-Buildcommand works for me:

find ''requirement'' $(OutputPath)\$(TargetSName).MAP

Something similar may work with the cosmic tool chain. The trick would be to replace ''requirement'' with a suitable word or phrase depending on how cosmic generate theinformationintheirmap file.
MuratUrsavas
Associate III
Posted on May 24, 2012 at 13:10

Brilliant!. Thanks Steven. After getting the idea about the purpose of the command you've mentioned, I've found the new keyword: ''segment''

I want to make sure people who will be reading this in the future understands what this command is.

First the command: You have to open the project settings (in the workspace panel) go to ''Post-Link'' tab, open another line by hitting enter and write ''find ''segment'' $(OutputPath)$(TargetSName).map'' without first and last quotes. Hit OK to save and you are ready to go. You'll see the flash segment usage in the next build (if you don't update any file you can't see the result).

This command is in fact a standard command line command. It finds a special string in a text file and prompts the matching lines whereever it has been called. if you type this command in the windows command line, you'll see the same output in command prompt.

Thanks again Steven :)

sm2
Associate II
Posted on July 25, 2012 at 15:27

Thank!!! It helps me a lot, but (because I just started with programming, especially STM8), what does mean various lines.

---------- RELEASE\PWM.MAP

start 00008080 end 000081c5 length   325 segment .const

start 00008205 end 0000a391 length  8588 segment .text

start 00004000 end 00004000 length     0 segment .eeprom

start 00000000 end 00000038 length    56 segment .bsct, initialized

start 000081cd end 00008205 length    56 segment .bsct, from

start 00000038 end 00000042 length    10 segment .ubsct

start 00000042 end 00000042 length     0 segment .bit

start 00000042 end 00000042 length     0 segment .share

start 00000100 end 00000100 length     0 segment .data

start 00000100 end 00000100 length     0 segment .bss

start 00000000 end 00000827 length  2087 segment .info.

start 00000000 end 0000a5c2 length 42434 segment .debug

start 00008000 end 00008080 length   128 segment .const

start 000081c5 end 000081cd length     8 segment .init

Which of this is information about code size??

MuratUrsavas
Associate III
Posted on July 26, 2012 at 09:49

Hi,

You can find detailed descriptions in Cosmic Compiler User Manual under the title Using the linker/Map file description section (Page 295 of v4.3.7).

Basically you have to monitor .const/.text parameters for your flash usage, .data/.bss for your RAM usage and .eeprom for your internal EEPROM usage. You can find the other ones descriptions in the user manual.

P.S: Don't forget to use +split parameter if you start to run out of flash (or compiler output limit)
sm2
Associate II
Posted on July 26, 2012 at 22:39

Hi, Thanks a lot. I hope you will be able to help me one more time.

You wrote about +split parameter. Where should I put it? In the same place as ''map'' (post-build)? I new with programming?

I noticed that stm8 standard library generates too much unnecessary code.  It took almost 8KB. And I thing I should write it by my self.

MuratUrsavas
Associate III
Posted on July 27, 2012 at 08:56

I think it's not a good idea to attempt to rewrite the whole peripheral library, especially if you're a newbie. This library is a very good one and does not create too much overhead.

By default, Cosmic includes all relevant functions contained by the project even you've never called them anywhere. With split option you're telling to compiler that ''I don't want the functions which I'm not using''. Then your code size magically shrinks according to your code (if you have just the necessary functions, you won't be able to see any difference.

Here is how it's done:

Open the project via ST Visual Develop. Right click on the project in workspace panel. Click ''Settings''. Click ''C Compiler'' tab. Choose ''Optimizations'' from the ''Category'' combobox. Select ''Customize'' from the ''Optimizations'' combobox. Make sure ''Split Functions  in Separate Sections'' checkbox checked. And you're done.

Also you can try the other optimizations like ''Compact code size'' and choose the ones for your taste.

sm2
Associate II
Posted on July 30, 2012 at 08:36

Thank you very much. Code size decreases from >8k to 2k.

Btw. Everyone was newbie in the past.

One more time thanks. You help me a lot.