Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Namespaces | Functions
fault.hpp File Reference

HardFault handler with register dump. More...

#include <sbl/assert.hpp>
Include dependency graph for fault.hpp:

Go to the source code of this file.

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs functionality.
 
namespace  sbl::fault
 

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)
 

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/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.

Function Documentation

◆ __attribute__()

__attribute__ ( (used)  ) const

Definition at line 83 of file fault.hpp.

References sbl::fault::on_hard_fault().

Here is the call graph for this function: