ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
esphome::libretiny Namespace Reference

Data Structures

class  ArduinoInternalGPIOPin
 
class  LibreTinyPreferenceBackend
 
class  LibreTinyPreferences
 
class  LTComponent
 

Functions

void ensure_serial_handle (uint8_t port)
 Give a hardware UART its SDK handle before its Serial begin()s.
 
 ESPHOME_LOG_TAG (TAG, "libretiny.crash")
 
 PROGMEM_STRING_TABLE (CrashReasonStrings, "Unknown", "Undefined instruction", "Prefetch abort", "Data abort", "Hard fault", "MemManage fault", "Bus fault", "Usage fault", "Secure fault", "Abort")
 
 __attribute__ ((section(CRASH_RECORD_SECTION))) static CrashRecord s_record
 
bool crash_handler_has_data ()
 Returns true if crash data was found this boot, reading it first if needed.
 
void crash_handler_log ()
 Log crash data if a crash was detected on previous boot.
 
void __wrap_bk_trap_udef (arm_registers *regs)
 
void __wrap_bk_trap_pabt (arm_registers *regs)
 
void __wrap_bk_trap_dabt (arm_registers *regs)
 
 __attribute__ ((used)) uint32_t esphome_record_fault(const uint32_t *frame
 
 lt_wdt_enable (CRASH_REBOOT_WDT_MS)
 
 if (cfsr &CFSR_BFARVALID)
 
 if (frame_addr >=SRAM_START &&frame_addr<=SRAM_END - frame_words *4 &&(frame_addr &3)==0)
 
 fill_record (vector+CRASH_REASON_CORTEX_M_OFFSET, pc, lr, sp, cfsr, address)
 
 finish_record (sp, SRAM_START, SRAM_END)
 
 __attribute__ ((naked, used)) void esphome_fault_entry()
 
void crash_handler_install ()
 Put the crash recorder in front of the SDK's fault handlers.
 
void __wrap_abort ()
 
 ESPHOME_LOG_TAG (TAG, "libretiny.gpio")
 
 ESPHOME_LOG_TAG (TAG, "libretiny")
 
LibreTinyPreferences * get_preferences ()
 
 ESPHOME_LOG_TAG (TAG, "preferences")
 
void setup_preferences ()
 

Variables

uint32_t vector
 
uint32_t uint32_t exc_return
 
uint32_t cfsr = read_reg(SCB_CFSR)
 
uint32_t address = 0
 
auto frame_addr = (uint32_t) frame
 
uint32_t frame_words = (exc_return & EXC_RETURN_STANDARD_FRAME) ? FRAME_WORDS : EXTENDED_FRAME_WORDS
 
uint32_t pc = 0
 
uint32_t lr = 0
 
uint32_t sp = 0
 

Function Documentation

◆ __attribute__() [1/3]

esphome::libretiny::__attribute__ ( (naked, used) )

Definition at line 399 of file crash_handler.cpp.

◆ __attribute__() [2/3]

esphome::libretiny::__attribute__ ( (section(CRASH_RECORD_SECTION)) )

◆ __attribute__() [3/3]

esphome::libretiny::__attribute__ ( (used) ) const

◆ __wrap_abort()

void esphome::libretiny::__wrap_abort ( )

Definition at line 429 of file crash_handler.cpp.

◆ __wrap_bk_trap_dabt()

void esphome::libretiny::__wrap_bk_trap_dabt ( arm_registers * regs)

Definition at line 302 of file crash_handler.cpp.

◆ __wrap_bk_trap_pabt()

void esphome::libretiny::__wrap_bk_trap_pabt ( arm_registers * regs)

Definition at line 297 of file crash_handler.cpp.

◆ __wrap_bk_trap_udef()

void esphome::libretiny::__wrap_bk_trap_udef ( arm_registers * regs)

Definition at line 292 of file crash_handler.cpp.

◆ crash_handler_has_data()

bool esphome::libretiny::crash_handler_has_data ( )

Returns true if crash data was found this boot, reading it first if needed.

Definition at line 140 of file crash_handler.cpp.

◆ crash_handler_install()

void esphome::libretiny::crash_handler_install ( )

Put the crash recorder in front of the SDK's fault handlers.

Definition at line 416 of file crash_handler.cpp.

◆ crash_handler_log()

void esphome::libretiny::crash_handler_log ( )

Log crash data if a crash was detected on previous boot.

Definition at line 151 of file crash_handler.cpp.

◆ ensure_serial_handle()

void esphome::libretiny::ensure_serial_handle ( uint8_t port)
inline

Give a hardware UART its SDK handle before its Serial begin()s.

LibreTiny's LN882H Serial passes the SDK's per port handle to serial_init(), which fills it in, but only the default log port (UART1) has one at boot. Any other port hands it NULL and the chip faults before setup, so a logger or uart on UART0 never boots. Drop this once LibreTiny gives each port storage of its own.

Definition at line 16 of file core.cpp.

◆ ESPHOME_LOG_TAG() [1/4]

esphome::libretiny::ESPHOME_LOG_TAG ( TAG ,
"libretiny"  )

◆ ESPHOME_LOG_TAG() [2/4]

esphome::libretiny::ESPHOME_LOG_TAG ( TAG ,
"libretiny.crash"  )

◆ ESPHOME_LOG_TAG() [3/4]

esphome::libretiny::ESPHOME_LOG_TAG ( TAG ,
"libretiny.gpio"  )

◆ ESPHOME_LOG_TAG() [4/4]

esphome::libretiny::ESPHOME_LOG_TAG ( TAG ,
"preferences"  )

◆ fill_record()

esphome::libretiny::fill_record ( vector+ CRASH_REASON_CORTEX_M_OFFSET,
pc ,
lr ,
sp ,
cfsr ,
address  )

◆ finish_record()

esphome::libretiny::finish_record ( sp ,
SRAM_START ,
SRAM_END  )

◆ get_preferences()

LibreTinyPreferences * esphome::libretiny::get_preferences ( )

Definition at line 249 of file preferences.cpp.

◆ if() [1/2]

else esphome::libretiny::if ( cfsr & CFSR_BFARVALID)

Definition at line 376 of file crash_handler.cpp.

◆ if() [2/2]

esphome::libretiny::if ( frame_addr >=SRAM_START &&frame_addr<=SRAM_END - frame_words *4 && frame_addr &3 = = 0)

Definition at line 386 of file crash_handler.cpp.

◆ lt_wdt_enable()

esphome::libretiny::lt_wdt_enable ( CRASH_REBOOT_WDT_MS )

◆ PROGMEM_STRING_TABLE()

esphome::libretiny::PROGMEM_STRING_TABLE ( CrashReasonStrings ,
"Unknown" ,
"Undefined instruction" ,
"Prefetch abort" ,
"Data abort" ,
"Hard fault" ,
"MemManage fault" ,
"Bus fault" ,
"Usage fault" ,
"Secure fault" ,
"Abort"  )

◆ setup_preferences()

void esphome::libretiny::setup_preferences ( )

Definition at line 251 of file preferences.cpp.

Variable Documentation

◆ address

uint32_t esphome::libretiny::address = 0

Definition at line 375 of file crash_handler.cpp.

◆ cfsr

uint32_t esphome::libretiny::cfsr = read_reg(SCB_CFSR)

Definition at line 374 of file crash_handler.cpp.

◆ exc_return

uint32_t uint32_t esphome::libretiny::exc_return
Initial value:
{
if (s_fault_recorded) {
while (true) {
}
}
s_fault_recorded = true

Definition at line 365 of file crash_handler.cpp.

◆ frame_addr

auto esphome::libretiny::frame_addr = (uint32_t) frame

Definition at line 381 of file crash_handler.cpp.

◆ frame_words

uint32_t esphome::libretiny::frame_words = (exc_return & EXC_RETURN_STANDARD_FRAME) ? FRAME_WORDS : EXTENDED_FRAME_WORDS

Definition at line 382 of file crash_handler.cpp.

◆ lr

uint32_t esphome::libretiny::lr = 0

Definition at line 384 of file crash_handler.cpp.

◆ pc

uint32_t esphome::libretiny::pc = 0

Definition at line 383 of file crash_handler.cpp.

◆ sp

uint32_t esphome::libretiny::sp = 0

Definition at line 385 of file crash_handler.cpp.

◆ vector

uint32_t esphome::libretiny::vector

Definition at line 364 of file crash_handler.cpp.