cancel
Showing results for 
Search instead for 
Did you mean: 

no default placement for segment .UART3_CODE

rhoek9
Associate II
Posted on July 14, 2009 at 13:14

no default placement for segment .UART3_CODE

4 REPLIES 4
rhoek9
Associate II
Posted on May 17, 2011 at 15:03

Hi,

I am trying to alter the Custom Bootloader example code that ST has provided, NA2659.

I am using:

The STM8s208RB (Raisonance kit)

ST Visual Develop 4.1.1 and the cosmic 16k free toolset.

I would like to use UART3 for bootloading and UART1 to send status messages / debugging.

I have run in to a problem while compiling the source, something to do with the linker file.

UART1 is already implemented in de code. I have included the UART3.c and the UART.h provided by ST in the project and Uncommented the _UART3 (1).

When I try to compile the source I get the following errors:

#error clnk Debug\stm8bootloader.lkf:1 no default placement for segment .UART3_CODE

#error clnk Debug\stm8bootloader.lkf:1 no default placement for segment .UART3_CONST

The command: ''clnk -l''C:\Program Files\COSMIC\CXSTM8_16K\Lib'' -o Debug\stm8bootloader.sm8 -mDebug\stm8bootloader.map Debug\stm8bootloader.lkf '' has failed, the returned value is: 1

exit code=1.

I have removed the linker file in the project folder and when i compile the source the linker file is rebuild, but no success.

Then I removed the TIM3 .c and.h, commented the the _TIM3 (1), removed the linker file and rebuild the project.

For some reason the UART3 is not included in the linker file but TIM3 is (which I removed before rebuild)

Can some one tell me what I am doing wrong?

# LINK COMMAND FILE AUTOMATICALLY GENERATED BY STVD7

# SHOULD NOT BE MANUALLY MODIFIED

#

# Put you segment configuration here

# define the .share segment when using compact or memory models only

#

# Segment Code,Constants:

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

+seg .CLK_CONST -a .const -n .CLK_CONST

+seg .UART1_CONST -a .CLK_CONST -n .UART1_CONST

+seg .text -a .UART1_CONST -n .text

+seg .CLK_CODE -a .text -n .CLK_CODE

+seg .GPIO_CODE -a .CLK_CODE -n .GPIO_CODE

+seg .TIM2_CODE -a .GPIO_CODE -n .TIM2_CODE

+seg .TIM3_CODE -a .TIM2_CODE -n .TIM3_CODE

+seg .UART1_CODE -a .TIM3_CODE -n .UART1_CODE

+seg .WWDG_CODE -a .UART1_CODE -n .WWDG_CODE

+seg .IWDG_CODE -a .WWDG_CODE -n .IWDG_CODE

# Segment Eeprom:

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

# Segment Zero Page:

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

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

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

# Segment Ram:

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

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

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

#

# Put you startup file here (it depends on the model used)

#

crtsi0.sm8

#

# Put your object files here (they depend on you application)

#

Debug\stm8s_clk.o

Debug\stm8s_flash.o

Debug\stm8s_gpio.o

Debug\stm8s_iwdg.o

Debug\stm8s_tim2.o

Debug\stm8s_uart1.o

Debug\stm8s_uart3.o

Debug\stm8s_wwdg.o

Debug\main.o

#

# Put your library name here (it depends on the model used)

#

libis0.sm8

libm0.sm8

#

# Put your interrupt vectors file here if needed

#

+seg .const -b 0x8000 -k

Debug\stm8_interrupt_vector.o

#

#

+def __endzp=@.ubsct # end of uninitialized zpage

+def __memory=@.bss # end of bss segment

+def __stack=0x17ff

#

mozra27
Associate II
Posted on May 17, 2011 at 15:03

Hi,

Using the old library each IP driver should have the dedicated segment this approach allow to know the real size used in application for each IP(check *.map file), so if you need add any driver in your application you should add the dedicated section in the linker file:

- If using linker automatic generate (by STVD), add directly the dedicated sections in: PrjectSettings\Linker\Category\input

