nuttx/boards/xtensa/esp32
Marco Casaroli 5dafb683e4
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
xtensa/esp32: Let a protected build boot from simple boot.
A protected build on the ESP32 could only use the legacy IDF image format.
Kconfig allowed simple boot to be selected with BUILD_PROTECTED, because the
legacy format is only a default and not a select, but the result did not link
and then did not boot.

Simple boot has no second-stage bootloader.  __start() maps the flash itself,
so everything it reaches must already be in RAM.  kernel-space.ld pinned none
of it, and it did not place esp32_start at all, so the entry point went to the
flash the code was about to map.  The chip loaded the RAM segments, jumped to
0x400d0ba4 and took an IllegalInstruction on the first instruction.

So this pins the bootloader, flash, ROM, clock and log objects that
bootloader_init() and map_rom_segments() reach, along with esp32_start itself,
and defines the six _image_* symbols that __start() needs.  All of it is
behind CONFIG_ESPRESSIF_SIMPLE_BOOT, so a legacy build gets the same IRAM it
had before.

kernel-space.ld also had no `#include <nuttx/config.h>'.  It held no
conditionals until now, so nothing showed the omission:  the new blocks
compiled away silently and the link failed as if the file had not been
changed.

The default is unchanged.  A protected build still selects the legacy format
unless the user clears CONFIG_ESP32_APP_FORMAT_LEGACY.

Verified on an ESP32-DevKitC V4, ESP32-D0WD-V3 revision 3.1, with
esp32-devkitc:knsh and the legacy format turned off.  The kernel flashes at
0x1000 and the user image at 0x90000, with no bootloader and no partition
table.  It maps seven segments, reaches NSH, and runs ostest to the same point
as the legacy build.

Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
2026-08-12 00:37:18 +08:00
..
common xtensa/esp32: Let a protected build boot from simple boot. 2026-08-12 00:37:18 +08:00
esp32-2432S028 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-audio-kit !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-devkitc boards/esp32-devkitc: Let ostest finish on the knsh configuration. 2026-08-11 09:52:16 -03:00
esp32-ethernet-kit !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-lyrat !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-pico-kit !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-sparrow-kit !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32-wrover-kit !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
heltec_wifi_lora32 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
lilygo_tbeam_lora_gps !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
ttgo_eink5_v2 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
ttgo_lora_esp32 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
ttgo_t_display_esp32 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00