Cosmic Software Frequently Asked Questions
HC08: incorrect display of local variables using ELF/DWARF
Q. I am using the Cosmic HC08/HCS08 compiler and cvdwarf converter to create an ELF/DWARF file. However, when I load it into my debugger the local variables seem to be displayed incorrectly.
A. This is likely a difference in the debugger’s interpretation of the Stack pointer value (SP) value. Use the option –so with CVDWARF V4.5C+ to adjust the SP by one byte. This ambiguity is caused by a one byte difference between the value of the SP register as read by a debugger and the value read by a processor instruction. The default behavior of CVDWARF uses the instruction access address suitable for ZAP and some emulator debuggers while the –so option generates offsets for use with the SP value as read via a debugger interface. (e.g. P&E BDM debuggers).
CVDWARF -so -oapp.elf app.s08