mirror of
https://github.com/esphome/esphome.git
synced 2026-05-22 10:25:46 +08:00
[bk72xx] Emit USE_BK72XX_CRASH_HANDLER via cg.add_define
The previous gate lived only in core/defines.h, which is loaded for static analysis / IDE support but not for actual builds. As a result the wrap symbols (__wrap_bk_trap_udef/pabt/dabt) were preprocessed out of crash_handler.cpp at compile time, leaving the linker without a target for the SDK's wrapped trap calls. Set the define from libretiny/__init__.py (where the platform-specific codegen lives — bk72xx/__init__.py is auto-generated and not the right home).
This commit is contained in:
@@ -486,6 +486,10 @@ async def component_to_code(config):
|
||||
# a .noinit region before the SDK's own register dump + bk_cpu_shutdown
|
||||
# chain runs. The .noinit region is injected into the generated linker
|
||||
# script by patch_bk72xx_noinit.py so it survives the watchdog reset.
|
||||
# bk72xx/__init__.py is auto-generated, so the define is set here
|
||||
# rather than there. (defines.h has the matching #ifdef USE_BK72XX
|
||||
# block for static analysis / IDE only — it doesn't drive the build.)
|
||||
cg.add_define("USE_BK72XX_CRASH_HANDLER")
|
||||
for sym in ("bk_trap_udef", "bk_trap_pabt", "bk_trap_dabt"):
|
||||
cg.add_build_flag(f"-Wl,--wrap={sym}")
|
||||
cg.add_platformio_option("extra_scripts", ["pre:patch_bk72xx_noinit.py"])
|
||||
|
||||
Reference in New Issue
Block a user