Commit 145be62
Add build-time patches: absolute USER_C_MODULES, RISC-V frozen native alignment
Two build fixes as .patch files applied by MicroPythonOS's
scripts/build_mpos.sh (see CONTRIBUTING.md), rather than edits to
builder/ in this branch.
esp32_user_c_modules_abspath.patch (apply in this repo's root):
builder/esp32.py passed USER_C_MODULES=../../../../../ext_mod/micropython.cmake,
which CMake resolves against lib/micropython/ports/esp32's real location.
When lib/ is symlinked to another checkout (git worktrees sharing one
MicroPython tree and build directory) that silently compiles the OTHER
checkout's ext_mod. The patch passes the absolute path instead.
esp32_riscv_frozen_native_align.patch (apply in lib/micropython):
frozen @micropython.native / viper functions crashed with an illegal
instruction on their first call on the ESP32-P4. tools/mpy-tool.py
emits their machine code in a code section with aligned(2) for RISC-V,
but the RISC-V assembler never pads a 2-byte alignment inside a code
section, so every array following an odd-sized one starts at an odd
address; jalr clears the low bit and the CPU decodes garbage. A 4-byte
alignment is padded, but only when the file is assembled without
linker relaxation (with relaxation the padding is R_RISCV_ALIGN NOPs,
which fail on odd sizes: "3 bytes required for alignment ... can't
relax section"). So the patch makes mpy-tool.py use aligned(4) for
RV32/RV64, as it already does for Xtensa, and compiles frozen_content.c
with -mno-relax on RISC-V targets. Xtensa builds are unchanged.
Both were previously done by builder/esp32.py code in this PR.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 18d6f14 commit 145be62
2 files changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments