cancel
Showing results for 
Search instead for 
Did you mean: 

How to find program size using map file for stm8 microcontroller.

Mallesh
Associate

              Segments

                --------

start 00008080 end 0000811e length 158 segment .const

start 00008151 end 0000989f length 5966 segment .text

start 00004000 end 00004000 length  0 segment .eeprom

start 00000000 end 0000002b length  43 segment .bsct, initialized

start 00008126 end 00008151 length  43 segment .bsct, from

start 0000002b end 00000068 length  61 segment .ubsct

start 00000068 end 00000068 length  0 segment .bit

start 00000068 end 00000068 length  0 segment .share

start 00000100 end 00000100 length  0 segment .data

start 00000100 end 00000100 length  0 segment .bss

start 00000000 end 00000908 length 2312 segment .info.

start 00000000 end 0000648a length 25738 segment .debug

start 00008000 end 00008080 length 128 segment .const

start 0000811e end 00008126 length  8 segment .init

this type of segment file is created in a map file. I read the cosmic8 manual about segment.

(from manual)

Segments: Describe the different segments which compose the application, specifying for each of them: the start address (in hexa), the end address (in hexa), the length (in decimal), and the name of the segment. Note that the end value is the address of the byte following the last one of the segment, meaning that an empty segment will have the same start and end addresses. If a segment is initialized, it is displayed twice, the first time with its final address, the second time with the address of the image copy.

In that, there is no mention of code size.

Thanks in advance.

1 REPLY 1

Not my platform, and the file doesn't look complete.

Usually they'd be a final digest of how the resources are allocated at the end.

Failing that you could write a simple script to process the file, determining the scope of FLASH (0x8000 .. upward) that contains your firmware image which is typically the text/code section, plus whatever you have in the way of initialized data that must be copied to RAM as it starts up.

Perhaps look at any startup / C Runtime initialization to see what symbols or tables it is using.

If the .MAP doesn't work for you perhaps process the .HEX, or make it create a .BIN, and process those.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..