Open MarrekNozka opened 3 years ago
Thanks a lot for your interest, @MarrekNozka ! Please do not hesitate to make suggestions or improvements.
I try build https://github.com/MarrekNozka/stm8-dce-example and I have not success.
I added function UART_Init()
form SPL and I got error messages:
$ make
stm8-ld obj/stm8s_rst.o obj/stm8s_i2c.o obj/stm8s_itc.o obj/stm8s_spi.o obj/stm8s_tim2.o obj/stm8s_awu.o obj/stm8s_it.o
obj/stm8s_uart3.o obj/stm8s_adc2.o obj/stm8s_clk.o obj/stm8s_iwdg.o obj/main.o obj/stm8s_gpio.o obj/stm8s_exti.o
obj/stm8s_tim3.o obj/stm8s_uart1.o obj/stm8s_wwdg.o obj/stm8s_tim1.o obj/stm8s_beep.o obj/stm8s_tim4.o obj/stm8s_can.o
-o obj/STM8.elf -T./elf32stm8s003f3.x --print-memory-usage --gc-sections -Map obj/map_STM8.map
obj/stm8s_clk.o: In function `CLK_GetClockFreq':
src/stm8s_clk.c:583: undefined reference to `__divulong'
obj/stm8s_uart1.o: In function `UART1_Init':
src/stm8s_uart1.c:128: undefined reference to `__divulong'
src/stm8s_uart1.c:129: undefined reference to `__mullong'
src/stm8s_uart1.c:129: undefined reference to `__divulong'
src/stm8s_uart1.c:131: undefined reference to `__mullong'
src/stm8s_uart1.c:131: undefined reference to `__divulong'
I don't know what's happening and where find resolv. I will be vary happy for you assistance. Thanks.
Please take a look at https://github.com/XaviDCR92/stm8-dce-example/issues/2#issuecomment-700907460 for a workaround to this issue.
O.K. I understand. It works. Thanks.
I have a new problem :) I added stm8s_flash.c
file from SPL to project. I got this error:
sdcc src/stm8s_flash.c -DSTM8S208 -mstm8 --out-fmt-elf -c --debug --opt-code-size --asm=gas --function-sections --data-sections -Iinc/ -MM > obj/stm8s_flash.d
sdcc src/stm8s_flash.c -DSTM8S208 -mstm8 --out-fmt-elf -c --debug --opt-code-size --asm=gas --function-sections --data-sections -Iinc/ -o obj/stm8s_flash.o
obj/stm8s_flash.asm: Assembler messages:
obj/stm8s_flash.asm:79: Error: Invalid instruction: ldf [_asm_addr+1].e,a
obj/stm8s_flash.asm:102: Error: Invalid instruction: ldf a,[_asm_addr+1].e
make: *** [Makefile:63: obj/stm8s_flash.o] Chyba 1
rm obj/stm8s_flash.d
7d9f7f2e1e32e98d5863225eec721502964e2914
Reason is inline assembler in stm8s_flash.c
. if I understand correctly, I must this stm8-as convert to gas.
__asm
ld a,_asm_val
ldf [_asm_addr+1].e,a
__endasm;
It works!
I want my thanks to you. Unuse code is removed at linking time. Great. Very good work. My coce with SPL is here: https://github.com/MarrekNozka/stm8-dce-example
Thanks!