cancel
Showing results for 
Search instead for 
Did you mean: 

Cosmic / STVD / Memory use and allocation

nholzem
Associate II
Posted on June 16, 2011 at 07:38

Good day,

I've started some time ago with the STM8S Discovery, STVD and Cosmic limited to 16k.

I'm now at the point where i need to answer the following:

- How can I check how much memory space on the chip is being used by my application? Ideally i'd like to know precisely where program segments are stored as well as how much RAM is allocated.

- Can I configure the environment so that it stores (e.g. while loading the program onto the chip) some data in the remaining 16k of the Flash? (Cosmic will produce up to 16k of code so there's at least 16k available on the chip for data storage). NB: this data might change while the application is running, so i don't want to declare it as constant data.

Thanks and kind greetings,

Nick 
3 REPLIES 3
jdf25252
Associate II
Posted on June 17, 2011 at 19:06

Nick

First check that you've enabled the generation of the MAP file:

Linker tab --> Category = ''Output''

Check

    ''Generate Map File''

    ''Physical Address Symbols''       

    ''Symbols sorted by address''

Build your project!

the map file will be in the Debug or Release subdir and have

the filename $(TargetSName).map

First part of the map file shows the segments and the number of

bytes allocated to each

                               --------

                               Segments

                               --------

start 00008080 end 000080c9 length    73 segment .copyrt               

        .copyrt -> My segment def so the copyright notice will always

        show up in the memory window of STVP (you will not have this seg)

start 000080c9 end 0000f74f length 30342 segment .text

        .text -> This is your code stored in FLASH

start 0000f74f end 0000fd56 length  1543 segment .const

        .const -> This is your constants stored in FLASH i.e.

                const unsigned int = 5280;

start 00004000 end 00004000 length     0 segment .eeprom

        Data in the EEPROM

start 00000000 end 00000000 length     0 segment .bsct

        initialized variables in the RAM zero Page ( 0x00-0xFF )

start 00000000 end 000000a9 length   169 segment .ubsct

        uninitialized variables in the RAM zero Page ( 0x00-0xFF )

start 000000a9 end 000000a9 length     0 segment .share

        ?????????????????????? I haven't a clue

start 000100:0 end 000103:7 length    31 segment .bit, initialized

start 0000fd5e end 0000fd62 length     4 segment .bit, from

        Boolean variables (yours will not be like this)

start 00000104 end 00000104 length     0 segment .data

        initialized variables in  RAM

start 00000104 end 00000266 length   354 segment .bss

        uninitialized variables in  RAM

start 00000000 end 00000ef2 length  3826 segment .info.

start 00000000 end 00034954 length 215380 segment .debug

        ????????????????????????

start 00008000 end 00008080 length   128 segment .const

        Interrupt vectors allocated at 0x8000 for the STM8S207CB

start 0000fd56 end 0000fd5e length     8 segment .init

        ????????????????????????

My EEPROM data files are created outside the STVD environment and loaded into the micro via STVP.  You could create a 16K app that loads into FLASH and a separate DATA file without exceeding the 16k limit

jdf

nholzem
Associate II
Posted on June 20, 2011 at 03:43

Hello John,

Thanks a lot for sharing your knowledge.

The info you posted is going to be very useful, it's exactly what i needed to get me started.

Greetings!

Nick

konay61
Associate II
Posted on March 02, 2012 at 15:40

Hello,

While I was looking for something else on forum surprisingly I came up this page and thanks god that it happened! I have been looking for this information for a long time and I found out now.. For sure, many will be needing that.

Regards.