ESPHome 2026.3.0
Loading...
Searching...
No Matches
crash_handler.cpp File Reference

Go to the source code of this file.

Namespaces

namespace  esphome
 Providing packet encoding functions for exchanging data with a remote host.
 
namespace  esphome::rp2040
 

Functions

bool esphome::rp2040::crash_handler_has_data ()
 Returns true if crash data was found this boot.
 
void esphome::rp2040::crash_handler_read_and_clear ()
 Read crash data from watchdog scratch registers and clear them.
 
void esphome::rp2040::crash_handler_log ()
 Log crash data if a crash was detected on previous boot.
 
 if (!is_valid_sram_ptr(frame))
 
 for (uint32_t *p=scan_start;p< stack_top &&p< scan_start+64 &&bt_count< MAX_BACKTRACE;p++)
 
 while (true)
 
void __attribute__ ((naked, used)) isr_hardfault()
 

Variables

bool valid
 
uint32_t pc
 
uint32_t lr
 
uint32_t sp
 
uint32_t backtrace [MAX_BACKTRACE]
 
uint8_t backtrace_count
 
static void uint32_t
 
uint32_t extra_align = (frame[EF_XPSR] & (1u << 9)) ? 1 : 0
 
uint32_tpost_frame = frame + 8 + extra_align
 
uint32_t pre_fault_sp = reinterpret_cast<uintptr_t>(post_frame)
 
watchdog_hw scratch [0] = CRASH_MAGIC_V1
 
uint32_tscan_start = post_frame
 
uint32_tstack_top = reinterpret_cast<uint32_t *>(SRAM_END)
 
uint32_t bt_count = 0
 

Function Documentation

◆ __attribute__()

void __attribute__ ( (naked, used) )

Definition at line 220 of file crash_handler.cpp.

◆ for()

for ( )

Definition at line 187 of file crash_handler.cpp.

◆ if()

if ( ! is_valid_sram_ptrframe)

Definition at line 149 of file crash_handler.cpp.

◆ while()

while ( true )

Definition at line 201 of file crash_handler.cpp.

Variable Documentation

◆ backtrace

uint32_t backtrace[MAX_BACKTRACE]

Definition at line 4 of file crash_handler.cpp.

◆ backtrace_count

uint8_t backtrace_count

Definition at line 5 of file crash_handler.cpp.

◆ bt_count

uint32_t bt_count = 0

Definition at line 185 of file crash_handler.cpp.

◆ extra_align

uint32_t extra_align = (frame[EF_XPSR] & (1u << 9)) ? 1 : 0

Definition at line 167 of file crash_handler.cpp.

◆ lr

Definition at line 2 of file crash_handler.cpp.

◆ pc

Definition at line 1 of file crash_handler.cpp.

◆ post_frame

uint32_t* post_frame = frame + 8 + extra_align

Definition at line 168 of file crash_handler.cpp.

◆ pre_fault_sp

uint32_t pre_fault_sp = reinterpret_cast<uintptr_t>(post_frame)

Definition at line 169 of file crash_handler.cpp.

◆ scan_start

uint32_t* scan_start = post_frame

Definition at line 180 of file crash_handler.cpp.

◆ scratch

watchdog_hw scratch = CRASH_MAGIC_V1

Definition at line 172 of file crash_handler.cpp.

◆ sp

Definition at line 3 of file crash_handler.cpp.

◆ stack_top

uint32_t* stack_top = reinterpret_cast<uint32_t *>(SRAM_END)

Definition at line 182 of file crash_handler.cpp.

◆ uint32_t

void uint32_t
Initial value:
{
watchdog_reboot(0, 0, 10)

Definition at line 141 of file crash_handler.cpp.

◆ valid

bool valid

Definition at line 0 of file crash_handler.cpp.