Skip to content

esp32: preserve non-CONFIG_ build args when using --custom-board-path - #590

Open
thatbudakguy wants to merge 1 commit into
lvgl-micropython:mainfrom
thatbudakguy:fix/preserve-build-args-custom-board-path
Open

esp32: preserve non-CONFIG_ build args when using --custom-board-path#590
thatbudakguy wants to merge 1 commit into
lvgl-micropython:mainfrom
thatbudakguy:fix/preserve-build-args-custom-board-path

Conversation

@thatbudakguy

Copy link
Copy Markdown

Summary

build_sdkconfig() in builder/esp32.py returns an empty list whenever custom_board_path is set, discarding all extra build args passed to compile() -- not just the CONFIG_ ones. This drops GEN_SCRIPT and FROZEN_MANIFEST, which the rest of the build needs regardless of whether a custom board is used.

Without GEN_SCRIPT, cmake evaluates $ENV{GEN_SCRIPT} as empty when generating LVGL bindings, and looks for gen/_api_gen_mpy.py instead of gen/python_api_gen_mpy.py:

CMake Error at ext_mod/lvgl/micropython.cmake:45 (message):
  Failed to generate .../lv_mp.c
.../bin/python: can't open file '.../lvgl_micropython/gen/_api_gen_mpy.py': [Errno 2] No such file or directory

This breaks the ESP32 build for any project using --custom-board-path (reproduced with a fresh custom board pointing at an M5Stack Tough).

Fix

Only the CONFIG_* args are meant to be skipped for custom boards, since those boards supply their own sdkconfig fragment via sdkconfig.board. The other build args (GEN_SCRIPT, FROZEN_MANIFEST, etc.) should still be forwarded.

Test plan

  • Reproduced the failure on a clean ESP32 build with --custom-board-path
  • Applied this fix and confirmed the build proceeds past LVGL binding generation and completes successfully end to end (full firmware compiles and links)

@kdschlosser

Copy link
Copy Markdown
Collaborator

the only one we should have to worry about preserving is GEN_SCRIPT. the rest of them can be ignored as they are able to be set in the files that are located in the custom boards directory.

@thatbudakguy

Copy link
Copy Markdown
Author

Should we just hardcode it to:

return ['GEN_SCRIPT']

?

@kdschlosser

Copy link
Copy Markdown
Collaborator

I have to look at the code again to see exactly what is being done. I don't remember where the genscript is being injected and where the block is occurring at.

@kdschlosser

Copy link
Copy Markdown
Collaborator

ok the first location is to change here so it reads

            ${Python3_EXECUTABLE} ${BINDING_DIR}/gen/python_api_gen_mpy.py ${LV_CFLAGS} --output=${CMAKE_BINARY_DIR}/lv_mp.c --include=${BINDING_DIR}/lib --include=${BINDING_DIR}/lib/lvgl --board=$ENV{LV_PORT} --module_name=lvgl --module_prefix=lv --metadata=${CMAKE_BINARY_DIR}/lv_mp.c.json --header_file=${LVGL_DIR}/lvgl.h

@kdschlosser

kdschlosser commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

the line here can be removed

then change the code here to read

args = build_sdkconfig(*args)
args.append(f'FROZEN_MANIFEST="{SCRIPT_DIR}/build/manifest.py"')

and that should fix the issue.

@anotherdoesnm

Copy link
Copy Markdown

Planned to report issue with $GEN_SCRIPT but seems you're already solved it, just not merged

@thatbudakguy

Copy link
Copy Markdown
Author

@kdschlosser I've updated with your changes.

build_sdkconfig() returned an empty list whenever custom_board_path was
set, discarding all extra build args passed to compile() -- including
GEN_SCRIPT, which is needed regardless of whether
a custom board is used. Without GEN_SCRIPT, cmake evaluates
$ENV{GEN_SCRIPT} as empty and fails to find the LVGL binding generator
script (gen/<empty>_api_gen_mpy.py instead of
gen/python_api_gen_mpy.py), breaking the ESP32 build for any project
using --custom-board-path.
@thatbudakguy
thatbudakguy force-pushed the fix/preserve-build-args-custom-board-path branch from 8d8d8b8 to 4c7be2c Compare July 13, 2026 17:13
@anotherdoesnm

Copy link
Copy Markdown

@thatbudakguy i got lvgl_micropython working without this config so don't sure it's still actual

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.

3 participants