Discussion:
[Qt-creator] Debugging code built with SDCC
Márton Miklós
2018-06-11 12:47:12 UTC
Permalink
Hello all,

I am trying to put together a toolchain for a STM8 (bare metal) target
based on QtCreator, openOCD, SDCC and GDB.

I am proceeding great so far: the debugging of the target works, but I only
able to debug the code at assembly level (even when the Debug menu ->
Operate by instruction is unchecked).

I am using the following command to build the elf file:

sdcc -lstm8 -mstm8 blinky.c --out-fmt-elf --all-callee-saves --debug
--verbose --stack-auto --fverbose-asm --float-reent --no-peep

If I debug it separately from QtCreator with GDB it shows the C code when
it stops at the breakpoint for e.g.

Here is the output of the debugger log pane:

https://pastebin.com/Nzi7YQ7w
&"set disassembly-flavor att\n"
&"No symbol \"disassembly\" in current context.\n"
2117^error,msg="No symbol \"disassembly\" in current context."
Any help/hint about the further things to check would be highly appreciated!


Kind regards,
Miklos Marton
André Pönitz
2018-06-11 07:49:23 UTC
Permalink
Post by Márton Miklós
Hello all,
I am trying to put together a toolchain for a STM8 (bare metal) target
based on QtCreator, openOCD, SDCC and GDB.
I am proceeding great so far: the debugging of the target works, but I only
able to debug the code at assembly level (even when the Debug menu ->
Operate by instruction is unchecked).
sdcc -lstm8 -mstm8 blinky.c --out-fmt-elf --all-callee-saves --debug
--verbose --stack-auto --fverbose-asm --float-reent --no-peep
If I debug it separately from QtCreator with GDB it shows the C code when
it stops at the breakpoint for e.g.
https://pastebin.com/Nzi7YQ7w
&"set disassembly-flavor att\n"
&"No symbol \"disassembly\" in current context.\n"
2117^error,msg="No symbol \"disassembly\" in current context."
This one is harmless.
Post by Márton Miklós
Any help/hint about the further things to check would be highly appreciated!
It looks like there is debug information available, and interestingly
enough it is able to resolve the blinky.c:6 breakpoint to 0x8024.

The breakpoint is hit later, the response has
file="blinky.c",fullname="/home/mm/Projektek/sdcc-examples-stm8/blinky.c"

Does /home/mm/Projektek/sdcc-examples-stm8/blinky.c exist? If not, do you
have a blinky.c file elsewhere? If so, does setting up a source path mapping
under Tools->Options->Debugger->General help? If not, does moving/linking
your sources so that /home/mm/Projektek/sdcc-examples-stm8/blinky.c
exists help?

Andre'
Miklos Marton
2018-06-11 20:08:29 UTC
Permalink
Post by André Pönitz
Does /home/mm/Projektek/sdcc-examples-stm8/blinky.c exist? If not, do you
have a blinky.c file elsewhere?
Yes it exists. It is a flat single file example, nothing fancy.

I will give a try to the source path mapping tomorrow.

Many thanks for the tips!
--
Best regards,
Miklos Marton
Loading...