From db927401a056fd5b2af415c9aff246b340268b19 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 28 Jul 2026 07:22:21 +0200 Subject: [PATCH] fix(compiler): el unlink del sdkconfig va pegado a la escritura de defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un crash entre ambos (el NameError de board_fqbn) dejaba defaults==rendered con un sdkconfig stale, y el re-seed de kconfig no disparaba nunca mas en ese dir persistente — medido: CONSOLE_SECONDARY quedo en usb_serial_jtag pese a los defaults nuevos. El bloque de velxio_board.cmake pasa a despues. --- backend/app/services/espidf_compiler.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/backend/app/services/espidf_compiler.py b/backend/app/services/espidf_compiler.py index 49abe6dd..cf1f411f 100644 --- a/backend/app/services/espidf_compiler.py +++ b/backend/app/services/espidf_compiler.py @@ -2856,6 +2856,21 @@ class ESPIDFCompiler: ) defaults_path.write_text(rendered_sdkconfig, encoding='utf-8') + + # ESP-IDF only SEEDS sdkconfig from sdkconfig.defaults when sdkconfig is + # ABSENT. Persistent build dirs live in the build volume and keep a + # stale sdkconfig across image rebuilds, so a defaults change (a new + # CONFIG_* shipped in the template, or different board options) would + # otherwise never reach kconfig. Drop the generated sdkconfig when the + # rendered defaults change so kconfig re-seeds from them on configure. + # NOTHING may run between the defaults write above and this unlink: a + # crash in between leaves defaults==rendered with a stale sdkconfig, + # and the next run then never re-seeds (measured: the board_fqbn + # NameError left CONSOLE_SECONDARY stale in a persistent dir). + if prev_defaults is not None and prev_defaults != rendered_sdkconfig: + (project_dir / 'sdkconfig').unlink(missing_ok=True) + (project_dir / 'sdkconfig.old').unlink(missing_ok=True) + # Board identity defines (velxio_board.cmake, included OPTIONAL by the # template's top CMakeLists BEFORE project() so they reach EVERY # component — `Serial`'s mapping is decided inside the arduino core's @@ -2886,16 +2901,6 @@ class ESPIDFCompiler: if prev_board_cmake != board_cmake: board_cmake_path.write_text(board_cmake, encoding='utf-8') - # ESP-IDF only SEEDS sdkconfig from sdkconfig.defaults when sdkconfig is - # ABSENT. Persistent build dirs live in the build volume and keep a - # stale sdkconfig across image rebuilds, so a defaults change (a new - # CONFIG_* shipped in the template, or different board options) would - # otherwise never reach kconfig. Drop the generated sdkconfig when the - # rendered defaults change so kconfig re-seeds from them on configure. - if prev_defaults is not None and prev_defaults != rendered_sdkconfig: - (project_dir / 'sdkconfig').unlink(missing_ok=True) - (project_dir / 'sdkconfig.old').unlink(missing_ok=True) - # Generate partitions.csv per the selected scheme. partition_csv = self._render_partition_csv(board_options['partitionScheme']) (project_dir / 'partitions.csv').write_text(partition_csv, encoding='utf-8')