Skip to content

arch/xtensa/esp32: Fix IRAM heap boot issue#18695

Merged
xiaoxiang781216 merged 2 commits intoapache:masterfrom
eren-terzioglu:bugfix/esp32_iram_heap
Apr 9, 2026
Merged

arch/xtensa/esp32: Fix IRAM heap boot issue#18695
xiaoxiang781216 merged 2 commits intoapache:masterfrom
eren-terzioglu:bugfix/esp32_iram_heap

Conversation

@eren-terzioglu
Copy link
Copy Markdown
Contributor

Summary

GH issue states that esp32-devkitc:smp config with enabling CONFIG_ESP32_IRAM_HEAP fails to boot.

  • arch/xtensa/esp32: Fix IRAM heap boot issue

Fix IRAM heap boot issue for esp32

Impact

Impact on user: Yes, a bug fixed on esp32

Impact on build: No

Impact on hardware: ESP32

Impact on documentation: No

Impact on security: No

Impact on compatibility: No

Testing

esp32-devkitc:smp config used withCONFIG_ESP32_IRAM_HEAP enabled

Building

Command to build:

make -j distclean && ./tools/configure.sh esp32-devkitc:smp && kconfig-tweak -e CONFIG_ESP32_IRAM_HEAP && make olddefconfig && make -j8; make download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=921600 ESPTOOL_BINDIR=./

Running

The device was not even booting. Used free command to test heap is been initialized too

Results

