cancel
Showing results for 
Search instead for 
Did you mean: 

Memory usage on STM8S

tan
Associate II
Posted on January 28, 2014 at 04:56

Hello

My project compiles fine but I'm getting memory errors at the linker stage:

segment .ubsct size overflow (4)

.text size overflow (572)

Is there any way to find out how much memory I have allocated for each of my memory sections (.text, .ubsct, etc.) , and can I change them?

http://textdump.net/raw/4038/

. By adding in a few more variables, I begin to get the overflow error, and could no longer build successfully.

 

Any insights would be very much appreciated!

Thanks!

#overflow #memory-usage #segment-overlap #memory-overflow
3 REPLIES 3
luca239955_stm1_st
Senior II
Posted on January 28, 2014 at 10:14

Hello,

the map file tells you how much memory you have used once the project has been compiled.

The limits *you* have fixed to the linker (including the maximun size for each segment) are in the linker control file: this is a file with extension .lkf that is usually generated automatically by STVD (based on the micro used and that the user can modify in the STVD menus) - or it can be created/modifed by hand.

Looking at your mapfile it looks like you set a limit to 16k of flash and that you are getting over it.

For the RAM (segment .ubsct) you are getting over the hardware limit of 128 bytes in page0: put some (more) of your variables into 16 bit addressing ram (.data) if you have any space left there.

Regards.

tan
Associate II
Posted on January 29, 2014 at 06:13

Hi Luca,

Thanks for the reply. 

Here is my 

http://textdump.net/raw/4045/

 before introducing more variables that caused the error.

I see a segment configuration section in the file :

# Segment configuration - section reserved for STVD

#&.lt;BEGIN SEGMENT_CONF&.gt;

# Segment Code,Constants:

+seg .const -b 0x8080 -m 0x3f80 -n .const -it

+seg .text -a .const -n .text

+seg .FLASH_CODE -a .text -n .FLASH_CODE

+seg .FLASH_CONST -a .FLASH_CODE -n .FLASH_CONST

# Segment Eeprom:

+seg .eeprom -b 0x4000 -m 0x400 -n .eeprom

# Segment Zero Page:

+seg .bsct -b 0x0 -m 0x100 -n .bsct

+seg .ubsct -a .bsct -n .ubsct

+seg .bit -a .ubsct -n .bit -id

+seg .share -a .bit -n .share -is

# Segment Ram:

+seg .data -b 0x100 -m 0x500 -n .data

+seg .bss -a .data -n .bss

+seg .FLASH_CODE -a .bss -n .FLASH_CODE

#&.lt;END SEGMENT_CONF&.gt;

Would you be able to direct me to any guide on how I can modify the segment size manually?

Can I tell if how much memory is left in every segment?

Also, I tried changing the MCU from STM8S105C4 (16K) to STM8S105C6 (32K). Now I get the following error: 

#error clnk Debug\ecmotor.lkf:1 segment .ubsct size overflow (4)

#error clnk Debug\ecmotor.lkf:1 no default placement for segment .FLASH_CODE

#error clnk Debug\ecmotor.lkf:1 segments .ubsct (0x8f-0x104) and .data (0x100-0x1cb) overlap

Is there a setting required to tell the linker that I have 32K memory now?

Best regards,

YA

Posted on February 12, 2018 at 12:43

Hello tan.yu_ang,

Could you solve this problem? Because i have the same...

Thanks