Functionality Support:
- Bare-Metal
- FreeRTOS
make
make debug
make gdb
Sample Output:
Booting...
Build: [e1c08de:branch:memfault] - [ABD@DESKTOP-KQPPS1L] - Aug 24 2025 - 02:45:47
# [HardFault]
---Registers---
r0: 0000006A r1: 20001E3C r2: 12345678
r3: DEADBEEF r4: 00000044 r5: 00000055
r6: 00000066 r7: 20001DE8 r8: 00000088
r9: 00000099 r10: 000000AA r11: 000000BB
r12: 080026E3 sp: 20001DC8 lr: 08002399
pc: 080023C2 xPSR: 21000000
psp: 00000000 msp: 20001C7C primask: 00000001
control: 00000000 basepri: 00000000 faultmask: 00000000
---Special Registers---
EXC_RETURN: FFFFFFF9
ICSR: 00000803 (0000 0000 0000 0000 0000 1000 0000 0011)
HFSR: 40000000 (0100 0000 0000 0000 0000 0000 0000 0000) // HFSR.FORCED: 1
CFSR: 00008200 (0000 0000 0000 0000 1000 0010 0000 0000)
BFAR: DEADBEEF
---Stack Dump---
0x20001DC0: ???????? ???????? 0000006A 20001E3C
0x20001DD0: 12345678 DEADBEEF 080026E3 08002399
0x20001DE0: 080023C2 21000000 00000080 0000006A
0x20001DF0: FFFFFFFF DEADBEEF 00000055 20001E00
0x20001E00: 20001E38 0000002A 00000099 0000006A
0x20001E10: 20001E18 0800237B 20001E20 080019E9
0x20001E20: 20001E3C 00000001 00000008 00000000
0x20001E30: 20001E38 08001C69 20000918 20001E7C
0x20001E40: 00000000 00000000 00000000 00000000
0x20001E50: 00000000 00000000 00000000 00000000
0x20001E60: 00000000 00000000 00000000 00000000
0x20001E70: 00000000 00000000 00000000 006F6F66
0x20001E80: 00000000 00000000 00000000 00000000
0x20001E90: 00000000 00000000 00000000 00000003
0x20001EA0: 00000001 0D000000 0000000D 00000010
0x20001EB0: 00000020 00000000 20001EC0 08001D01
0x20001EC0: 00000077 080006F1 00000011 00000022
0x20001ED0: 00000033 00000044 00000055 00000066
0x20001EE0: 00000077 00000088 00000099 000000AA
0x20001EF0: 000000BB 000000CC 00000000 08003377
---System Reset---
Using Memfault
make run MFLT=1
# or
make debug MFLT=1
make gdbSample Output:
Booting...
[INFO] MFLT: GNU Build ID: ca9b94f7deaaf23a42da024cdcdd8073fa47eaf4
[INFO] MFLT: S/N: QEMU9128222025
[INFO] MFLT: SW type: qemu-firmware
[INFO] MFLT: SW version: 1.0.0
[INFO] MFLT: HW version: dvt1
[INFO] MFLT: Memfault Initialized!
[INFO] MFLT: MC:SIkEgQlDT1JFAgYAA/wCFAABTAYAAWoGABk8HgAgeFY0Eu++rd5EBgABVQYAAWYGAAnoHQAgiAYAAZkGAAGqBgABuwYAHxOpAAjoHQAgPaI=:
[INFO] MFLT: MC:wE0ACGaiAAgGAAkh6B0AIAgAAQwOAAEUBgApypuU996q8jpC2gJM3N2Ac/pH6vQKDgABBQYACzEuMC4wCw4AAQ0GABtxZW11LWZpcm13YXI=:
[INFO] MFLT: MC:wJsBZQQOAAEEBgAJZHZ0MQcOAAEEBgABKAYAAQUOAAEECAAHlAAABg4AAQIKAAEBBgAJJO0A4BwQAAGCCgABQBAAB+++rd4IAAEBBgAJGO0=:
[INFO] MFLT: MC:wOgBAOAMHgABAQYACQTgAOAQJgABAQYACQTtAOAIBgADAwgMAAEBBgAJ/O0A4AQOAAEBCAAH4QDgBA4AAQEIAAfiAOAEDgABAQgAB+MA4AQ=:
[INFO] MFLT: MC:wLUCDgABAQgAB+QA4CBGAAEBBgAZ6B0AIBgBAADIHgAgagYAH/gdACDvvq3eAB4AIAAeACAIAAEqBgAJbB4AIGoGACkYHgAgH6IACCAeACA=:
[INFO] MFLT: MC:wIIDEZQACDweACABBgABCA4AHzgeACCRlgAIEBIAIHweACB4AAVmb286AAEDBgABAQwABA0GAAEQBgABIA4AEcAeACAplwAIdwYACSUHAAg=:
[INFO] MFLT: MC:gM8DEQYAASIGAAEzBgABRAYAAVUGAAFmBgABdwYAAYgGAAGZBgABqgYAAbsGAAHMDgAPp7UACERVTVAYAD8I:
[INFO] MFLT: MC:CAKnAgIDAQptcWVtdS1maXJtd2FyZQllMS4wLjAGZGR2dDELRsqblPfeqgSlARmUAAIaCACiZgMaCACiPQQYaQUB+0U=:
[INFO] MFLT: Coredump Storage Verification Passed
Build: [e1c08de:branch:memfault] - [ABD@DESKTOP-KQPPS1L] - Aug 24 2025 - 02:37:32
drivers/: STMicroelectronics/stm32f1xx-hal-driver: Provides the STM32Cube MCU Component "hal_driver" of the STM32F1 series.device/: startup_stm32f100xb.s, stm32f100xb.h, system_stm32f1xx.h, system_stm32f1xx.c, syscalls (autogenerated), sysmem.c (autogenerated)cmsis: STMicroelectronics/STM32CubeF1/Drivers/CMSIS/Core/Include
Important ones are marked bold.
- Using Cortex-M3/M4/M7 Fault Exceptions - ARM KEIL
- The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors, 3rd Edition
- ARM System Developer's Guide: Designing and Optimizing System Software
- Making Embedded Systems, 2nd Edition
- How to debug a HardFault on an ARM Cortex-M MCU | Interrupt
- Ending the Embedded Software Dark Ages: Let’s Start With Processor Fault Debugging! - Embedded Artistry
- mbed-os/platform/source/TARGET_CORTEX_M/mbed_fault_handler.c at master · ARMmbed/mbed-os
- CrashCatcher/../CrashCatcher_armv6m.S (Github)
- Cortex-M3/M4 Hard Fault Handler
- Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4
- PX4-Autopilot/../hardfault_log.c (Github)
- Cortex-M3 Devices Generic User Guide
- ARM Cortex-M for Beginners
- Introduction to ARM - Gananand Kini (Slides)
- Introduction to ARM - Gananand Kini (Lectures)
- AArch64 Procedure Call Standard (AAPCS64): ABI, Calling Conventions & Machine Registers
- https://stackoverflow.com/a/72448512