Before fix:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffb3da0,len:3568
load:0x40080000,len:34884
entry 0x40082d7c
*** Booting NuttX ***
dram: lma 0x00001020 vma 0x3ffb3da0 len 0xdf0    (3568)
iram: lma 0x00001e18 vma 0x40080000 len 0x8844   (34884)
padd: lma 0x0000a668 vma 0x00000000 len 0x5990   (22928)
imap: lma 0x00010000 vma 0x400e0000 len 0x1fcdc  (130268)
padd: lma 0x0002fce4 vma 0x00000000 len 0x314    (788)
dmap: lma 0x00030000 vma 0x3f410000 len 0xa640   (42560)
total segments stored 6
[CPU0] xtensa_user_panic: User Exception: EXCCAUSE=0003 task: CPU0 IDLE
[CPU0] dump_assert_info: Current Version: NuttX  10.4.0 30218bde9d-dirty Feb 20 2026 14:19:14 xtensa
[CPU0] dump_assert_info: Assertion failed user panic: at file: :0 task(CPU0): CPU0 IDLE process: Kernel 0x400e1f90
[CPU0] up_dump_register:    PC: 400e64c2    PS: 00060730
[CPU0] up_dump_register:    A0: 800e772c    A1: 3ffb0b40    A2: 40088848    A3: 400889d0
[CPU0] up_dump_register:    A4: 40088948    A5: 3f41032c    A6: 00017630    A7: 00000001
[CPU0] up_dump_register:    A8: 00000000    A9: 3ffb0b30   A10: 40088848   A11: 00000000
[CPU0] up_dump_register:   A12: 00000188   A13: 400889d0   A14: 00000004   A15: 00000018
[CPU0] up_dump_register:   SAR: 00000004 CAUSE: 00000003 VADDR: 400889cc
[CPU0] up_dump_register:  LBEG: 4000c46c  LEND: 4000c477  LCNT: 00000000
[CPU0] dump_stacks: ERROR: Stack pointer 3ffb0b40is not within the stack
[CPU0] dump_stackinfo: IRQ Stack:
[CPU0] dump_stackinfo:   base: 0x3ffb1cc4
[CPU0] dump_stackinfo:   size: 00002048
[CPU0] stack_dump: 0x3ffb1cd4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1cf4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1d14: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1d34: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1d54: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1d74: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1d94: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1db4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1dd4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1df4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1e14: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1e34: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1e54: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1e74: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1e94: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1eb4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1ed4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1ef4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1f14: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1f34: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1f54: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1f74: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1f94: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1fb4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1fd4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb1ff4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2014: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2034: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2054: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2074: 00000109 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2094: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb20b4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb20d4: 00000109 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb20f4: 00000000 00000000 00000000 00000009 00000109 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2114: 00000000 00000000 00000000 00000009 00000109 00000000 00000000 00000000
[CPU0] stack_dump: 0x3ffb2134: 800fda3c 3ffb21b4 3ffb21f4 3f412439 32313030 33666662 3ffb21d4 3ffb21b4
[CPU0] stack_dump: 0x3ffb2154: 00000001 3f41a554 00000002 00000000 00000000 00000060 3ffb22e4 3ffb22c4
[CPU0] stack_dump: 0x3ffb2174: 00000008 3f412469 3ffb2254 00000008 00000000 00000000 3ffb2214 3ffb21f4
[CPU0] stack_dump: 0x3ffb2194: 00000028 00000000 00000001 00000003 800f413c 3ffb21f4 00000007 3f412439
[CPU0] stack_dump: 0x3ffb21b4: 3ffb22e4 3ffb22c4 00000008 3ffb22c4 800f413c 3ffb21f4 00000067 3f412439
[CPU0] stack_dump: 0x3ffb21d4: 3ffb22e4 3ffb22c4 00000008 fffffffc 800f4164 3ffb2274 00000001 3f412439
[CPU0] stack_dump: 0x3ffb21f4: 00000067 400fe848 400fe87c 400fe7d4 38206366 34663030 20343631 62666633
[CPU0] stack_dump: 0x3ffb2214: 30333033 33303220 33363334 32362031 36363636 200a3333 66303034 38343865
[CPU0] stack_dump: 0x3ffb2234: 33333320 33333336 32332034 30323633 00000000 0000000a 5f706d75 63617473
[CPU0] stack_dump: 0x3ffb2254: 0000000a 3ffb2304 00000008 fffffffc 80085f28 3ffb22b4 00000001 3f412439
[CPU0] stack_dump: 0x3ffb2274: 3ffb22e4 3ffb22c4 00000008 6b636174 3ffb22e4 3ffb22c4 00000008 34623062
[CPU0] stack_dump: 0x3ffb2294: 3ffb22e4 3ffb22c4 00000008 fffffffc 80085f91 3ffb2304 3ffb2274 3ffb24c4
[CPU0] stack_dump: 0x3ffb22b4: 3ffb22e4 3ffb22c4 00000008 fffffffc 3ffb2324 3ffb2304 3f41273d 3ffb2294
[CPU0] stack_dump: 0x3ffb22d4: 3ffb22e4 3ffb22c4 00000008 fffffffc 3f41273d 3ffb22b4 3ffb22e4 3ffb22c4
[CPU0] stack_dump: 0x3ffb22f4: 80086010 3ffb2344 3f4124e0 00000000 00000008 fffffffc 3f41273d 3ffb22b4
[CPU0] stack_dump: 0x3ffb2314: 3f41273d 3ffb22b4 00000008 00000009 00000000 3ffb22b4 00000008 0002b460
[CPU0] stack_dump: 0x3ffb2334: 8008643c 3ffb2364 3ffb0c00 00000000 3ffb1cc4 00000800 000007f0 3f412748
[CPU0] stack_dump: 0x3ffb2354: 80085c68 3ffb2394 3f4118cc 3ffb0c00 00000000 00000001 00000001 3f4103ad
[CPU0] stack_dump: 0x3ffb2374: 00000000 3ffb1cc4 00000000 00000000 80085b39 3ffb2484 00000003 3ffb0a68
[CPU0] stack_dump: 0x3ffb2394: 00000000 3ffb0cb4 3f41257f 400e1f90 7474754e 6e6f0058 5845203a 55414343
[CPU0] stack_dump: 0x3ffb23b4: 303d4553 20330030 6b736174 5043203a 00000000 0000000a 00000000 00000000
[CPU0] stack_dump: 0x3ffb23d4: 0000000a 2e303100 00302e34 3ffb0da8 80085c59 3ffb2434 30330001 62383132
[CPU0] stack_dump: 0x3ffb23f4: 64396564 7269642d 46207974 32206265 30322030 31203632 39313a34 0034313a
[CPU0] stack_dump: 0x3ffb2414: 3ffb2464 3ffb2444 00000008 65747820 0061736e 3ffb2484 00000003 3ffb0a68
[CPU0] stack_dump: 0x3ffb2434: 3ffb2464 3ffb0c00 3ffb30a0 3f4103d9 00000000 00000000 3f4103e4 00000003
[CPU0] stack_dump: 0x3ffb2454: 00000002 00000000 00000000 00000000 3f4103d9 3ffb30a0 3f412763 400e1f90
[CPU0] stack_dump: 0x3ffb2474: 40080f20 3ffb24a4 00000003 3ffb0a68 3ffb0c00 3ffb0e18 00000000 00000004
[CPU0] stack_dump: 0x3ffb2494: 00040023 3ffb24c4 000000ff 3ffb0ad0 00000000 3ffb0b30 40088848 00000000
[CPU0] stack_dump: 0x3ffb24b4: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] dump_stacks: ERROR: Stack pointer 3ffb0b40 is not within the stack
[CPU0] dump_stackinfo: User Stack:
[CPU0] dump_stackinfo:   base: 0
[CPU0] dump_stackinfo:   size: 00000000
[CPU0] stack_dump: 0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[CPU0] dump_fatal_info: Dump CPU1: RUNNING
[CPU0] dump_tasks:    PID GROUP   CPU PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE      USED   FILLED    COMMAND
[CPU0] dump_tasks:   ----   ---     0 --- -------- ------- --- ------- ---------- ---------------- 0x3ffb1cc4      2048      2032    99.2%!   irq
[CPU0] dump_tasks:   ----   ---     1 --- -------- ------- --- ------- ---------- ---------------- 0x3ffb24c4      2048      2032    99.2%!   irq

After fix:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffb3da0,len:3568
load:0x40080000,len:35544
entry 0x40082d8c
*** Booting NuttX ***
dram: lma 0x00001020 vma 0x3ffb3da0 len 0xdf0    (3568)
iram: lma 0x00001e18 vma 0x40080000 len 0x8ad8   (35544)
padd: lma 0x0000a908 vma 0x00000000 len 0x56f0   (22256)
imap: lma 0x00010000 vma 0x400e0000 len 0x1fcec  (130284)
padd: lma 0x0002fcf4 vma 0x00000000 len 0x304    (772)
dmap: lma 0x00030000 vma 0x3f410000 len 0xa640   (42560)
total segments stored 6

NuttShell (NSH) NuttX-10.4.0
nsh> free
      total       used       free    maxused    maxfree  nused  nfree name
      95528        408      95120        392      95120      2      1 iramheap
     308704       9912     298792      10304     173640     29      4 Umem
nsh> 

Fix IRAM heap boot issue for esp32

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
Refresh nvblk defconfig

Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
@github-actions github-actions bot added Arch: xtensa Issues related to the Xtensa architecture Size: XS The size of the change in this PR is very small Board: xtensa labels Apr 9, 2026
@xiaoxiang781216 xiaoxiang781216 merged commit da74bb3 into apache:master Apr 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: xtensa Issues related to the Xtensa architecture Board: xtensa Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants