Open maxgerhardt opened 3 years ago
Per https://sourceware.org/legacy-ml/gdb/2002-08/msg00207.html I've run the file through readelf -wi
and it also complains with the same errors. Debug information in the ELF seems to be incomplete somehow.. from some SPL modules..
<1><2521>: Abbrev Number: 3 (DW_TAG_subprogram)
<2522> DW_AT_sibling : <0x2630>
<2526> DW_AT_name : I2C_Init
<252f> DW_AT_low_pc : 0xa3e1
<2533> DW_AT_high_pc : 0xa5b4
<2537> DW_AT_external : 1
<2538> DW_AT_frame_base : 0x4114 (location list)
[..]
<2><2590>: Abbrev Number: 4 (DW_TAG_formal_parameter)
<2591> DW_AT_location : 2 byte block: 91 a (DW_OP_fbreg: 10)
<2594> DW_AT_name : AddMode
<259c> DW_AT_type : <0x2651>readelf: Warning: Unable to find entry for abbreviation 117
<2><25a0>: Abbrev Number: 4 (DW_TAG_formal_parameter)
<25a1> DW_AT_location : 2 byte block: 91 b (DW_OP_fbreg: 11)
<25a4> DW_AT_name : InputClockFrequencyMHz
<25bb> DW_AT_type : <0x2651>readelf: Warning: Unable to find entry for abbreviation 117
Full readelf -wi
output with a minimal firmware (all modules but GPIO disabled) shows some errors even within the GPIO module for functions / structures that however used in the SPL code..
I've filed a bug at SDCC per https://sourceforge.net/p/sdcc/bugs/3200/ since I don't see where out fault could be (in e.g. the invocation or linking phase).
Sadly we're depending on two SDCC bugs (this plus https://github.com/platformio/platform-ststm8/pull/38#issuecomment-804058030) to get a good debugging experience with non-baremetal projects.
Thanks for looking into the problem. There was also an update for stm8-binutils a year ago or so, but I'm not sure it has something to do with this issue.
If the standard readelf
bintools of my latest MinGW installation and stm8-gdb throw this error with Bogus end-of-siblings marker
and Unable to find entry for abbreviation
for the generated ELF file, I'm more suspecting it has something to do with SDCC, but I hope we'll find out the cause soon.
There have been new developments regarding this in error in here -- it seems that the linking order of the .rel
files is the main culprit for the DWARF error occurring. The .rel
file in which the main()
function occurrs must come first. Not sure about the order of the other files. But with a workaround to influence the linking order (that is, for the spl-blinky project, move the stm8s_gpio.c
file from the framework to the project itself to force a main.rel stm8s_gpio.rel
linking order), debugging was shown to be possible.
I must yet reproduce this on my own but it looks very promising. Maybe @valeros can have a look at this too.
There have been new developments in this with the SDCC devs saying this bug is fixed.
The "Bogus end-of-siblings marker detected..." problems should be fixed in [r12536]
Have to get around to testing it. If it works now, it would finally enable full debugging..
Not sure if this helps, but in my setup debugging STM8 with SPL framework seems working. I'm on Ubuntu 20.04, so I don't have the windows related SDCC issues. I don't have "Warning: Unable to find entry for abbreviation ..." errors from readelf -wi, but I do see the "Bogus end-of-siblings marker detected...", so I assume for my setup they are harmless.
platformio.ini is :
[env:stm8sblack]
platform = ststm8
board = stm8sblack
framework = spl
upload_protocol = stlinkv2
debug_tool = stlink
The test code is a simple blinky.
pio project content:
Since I finally got an SPL example to build and upload correctly on my STM8S103F3 board per #43, I tried to access debugging, but it fails in the sense that it doesn't halt at the
main
function.It seems like there are no DWARF symbols available again although
--debug --out-fmt-elf
is given. Maybe GDB aborts loading DWARF information because of this error:Building with
build_type = debug
and feeding it directly into STM8-GDBGives the same error.
I'll investigate with a nother toolchain version, seems like SDCC is doing something weird here..
EDIT1: This is independent of the activated SPL modules btw, I've tested it with the old config and it fails in the same way.