Skip to content

[feat] add: canio-debug-support and simple-hf-decoder#27

Open
marinauterion wants to merge 1 commit into
mainfrom
add_postmortemdbg_for_chunk_hf
Open

[feat] add: canio-debug-support and simple-hf-decoder#27
marinauterion wants to merge 1 commit into
mainfrom
add_postmortemdbg_for_chunk_hf

Conversation

@marinauterion

@marinauterion marinauterion commented Jun 18, 2026

Copy link
Copy Markdown

fix: stlink-config to use hla_swd instead of swd for h7x
add: python-script to parse canio-uavcan-hardfault-dump

PROBLEM TO SOLVE:

On boards with low non-volatile memory nor sd-card the hardfault needs to be extruded as efficient as possible.

The Board does provides a minimalistic hardfault_dump.
BUT: A binary-blob can not be fed into postmortem-option

SOLUTION

A parser-script to parse hardfault-blobs and provide a gdb-postmortem valid format

The Hardfaultparser:

  • explicitly for ARMv7-M + FPU (canio, STM32F412CE)

TEST

python3 hardfaults_decode.py hardfault_test_files/dump1.dmp
Task:  'task_watchdog'  pid=222  line=173
File:  'armv7-m/arm_hardfault.c'
PC:    0x0805b236  LR: 0x0805b1fb  SP: 0x2001b8c0
Wrote: hardfault_test_files/dump1.hardfault.log
Wrote: hardfault_test_files/dump1.coredump.txt

The different Stackvalues relate to the Firmware-Logic

  1. print hardfault (expected output)
  2. write hardfault to Mem

GDB PostMortem-Test

python3 -m emdbg.bench.fmu --target auterion_canio_default --coredump ~/Repos/embedded-debug-tools/scripts/hardfault_test_files/coredump_dump1.txt
Reading symbols from …default.elf...
Remote debugging using | CrashDebug --elf …default.elf --dump embedded-debug-tools/scripts/hardfault_test_files/coredump_dump1.txt
task_watchdog::TaskWatchdog::task_spawn (argc=<optimized out>, argv=<optimized out>)
    at …/TaskWatchdog.cpp:98
98			desc.task_id = -1;
=> 0x0805b236 <_ZN13task_watchdog12TaskWatchdog10task_spawnEiPPc+38>:	f04f 32ff	mov.w	r2, #4294967295	@ 0xffffffff
   0x0805b23a <_ZN13task_watchdog12TaskWatchdog10task_spawnEiPPc+42>:	611a    	strr2, [r3, #16]
…/cmsis_svd/parser.py:28: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources
Source directories searched: …
(gdb) info registers
r0             0x0                 0
r1             0x808f577           134804855
r2             0x2001b137          536981815
r3             0x210               528
r4             0xe000e000          -536813568
r5             0x2001b132          536981810
r6             0x200020b0          536879280
r7             0x2001b118          536981784
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0x0                 0
sp             0x2001b8c0          0x2001b8c0
lr             0x805b1fb           134590971
pc             0x805b236           0x805b236 <task_watchdog::TaskWatchdog::task_spawn(int, char**)+38>
xpsr           0x61000000          1627389952
fpscr          0xfeedc0de          -17973026
msp            0x2001b8c0          536983744
psp            0x2001b8c0          536983744
(gdb)

FUTURE

  • also decode comprimized blob
  • arch-indepedant blob -> analyze elf/bin-file to get specific informations

@marinauterion marinauterion requested a review from alexcekay June 18, 2026 12:23
@marinauterion marinauterion marked this pull request as draft June 18, 2026 12:38
fix: stlink-config to use hla_swd instead of swd for h7x

add: python-script to parse canio-uavcan-hardfault-dump
@marinauterion marinauterion force-pushed the add_postmortemdbg_for_chunk_hf branch from 6bfde81 to faa9159 Compare June 18, 2026 12:51
@marinauterion marinauterion marked this pull request as ready for review June 18, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant