Repository navigation
Closed
Labels
Arch: xtensaIssues related to the Xtensa architectureArea: KernelKernel issuesOS: LinuxIssues related to Linux (building system, etc)Type: BugSomething isn't working
Description
Description / Steps to reproduce the issue
After #14100 was merged, the ELF loader on ESP32-S3 is broken:
Build steps:
make -j distclean && ./tools/configure.sh esp32s3-devkit:elf && make flash ESPTOOL_PORT=/dev/ttyUSB0 -s -j$(nproc) && minicom -D /dev/ttyUSB0
And, then, run elf example:
nsh> elf
Initial memory usage: 40796
elf_main: Registering romdisk at /dev/ram0
elf_main: Mounting ROMFS filesystem at target=/mnt/elf/romfs with source=/dev/ram0
testheader:
****************************************************************************
* Executing errno
****************************************************************************
xtensa_user_panic: User Exception: EXCCAUSE=0003 task: elf
dump_assert_info: Current Version: NuttX 10.4.0 b503b323ce Oct 23 2024 15:40:55 xtensa
dump_assert_info: Assertion failed user panic: at file: common/xtensa_assert.c:180 task: elf process: elf 0x42047d94
up_dump_register: PC: 40056fa1 PS: 00060730
up_dump_register: A0: 8203fd9e A1: 3fc96f50 A2: 40387d50 A3: 3c02135e
up_dump_register: A4: 000000ab A5: 40387df8 A6: 00001d00 A7: 08e0ffe0
up_dump_register: A8: 00000000 A9: 00019c00 A10: 00000000 A11: 3fc96f10
up_dump_register: A12: 00060520 A13: 00060520 A14: 00000040 A15: 00000000
up_dump_register: SAR: 00000020 CAUSE: 00000003 VADDR: 40387df8
up_dump_register: LBEG: 40056f5c LEND: 40056f72 LCNT: 00000000
dump_stackinfo: User Stack:
dump_stackinfo: base: 0x3fc96a90
dump_stackinfo: size: 00002000
dump_stackinfo: sp: 0x3fc96f50
stack_dump: 0x3fc96f30: 00000000 00000000 00000000 00000000 8203e7ea 3fc96f60 00000000 40387d50
stack_dump: 0x3fc96f50: 8203e80e 3fc96f90 fffffff7 40387d50 00000000 3fc972ac 000000ab 00000024
stack_dump: 0x3fc96f70: 000000ab 3fc972a0 3fc969a0 3fc97848 8203e82c 3fc96fb0 00000000 40387d50
stack_dump: 0x3fc96f90: 000000ab fffffffc 3fc972ac 3fc972ac 82045b35 3fc96fe0 00000003 40387d50
stack_dump: 0x3fc96fb0: 3fc969a0 3fc96fe0 3fc97060 3fc97870 000000ab 00000008 3fc97848 00000000
stack_dump: 0x3fc96fd0: 820459f0 3fc97000 3fc97060 40387d50 000000ab 00000008 00000000 3fc96648
stack_dump: 0x3fc96ff0: 8204256a 3fc97020 3fc97060 40387d50 000000ab 40387d50 000000ab 00000009
stack_dump: 0x3fc97010: 820481ba 3fc97060 3fc977c0 00000000 3fc97e00 40387d50 00000000 00000000
stack_dump: 0x3fc97030: 00000000 00000000 00000200 00000015 00000001 3fc97024 3fc97898 00000001
stack_dump: 0x3fc97050: 82048062 3fc97120 3fc977c0 3fc8b08c 40387d50 3fc97e00 000000ac 00000094
stack_dump: 0x3fc97070: 00000004 00000001 00002850 00000000 00000000 0000816d 464c457f 00010101
stack_dump: 0x3fc97090: 00000000 00000000 005e0001 00000001 00000030 00000000 00002378 00000300
stack_dump: 0x3fc970b0: 00000034 00280000 001e001f 00000000 3fc97870 00000000 00000000 00000000
stack_dump: 0x3fc970d0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc970f0: 00000003 00000000 2a2a0a0a 2a2a2a2a 3c029770 00000021 00000000 00000000
stack_dump: 0x3fc97110: 8204811a 3fc97150 3fc8b08c 3fc977c0 00000064 3fc97150 3fc8b08c 3fc971f0
stack_dump: 0x3fc97130: 3c029770 00000021 3fc8c7c4 3fc972ac 82047ece 3fc97190 3fc8b08c 3fc971f0
stack_dump: 0x3fc97150: 00000014 420357a8 42035764 42059b50 3fc971f0 00000000 00000000 00000021
stack_dump: 0x3fc97170: fffffff4 3c029770 00000000 00000000 820347d1 3fc971c0 3fc8b08c 3fc8c800
stack_dump: 0x3fc97190: 00000000 00000000 0000a5f0 00000110 00000000 3c029770 00000021 3c007643
stack_dump: 0x3fc971b0: 82033000 3fc97220 42047d94 00000001 7665642f 6d61722f 00000030 00057bc8
stack_dump: 0x3fc971d0: 00009f5c 00057bc8 0000a0c0 00000000 00000000 00000110 00000200 3c007690
stack_dump: 0x3fc971f0: 3c0296a4 00000000 00000000 00000000 3c00763a 3c007520 00060622 00000000
stack_dump: 0x3fc97210: 00000000 3fc97240 00000000 42047d94 3fc96a80 3fc89b38 00000000 3fc89b38
stack_dump: 0x3fc97230: 00000000 3fc97260 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc97250: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_tasks: PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACKBASE STACKSIZE USED FILLED COMMAND
dump_tasks: ---- --- --- -------- ------- --- ------- ---------- ---------------- 0x3fc8bd90 2048 1040 50.7% irq
dump_task: 0 0 0 FIFO Kthread - Ready 0000000000000000 0x3fc8b1b0 3040 672 22.1% Idle_Task
dump_task: 1 0 224 RR Kthread - Waiting Semaphore 0000000000000000 0x3fc8d6e8 1960 608 31.0% hpwork 0x3fc8c5cc 0x3f0
dump_task: 2 0 100 RR Kthread - Waiting Semaphore 0000000000000000 0x3fc8dfb8 1960 608 31.0% lpwork 0x3fc8c594 0x3f8
dump_task: 3 3 100 RR Task - Waiting Semaphore 0000000000000000 0x3fc8ebc8 30408 1872 6.1% nsh_main
dump_task: 4 4 100 RR Task - Running 0000000000000000 0x3fc96a90 2000 1296 64.8% elf
On which OS does this issue occur?
[OS: Linux]
What is the version of your OS?
Manjaro, Ubuntu
NuttX Version
master
Issue Architecture
[Arch: xtensa]
Issue Area
[Area: Kernel]
Verification
- I have verified before submitting the report.
Metadata
Metadata
Assignees
Labels
Arch: xtensaIssues related to the Xtensa architectureArea: KernelKernel issuesOS: LinuxIssues related to Linux (building system, etc)Type: BugSomething isn't working
Activity
acassis commentedon Oct 23, 2024
The sim:elf is not crashing, but I noticed that about 1KB of RAM is not returned to the system, it could be related to the memory used by the RAMDISK.
anjiahao1 commentedon Oct 24, 2024
Could you help me upload the elf firmware of esp32s3 that you compiled? Thank you @tmedicci
tmedicci commentedon Oct 24, 2024
Of course:
nuttx.zip
xiaoxiang781216 commentedon Oct 29, 2024
@anjiahao1 what's the result?
anjiahao1 commentedon Oct 30, 2024
@tmedicci sorry,can you open
DEBUG_SYMBOLSthis option, andmake -j20flash itthen run elf.get crash log for me, I will analyze this problem. I can get the esp32s3 hardware board on Friday at the earliest.
tmedicci commentedon Oct 30, 2024
Hi @anjiahao1 ,
The log with
DEBUG_SYMBOLSis pretty much the same:Please, find the firmware with it enabled:
nuttx.zip
Thanks!
anjiahao1 commentedon Oct 30, 2024
hello @tmedicci
I used gdbserver. py to analyze and found that the files in the backtrace of the crash are inconsistent with the main thread? Are you using the latest code?
The reason for the crash should be that the buffer was copied incorrectly during memcpy
step
save
as log.txt
and use
/tools/gdbserver.py -a esp32s3 -e nuttx -l log.txt -p 1235xtensa-esp32s3-elf-gdb nuttx -ex "target remote :1235"get this:

crash in memcpy

tmedicci commentedon Oct 30, 2024
No, I'm using the version just after those commits were added (not the newest
master, although our CI shows it keeps crashing).Any idea on why the copy failed after adding these commits?
anjiahao1 commentedon Oct 31, 2024
OK, I will fix this problem as soon as I get the esp32s3 hardware tomorrow.
anjiahao1 commentedon Nov 1, 2024
@tmedicci

I found that when esp32s3 uses up_textheap to request memory, once the requested memory is written, it will crash. I replaced it with lib_malloc and the elf can be loaded normally but cannot be executed. Do you have any tips? Thank you
tmedicci commentedon Nov 1, 2024
Hi @anjiahao1 , please take a look at #14600
I couldn't find any problems in
up_textheap_memalign, but this gave me a hint of what could be the problem...A similar problem (not exactly the same) for ESP32 is reported on #14465 (comment)