- If using linker personalized (that is your case), you can edit directly the *.lkf file

You can update in your linker file the section code, constants by the following:

# Segment Code,Constants:

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

+seg .CLK_CONST -a .const -n .CLK_CONST

+seg .UART1_CONST -a .CLK_CONST -n .UART1_CONST

+seg .text -a .UART1_CONST -n .text

+seg .CLK_CODE -a .text -n .CLK_CODE

+seg .GPIO_CODE -a .CLK_CODE -n .GPIO_CODE

+seg .TIM2_CODE -a .GPIO_CODE -n .TIM2_CODE

+seg .TIM3_CODE -a .TIM2_CODE -n .TIM3_CODE

+seg .UART1_CODE -a .TIM3_CODE -n .UART1_CODE

+seg .WWDG_CODE -a .UART1_CODE -n .WWDG_CODE

+seg .IWDG_CODE -a .WWDG_CODE -n .IWDG_CODE

+seg .UART3_CODE -a .IWDG_CODE -n .UART3_CODE

+seg .UART3_CONST -a .UART3_CODE -n .UART3_CONST

This approach will be removed when using the last Library

Regards

mozra

rhoek9
Associate II
Posted on May 17, 2011 at 15:03

Hi,

thx you for you reply.

First attempt:

I replaced the # Segment Code,Constants:, with the segment you provided.

when I rebuilt the project the linker file was rewritten and the alteration I made where erased.

Second attempt:

I added .UART3_CONST and .UART3_CODE to the table in

Project Settings/linker/“Category: Input�

When I rebuilt the project the UART3 const and code where added in the linker file. No errors.

# Segment Code,Constants:

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

+seg .CLK_CONST -a .const -n .CLK_CONST

+seg .UART1_CONST -a .CLK_CONST -n .UART1_CONST

+seg .UART3_CONST -a .UART1_CONST -n .UART3_CONST

+seg .text -a .UART3_CONST -n .text

+seg .CLK_CODE -a .text -n .CLK_CODE

+seg .GPIO_CODE -a .CLK_CODE -n .GPIO_CODE

+seg .TIM2_CODE -a .GPIO_CODE -n .TIM2_CODE

+seg .TIM3_CODE -a .TIM2_CODE -n .TIM3_CODE

+seg .UART1_CODE -a .TIM3_CODE -n .UART1_CODE

+seg .WWDG_CODE -a .UART1_CODE -n .WWDG_CODE

+seg .UART3_CODE -a .WWDG_CODE -n .UART3_CODE

+seg .IWDG_CODE -a .UART3_CODE -n .IWDG_CODE

All the stm8s_****.c files that are profided by ST have the following LINKER SECTIONS DEFINITION.

/* LINKER SECTIONS DEFINITION FOR THIS FILE ONLY */

#ifdef USE_COSMIC_SECTIONS

#pragma section (UART1_CODE)

#pragma section const {UART1_CONST}

#pragma section @near [UART1_URAM]

#pragma section @near {UART1_IRAM}

#pragma section @tiny [UART1_UZRAM]

#pragma section @tiny {UART1_IZRAM}

#endif

* When I want to add my own .c files to the project do I need to make a similar LINKER SECTIONS DEFINITION?

* I am writing a custom bootloader. If I understand it correctly most of the code is copied to the RAM. Does the LINKER SECTIONS DEFINITION have any thing to do with that??

mozra27
Associate II
Posted on May 17, 2011 at 15:03

Hi Hoek,

This means that you use the automatic generation for the linker file.

As said below the linker segments have been added to check the code size for each IP used in application, so if you want to add your own code you don't need new section by default your code is placed in .text/.const sections.

But if you want execute from RAM in this case you have need two sections one placed in the FLASH and another placed in the RAM and when you need to execute from RAM the Flash code section should be copied in the dedicated section declared in the RAM (refer to _fctcpy)

You can download the STM8S firmware library version 1.1.1 from this link and refer to the Flash examples:

http://www.st.com/mcu/modules.php?name=mcu&file=familiesdocs&FAM=113

Regrads

mozra