AnsweredAssumed Answered

STM8S207 - Linker error "Section boundary crossing"

Question asked by hogg.stefan on Apr 24, 2013
Hi together,

I'm writing a application for a STM8S207C8 (64k flash).Currently my code needs 50kB of the flash,
what means that the "magic" address 0xFFFF is crossed.
Therefore I use the compiler option "+modsl" (recommended by the compiler manual).

This configuration works properly.

Now I would like to use the power-on self-test functionality from the ST self-test library.
Therefore I created the needed sections in linker file and mapped the call of "STL_StartUp" at my reset
interrupt vector (as recommended by AN3181, corresponding to the ST self-test library).

The bad fact is that with this new configuration I get the following linker error:

#error clnk Debug_Standard\sey-redesign.lkf:92 Debug_Standard\stm8s_stl_startup.o: section boundary crossing (.text:00c9) f__stext

I looked for this error code in the STM8 forum but I couldn't find a answer that would help me.

I only found the hint to note the chapter "Memory Models for code larger than 64K" in the compiler manual.
It recommends to use the compiler option "+modsl". This option I've already used.

Additionally I found the hint to avoid the compiler options "-gnc" and "+nocross". These options were not used in my application.

Do anyone of you have another idea how to avoid this linker error?

Thanks, Stefan.

I use following environment:
IDE: ST Visual Develop (v4.3.1)
Compiler: COSMIC CXSTM8 (v4.3.7)

