Skip to content

fix(stm32c5): do not freeze _boot.py (boot hang, REPL unreachable) - #29

Open
cumin777 wants to merge 1 commit into
Seeed-Studio:masterfrom
cumin777:fix/stm32c5-boot-hang
Open

fix(stm32c5): do not freeze _boot.py (boot hang, REPL unreachable)#29
cumin777 wants to merge 1 commit into
Seeed-Studio:masterfrom
cumin777:fix/stm32c5-boot-hang

Conversation

@cumin777

@cumin777 cumin777 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

The STM32C5 firmware (merged in #26) hangs at boot: the REPL never comes up, and Thonny errors with Backend did not respond in time / Write timeout.

Root cause

MicroPython v1.27.0 auto-runs the frozen _boot.py on every boot (in ports/zephyr/main.c: pyexec_frozen_module("_boot.py", false)). Upstream _boot.py does storage mount/format (mount_filesystem_flash / create_flash_partition), and that storage init hangs on this board (external XSPI NOR path), so the board never reaches the REPL. (paullbuth's earlier fork didn't hang because his _boot.py was try/except-guarded and only run after an erased-probe.)

Fix

Stop freezing _boot.py in boards/xiao_stm32c5_manifest.py. With it not frozen, main.c cannot find it, skips it, and the board boots straight to the REPL — Thonny connects and runs again.

-freeze("$(PORT_DIR)/modules", "_boot.py")
+# micropython's frozen _boot.py is intentionally NOT frozen: v1.27.0 auto-runs it
+# on boot and its storage init hangs on this board, blocking the REPL.
+# Storage auto-mount disabled until the underlying storage path is fixed.

Trade-off / follow-up

Storage (LittleFS) is not auto-mounted on boot until the underlying storage hang is investigated and fixed (then we can either re-freeze a safe _boot.py or fix the storage/XSPI config). This PR prioritises unblocking the REPL.

Official MicroPython v1.27.0; no fork, no upstream patch.

v1.27.0 auto-runs the frozen _boot.py on boot (ports/zephyr/main.c:
pyexec_frozen_module). Its storage init hangs on this board, so the
REPL never starts and Thonny times out ('Backend did not respond' /
'Write timeout'). Stop freezing _boot.py so the board boots straight
to the REPL. Storage auto-mount is deferred until the underlying
storage path is fixed.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant