Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
fault.hpp File Reference

HardFault handler with register dump. More...

Detailed Description

HardFault handler with register dump.

Bridge between the MCU's HardFault vector (in sbl-hardware startup.cpp) and the library's diagnostic output. Including this header provides:

  1. sbl::fault::on_hard_fault() — formats the Cortex-M exception frame
  2. sbl_on_hard_fault() — strong C symbol that overrides the weak default in startup.cpp, connecting the vector to the formatter

The startup.cpp in sbl-hardware declares a weak sbl_on_hard_fault() that just hits a breakpoint. When this header is included in the application, the strong symbol here wins, giving formatted register output on any fault.

Usage: // Include once in your main.cpp (or any single TU) #include <sbl/common/fault.hpp>

// That's it. HardFaults now dump registers to your log output.

The output sink is shared with assert.hpp (SBL_FAULT_OUTPUT). See assert.hpp for sink configuration.

Definition in file fault.hpp.

Go to the source code of this file.

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::fault
 Faults and assertions.
 

Functions

void sbl::fault::on_hard_fault (const uint32_t *frame)
 Format and output the Cortex-M exception stack frame.
 
 __attribute__ ((used)) inline void sbl_on_hard_fault(const uint32_t *frame)
 

Function Documentation

◆ __attribute__()

__attribute__ ( (used)  ) const

Definition at line 85 of file fault.hpp.

References sbl::fault::on_hard_fault().