2019-10-08 07:53 AM
I'm using ST Visual develop and Cosmic to program a STM8S003K3 and I'm thought it would be nice to use the STM8 Standard Library (downloaded from ST.COM).
Within a very short time I got errors telling me that I tried to put more code in the MCU than possible (8K). I hadn't even finished the initialization of all the peripherals I intend to use.
So I took a look at the compiler settings and changed the optimizations from None to Minimize Code Size.
That did help.
For a few minutes.
A look at the map file shows this: (not the entire file)
--------
Segments
--------
start 00008080 end 00008103 length 131 segment .const
start 00008106 end 00009bab length 6821 segment .text
start 00004000 end 00004000 length 0 segment .eeprom
start 00000000 end 00000000 length 0 segment .bsct
start 00000000 end 0000000a length 10 segment .ubsct
start 0000000a end 0000000a length 0 segment .bit
start 0000000a end 0000000a length 0 segment .share
start 00000100 end 00000100 length 0 segment .data
start 00000100 end 00000100 length 0 segment .bss
start 00000000 end 00000584 length 1412 segment .info.
start 00008000 end 00008080 length 128 segment .const
start 00008103 end 00008106 length 3 segment .init
-------
Modules
-------
C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\Lib\crtsi0.sm8:
start 00008106 end 00008156 length 80 section .text
start 00000100 end 00000100 length 0 section .bss
start 00000000 end 00000000 length 0 section .ubsct
start 00000000 end 00000034 length 52 section .info.
Release\main.o:
start 00008156 end 000081da length 132 section .text
start 00000034 end 000000c0 length 140 section .info.
Release\stm8s_it.o:
start 000081da end 000081ef length 21 section .text
start 000000c0 end 00000150 length 144 section .info.
Release\stm8s_clk.o:
start 000081ef end 000087a3 length 1460 section .text
start 00000150 end 000001e1 length 145 section .info.
start 00008080 end 000080b3 length 51 section .const
Release\stm8s_gpio.o:
start 000087a3 end 000088a1 length 254 section .text
start 000001e1 end 00000273 length 146 section .info.
start 000080b3 end 000080db length 40 section .const
Release\stm8s_tim1.o:
start 000088a1 end 00009a60 length 4543 section .text
start 00000273 end 00000305 length 146 section .info.
start 000080db end 00008103 length 40 section .const
The timer1 initialization takes 4k ?
This is worth 4k ?
static void TIM1_Config(void)
{
TIM1_DeInit();
TIM1_TimeBaseInit(15999, TIM1_COUNTERMODE_UP, 999, 0);
TIM1_ITConfig(TIM1_IT_UPDATE, ENABLE);
TIM1_ARRPreloadConfig(ENABLE);
TIM1_Cmd(ENABLE);
}
Do I have to go back to "bare-metal" register setting?
Now I'm only just starting with STM8, so it is more than likely that I'm doing something very wrong, am I?
Wilko
Solved! Go to Solution.
2019-11-16 01:33 AM
Hi Xavi92
Your last update fixed the issue. Well done!
I'll take a look at gdb tui when I'll have some time.