STM8S003K3(instead of STM8S003F

If you just exchange framework = arduino with framework = spl in the platformio.ini, it will automatically compile all STM8 SPL sources in your project. Have a look at the reference examples: platform-ststm8/examples/spl-blink at develop · platformio/platform-ststm8 · GitHub

Compilation succeeded, thank you.
But there are two warnings, please help to check

src/fun.c:80: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
src/fun.c:683: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG

void moto_speed(void)
{
switch(moto_work)
{
case 0:
{
arr_val = 5000;
moto_en = 0;
TIM2->CCR1H = (uint8_t)(arr_val>>8);
TIM2->CCR1L = (uint8_t)arr_val;
TIM2->ARRH = (uint8_t)(arr_val>>8);
TIM2->ARRL = (uint8_t)arr_val;
TIM2->CR1 |= TIM2_CR1_CEN;
moto_work = 1;
Timing_Ms(1000,&moto_sp);
start_tim = 100;
break;
}
case 1://加速
{
if(Timing_check(&moto_sp))
{
if(arr_val<=speed[moto_sd-1])
{
arr_val = speed[moto_sd-1];
moto_work = 2;
}
else
{
if(arr_val>1000)
{
arr_val-=20;
Timing_Ms(100,&moto_sp);
}
else
{
arr_val-=5;
Timing_Ms(1000,&moto_sp);
}
}
TIM2->CCR1H = (uint8_t)(arr_val>>8);
TIM2->CCR1L = (uint8_t)arr_val;
TIM2->ARRH = (uint8_t)(arr_val>>8);
TIM2->ARRL = (uint8_t)arr_val;
}
break;
}
case 3:
{
break;
}
case 2:
{
wdt_clr();
break;
}
default: break;
}

}

void Eep_WriteByte(u32 Address,u8 date)
{
(PointerAttr uint8_t) (uint16_t)Address = date;
while(FLASH->IAPSR & 0x04 == 0);
FLASH->IAPSR &= (u8)(~(0x01<<2));
}

The warning points are in bold

I’m not too familiar with SDCC optimization passes. Better ask the compiler authors whether something is wrong: https://sourceforge.net/p/sdcc/support-requests/

One more question, can I not use the sdcc compiler. There is no substitute. I found that the compiled files were much larger than the ones I compiled using stvd

platform-ststm8 currently only supports SDCC as its compiler / toolchain (source).

So when you use stvd

To build applications, STVD provides seamless integration of C and assembly toolchains for STM8 microcontrollers including the Cosmic and Raisonance C compilers and the ST Assembler Linker

Do you use cosmis or raisonance as your compiler? How much did they cost? PlatformIO cannot distribute programs that cost money for free or where you have to individually register a license…

I see. Thank you very much for your recent answers.Thanks again.