Content of the used linker file:
001.# LINK COMMAND FILE AUTOMATICALLY GENERATED BY STVD:
002.#  * TOTALLY IF AUTO MODE IS ENABLED
003.#  * ONLY INSIDE MARKERS IN SEMI-AUTO MODE
004.#
005.# CHOOSE THE CUSTOM MODE IN STVD IN ORDER TO HAVE FULL CONTROL OVER THIS FILE.
006.#
007.# Sections delimited by <BEGIN ...> and <END ...> markers are reserved for
008.# STVD: DO NOT MODIFY INSIDE.
009.#
010.# Manual modifications are allowed OUTSIDE these sections, WHEN STVD AUTO MODE
011.# IS DISABLED.
012.#
013.# CAUTION:
014.#  * Changing from Custom to Semi-Auto mode removes modifications in
015.#    STVD-reserved sections
016.#  * Changing to Auto mode removes all modifications.
017.#
018.# In Semi-Auto mode, you are allowed to remove <BEGIN ...> and <END ...> markers
019.# in order to gain control over the concerned sections. As a consequence any
020.# modification from the STVD graphical interface concerning this section will be
021.# ignored.
022.#
023.# Please refer to Cosmic User Manuals before any modification.
024.# Note that errors in editing this file may have unpredictable results when
025.# running STVD.
026. 
027.# Segment configuration - section reserved for STVD
028.#<BEGIN SEGMENT_CONF>
029.# Segment Code,Constants:
030.+seg .const -b 0x9080 -m 0xd980 -n .const -it -ck
031.+seg .FLASH_CONST -a .const -n .FLASH_CONST
032.+seg .FLASH_CODE -a .FLASH_CONST -n .FLASH_CODE
033.+seg .text -a .FLASH_CODE -n .text -ck
034.+seg .cksum -a .text -n .cksum -ik
035.# Segment lcDSL flash data:
036.+seg .lcDSL_flash -b 0x16a00 -m 0x1600 -n .lcDSL_flash -ck
037.# Segment Eeprom Encoder Settings:
038.+seg .eep_enc_sets -b 0x4000 -m 0x100 -n .eep_enc_sets
039.# Segment Eeprom Factory Settings:
040.+seg .eep_fact_sets -b 0x4100 -m 0x100 -n .eep_fact_sets
041.# Segment Eeprom #1:
042.+seg .eeprom -b 0x4200 -m 0x2fe -n .eeprom
043.# Segment Eeprom Bootloader:
044.+seg .eep_boot -b 0x44fe -m 0x2 -n .eep_boot
045.# Segment Eeprom lcDSL:
046.+seg .eep_lcDSL -b 0x4500 -m 0x100 -n .eep_lcDSL
047.# Segment Zero Page:
048.+seg .bsct -b 0x0 -m 0x100 -n .bsct
049.+seg .ubsct -a .bsct -n .ubsct
050.+seg .bit -a .ubsct -n .bit -id
051.+seg .share -a .bit -n .share -is
052.# Segment Ram:
053.+seg .data -b 0x200 -m 0xc01 -n .data
054.+seg .bss -a .data -n .bss
055.+seg .FLASH_CODE -a .bss -n .FLASH_CODE -a .bss -n boot_RAM -ic
056.# Segment Class B:
057.+seg .RUN_TIME_BUF -b 0x100 -m 0x100 -n .RUN_TIME_BUF -m 0x10
058.+seg .CLASS_B -a .RUN_TIME_BUF -n .CLASS_B -a .RUN_TIME_BUF -m 0x78
059.+seg .CLASS_B_REV -a .CLASS_B -n .CLASS_B_REV -a .CLASS_B -m 0x78
060.# Segment Stack Bottom:
061.+seg .STACK_BOTTOM -b 0xd00 -m 0x100 -n .STACK_BOTTOM
062.#<END SEGMENT_CONF>
063. 
064. 
065.# Startup file - section reserved for STVD
066.#<BEGIN STARTUP_FILE>
067.crtsi.sm8
068.#<END STARTUP_FILE>
069. 
070. 
071.# Object files list - section reserved for STVD
072.#<BEGIN OBJECT_FILES>
073.Debug_Standard\adc.o
074.Debug_Standard\commands.o
075.Debug_Standard\eeprom.o
076.Debug_Standard\error.o
077.Debug_Standard\hiperface.o
078.Debug_Standard\init.o
079.Debug_Standard\lcdsl.o
080.Debug_Standard\main.o
081.Debug_Standard\pcbtest.o
082.Debug_Standard\position.o
083.Debug_Standard\stm8s_it.o
084.Debug_Standard\util.o
085.Debug_Standard\_block_cksum161.o
086.Debug_Standard\_classb_cksum161.o
087.Debug_Standard\stm8s_stl_clockstart.o
088.Debug_Standard\stm8s_stl_cpustart_csmc.o
089.Debug_Standard\stm8s_stl_crc16run.o
090.Debug_Standard\stm8s_stl_fullram_csmc.o
091.Debug_Standard\stm8s_stl_main.o
092.Debug_Standard\stm8s_stl_startup.o
093.Debug_Standard\stm8s_adc2.o
094.Debug_Standard\stm8s_awu.o
095.Debug_Standard\stm8s_beep.o
096.Debug_Standard\stm8s_clk.o
097.Debug_Standard\stm8s_exti.o
098.Debug_Standard\stm8s_flash.o
099.Debug_Standard\stm8s_gpio.o
100.Debug_Standard\stm8s_i2c.o
101.Debug_Standard\stm8s_itc.o
102.Debug_Standard\stm8s_iwdg.o
103.Debug_Standard\stm8s_rst.o
104.Debug_Standard\stm8s_spi.o
105.Debug_Standard\stm8s_tim1.o
106.Debug_Standard\stm8s_tim2.o
107.Debug_Standard\stm8s_tim3.o
108.Debug_Standard\stm8s_tim4.o
109.Debug_Standard\stm8s_uart1.o
110.Debug_Standard\stm8s_uart3.o
111.Debug_Standard\stm8s_wwdg.o
112.#<END OBJECT_FILES>
113. 
114. 
115.# Library list - section reserved for STVD
116.#<BEGIN LIBRARY_FILES>
117.libisl.sm8
118.libm.sm8
119.#<END LIBRARY_FILES>
120. 
121. 
122.# Interrupt vectors file - section reserved for STVD
123.#<BEGIN VECTOR_FILE>
124.+seg .const -b 0x9000 -k
125.Debug_Standard\stm8s_interrupt_vector.o
126.#<END VECTOR_FILE>
127. 
128.# Defines - section reserved for STVD
129.#<BEGIN DEFINED_VARIABLES>
130.+def __endzp=@.ubsct            # end of uninitialized zpage
131.+def __memory=@.bss             # end of bss segment
132.+def __startmem=@.STACK_BOTTOM
133.+def __endmem=0x13ff
134.+def __stack=0x17ff
135.#<END DEFINED_VARIABLES>

Outcomes