Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on IO Serial constructor #1226

Closed
meganetaaan opened this issue Oct 3, 2023 · 7 comments
Closed

Crash on IO Serial constructor #1226

meganetaaan opened this issue Oct 3, 2023 · 7 comments
Labels
fixed - please verify Issue has been fixed. Please verify and close.

Comments

@meganetaaan
Copy link
Contributor

Build environment: Linux (22.04)
Moddable SDK version: v4.2.0
Target device: M5Stack Basic

Description
The application crashes when instantiating the Serial class of TC53 IO. As a result, examples/io/serial/echo keeps rebooting.

Steps to Reproduce

  1. cd $MODDABLE/examples/io/serial/echo
  2. mcconfig -m -i -p esp32/m5stack
  3. See error

Expected behavior
Serial correctly instantiates and work.

Other information
Below is the core dump printed via instrumental build.

Executing action: monitor
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP32
Running idf_monitor in directory /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32
Executing "/home/sskw/.espressif/python_env/idf5.1_py3.10_env/bin/python /home/sskw/.local/share/esp32/esp-idf-v5.1.1/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32-elf- --decode-coredumps info --target esp32 --revision 0 /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32/build/xs_esp32.elf -m '/home/sskw/.espressif/python_env/idf5.1_py3.10_env/bin/python' '/home/sskw/.local/share/esp32/esp-idf-v5.1.1/tools/idf.py' '-n'"...
--- esp-idf-monitor 1.3.0 on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:344
load:0x40078000,len:14500
load:0x40080400,len:4
0x40080400: _init at ??:?

load:0x40080404,len:3284
entry 0x40080584
I (36) cpu_start: Multicore app
I (36) cpu_start: Pro cpu up.
I (36) cpu_start: Starting app cpu, entry point is 0x40080e7c
0x40080e7c: call_start_cpu1 at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_system/port/cpu_start.c:154

I (0) cpu_start: App cpu up.
I (50) cpu_start: Pro cpu start user code
I (50) cpu_start: cpu freq: 240000000 Hz
I (50) cpu_start: Application information:
I (52) cpu_start: Project name:     xs_esp32
I (56) cpu_start: App version:      4.2.0-dirty
I (60) cpu_start: Compile time:     Oct  3 2023 12:09:52
I (65) cpu_start: ELF file SHA256:  8eb129f0dd5f84f7...
I (70) cpu_start: ESP-IDF:          v5.1.1
I (74) cpu_start: Min chip rev:     v0.0
I (77) cpu_start: Max chip rev:     v3.99 
I (81) cpu_start: Chip rev:         v3.0
I (85) heap_init: Initializing. RAM available for dynamic allocation:
I (91) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (96) heap_init: At 3FFB9DB8 len 00026248 (152 KiB): DRAM
I (101) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (107) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (112) heap_init: At 400914DC len 0000EB24 (58 KiB): IRAM
I (118) spi_flash: detected chip: generic
I (121) spi_flash: flash io: qio
W (124) spi_flash: Detected size(16384k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (137) esp_core_dump_uart: Init core dump to UART
I (141) app_start: Starting scheduler on CPU0
I (145) app_start: Starting scheduler on CPU1
I (145) main_task: Started on CPU0
I (153) main_task: Calling app_main()
instruments key: Pixels drawn,Frames drawn,Network bytes read,Network bytes written,Network sockets,Timers,Files,Poco display list used,Piu command List used,SPI flash erases,Turns,System bytes free,CPU 0,CPU 1,Chunk used,Chunk available,Slot used,Slot available,Stack used,Stack available,Garbage collections,Keys used,Modules loaded,Parser used,Floating Point,Promises settled
I (199) main_task: Returned from app_main()
No Wi-Fi SSID
instruments: 0,0,0,0,0,0,0,0,0,0,0,74708,100,11,276,78848,1904,78832,1040,8192,0,0,0,0,0,0
E (1105) dac_contin"�6c6:0x3ffc0b90 0x400d9b25:0x3ffc0c20 0x400d707c:0x3ffc0c40 0x4008c9b5:0x3ffc0c60
0x400d9b25: modTimersExecute at /home/sskw/.local/share/moddable/modules/base/timer/mc/timer.c:86

0x400d707c: loop_task at /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32/main/main.c:141 (discriminator 1)

0x4008c9b5: vPortTaskWrapper at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162





ELF file SHA256: 8eb129f0dd5f84f7

I (1188) esp_core_dump_uart: Press Enter to print core dump to UART...
Initiating core dump!
I (1195) esp_core_dump_uart: Print core dump to uart...
Core dump started (further output muted)
Received  15 kB...
Core dump finished!
===============================================================
==================== ESP32 CORE DUMP START ====================

Crashed task handle: 0x3ffc0cec, name: 'main', GDB name: 'process 1073482988'

================== CURRENT THREAD REGISTERS ===================
exccause       0x1c (LoadProhibitedCause)
excvaddr       0xb0
epc1           0x400d646e
epc2           0x0
epc3           0x0
epc4           0x0
epc5           0x0
epc6           0x0
eps2           0x0
eps3           0x0
eps4           0x0
eps5           0x0
eps6           0x0
pc             0x4010d659          0x4010d659 <uart_enable_intr_mask+77>
lbeg           0x4000c46c          1073792108
lend           0x4000c477          1073792119
lcount         0xffffffff          4294967295
sar            0x1d                29
ps             0x60f23             397091
threadptr      <unavailable>
br             <unavailable>
scompare1      <unavailable>
acclo          <unavailable>
acchi          <unavailable>
m0             <unavailable>
m1             <unavailable>
m2             <unavailable>
m3             <unavailable>
expstate       <unavailable>
f64r_lo        <unavailable>
f64r_hi        <unavailable>
f64s           <unavailable>
fcr            <unavailable>
fsr            <unavailable>
a0             0x8010d7b4          -2146379852
a1             0x3ffc0840          1073481792
a2             0x3ffb5ef0          1073438448
a3             0x101               257
a4             0x3ffb08a8          1073416360
a5             0x3ffb08a4          1073416356
a6             0x20                32
a7             0x8                 8
a8             0x0                 0
a9             0x3ffc0810          1073481744
a10            0x3ffb08a8          1073416360
a11            0x60f20             397088
a12            0x0                 0
a13            0x60f23             397091
a14            0xb33fffff          -1287651329
a15            0xb33fffff          -1287651329

==================== CURRENT THREAD STACK =====================
#0  0x4010d659 in uart_enable_intr_mask (uart_num=<optimized out>, enable_mask=257) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:356
#1  0x4010d7b4 in uart_enable_rx_intr (uart_num=2) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:557
#2  0x400e3271 in xs_serial_constructor (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/modules/io/serial/esp32/serial.c:200
#3  0x400f3a86 in fxRunID (the=0x3ffc0e4c, generator=0x0, count=<optimized out>) at /home/sskw/.local/share/moddable/xs/sources/xsRun.c:869
#4  0x400f14e9 in fxRunImportNow (the=0x3ffc0e4c, realm=<optimized out>, moduleID=789) at /home/sskw/.local/share/moddable/xs/sources/xsModule.c:2270
#5  0x400f17fa in fxImportNow (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/xs/sources/xsModule.c:2176
#6  0x400d7749 in setStepDone (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/xs/platforms/mc/xsHosts.c:560
#7  0x400f3a86 in fxRunID (the=0x3ffc0e4c, generator=0x0, count=<optimized out>) at /home/sskw/.local/share/moddable/xs/sources/xsRun.c:869
#8  0x400e6240 in fxRunCount (the=0x3ffc0e4c, count=1) at /home/sskw/.local/share/moddable/xs/sources/xsAPI.c:1205
#9  0x400d96c9 in xs_timer_callback (timer=0x3ffafd08, refcon=0x3ffafd20, refconSize=<optimized out>) at /home/sskw/.local/share/moddable/modules/base/timer/modTimer.c:64
#10 0x400d9b28 in modTimersExecute () at /home/sskw/.local/share/moddable/modules/base/timer/mc/timer.c:86
#11 0x400d707f in loop_task (pvParameter=<optimized out>) at /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32/main/main.c:141
#12 0x4008c9b8 in vPortTaskWrapper (pxCode=0x400d7068 <loop_task>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

======================== THREADS INFO =========================
  Id   Target Id          Frame 
* 1    process 1073482988 0x4010d659 in uart_enable_intr_mask (uart_num=<optimized out>, enable_mask=257) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:356
  2    process 1073413736 0x40088862 in esp_cpu_wait_for_intr () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_hw_support/cpu.c:121
  3    process 1073466232 0x40088862 in esp_cpu_wait_for_intr () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_hw_support/cpu.c:121
  4    process 1073412968 0x4000bff0 in ?? ()
  5    process 1073468636 0x4008d63a in prvProcessTimerOrBlockTask (xListWasEmpty=<optimized out>, xNextExpireTime=0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/xtensa/include/xt_utils.h:40
  6    process 1073412616 0x4000bff0 in ?? ()
  7    process 1073411236 0x4000bff0 in ?? ()

==================== THREAD 1 (TCB: 0x3ffc0cec, name: 'main') =====================
#0  0x4010d659 in uart_enable_intr_mask (uart_num=<optimized out>, enable_mask=257) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:356
#1  0x4010d7b4 in uart_enable_rx_intr (uart_num=2) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:557
#2  0x400e3271 in xs_serial_constructor (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/modules/io/serial/esp32/serial.c:200
#3  0x400f3a86 in fxRunID (the=0x3ffc0e4c, generator=0x0, count=<optimized out>) at /home/sskw/.local/share/moddable/xs/sources/xsRun.c:869
#4  0x400f14e9 in fxRunImportNow (the=0x3ffc0e4c, realm=<optimized out>, moduleID=789) at /home/sskw/.local/share/moddable/xs/sources/xsModule.c:2270
#5  0x400f17fa in fxImportNow (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/xs/sources/xsModule.c:2176
#6  0x400d7749 in setStepDone (the=0x3ffc0e4c) at /home/sskw/.local/share/moddable/xs/platforms/mc/xsHosts.c:560
#7  0x400f3a86 in fxRunID (the=0x3ffc0e4c, generator=0x0, count=<optimized out>) at /home/sskw/.local/share/moddable/xs/sources/xsRun.c:869
#8  0x400e6240 in fxRunCount (the=0x3ffc0e4c, count=1) at /home/sskw/.local/share/moddable/xs/sources/xsAPI.c:1205
#9  0x400d96c9 in xs_timer_callback (timer=0x3ffafd08, refcon=0x3ffafd20, refconSize=<optimized out>) at /home/sskw/.local/share/moddable/modules/base/timer/modTimer.c:64
#10 0x400d9b28 in modTimersExecute () at /home/sskw/.local/share/moddable/modules/base/timer/mc/timer.c:86
#11 0x400d707f in loop_task (pvParameter=<optimized out>) at /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32/main/main.c:141
#12 0x4008c9b8 in vPortTaskWrapper (pxCode=0x400d7068 <loop_task>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 2 (TCB: 0x3ffafe68, name: 'IDLE') =====================
#0  0x40088862 in esp_cpu_wait_for_intr () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_hw_support/cpu.c:121
#1  0x4010f764 in esp_vApplicationIdleHook () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_system/freertos_hooks.c:59
#2  0x4008aff6 in prvIdleTask (pvParameters=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c:4327
#3  0x4008c9b8 in vPortTaskWrapper (pxCode=0x4008afc8 <prvIdleTask>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 3 (TCB: 0x3ffbcb78, name: 'IDLE') =====================
#0  0x40088862 in esp_cpu_wait_for_intr () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_hw_support/cpu.c:121
#1  0x4010f764 in esp_vApplicationIdleHook () at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_system/freertos_hooks.c:59
#2  0x4008aff6 in prvIdleTask (pvParameters=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c:4327
#3  0x4008c9b8 in vPortTaskWrapper (pxCode=0x4008afc8 <prvIdleTask>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 4 (TCB: 0x3ffafb68, name: 'esp_timer') =====================
#0  0x4000bff0 in ?? ()
#1  0x4008cbf5 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:568
#2  vPortExitCritical (mux=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:532
#3  0x4008c2cd in ulTaskGenericNotifyTake (uxIndexToWait=<optimized out>, xClearCountOnExit=1, xTicksToWait=4294967295) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c:5820
#4  0x400d3a2b in timer_task (arg=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_timer/src/esp_timer.c:475
#5  0x4008c9b8 in vPortTaskWrapper (pxCode=0x400d3a1c <timer_task>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 5 (TCB: 0x3ffbd4dc, name: 'Tmr Svc') =====================
#0  0x4008d63a in prvProcessTimerOrBlockTask (xListWasEmpty=<optimized out>, xNextExpireTime=0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/xtensa/include/xt_utils.h:40
#1  prvTimerTask (pvParameters=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/timers.c:619
#2  0x4008c9b8 in vPortTaskWrapper (pxCode=0x4008d4f4 <prvTimerTask>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 6 (TCB: 0x3ffafa08, name: 'ipc1') =====================
#0  0x4000bff0 in ?? ()
#1  0x4008cbf5 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:568
#2  vPortExitCritical (mux=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:532
#3  0x4008c3c6 in xTaskGenericNotifyWait (uxIndexToWait=<optimized out>, ulBitsToClearOnEntry=<optimized out>, ulBitsToClearOnExit=4294967295, pulNotificationValue=0x3ffaf940, xTicksToWait=4294967295) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c:5911
#4  0x4008598e in ipc_task (arg=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_system/esp_ipc.c:58
#5  0x4008c9b8 in vPortTaskWrapper (pxCode=0x40085954 <ipc_task>, pvParameters=0x1) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

==================== THREAD 7 (TCB: 0x3ffaf4a4, name: 'ipc0') =====================
#0  0x4000bff0 in ?? ()
#1  0x4008cbf5 in vPortClearInterruptMaskFromISR (prev_level=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:568
#2  vPortExitCritical (mux=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:532
#3  0x4008c3c6 in xTaskGenericNotifyWait (uxIndexToWait=<optimized out>, ulBitsToClearOnEntry=<optimized out>, ulBitsToClearOnExit=4294967295, pulNotificationValue=0x3ffaf3d0, xTicksToWait=4294967295) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c:5911
#4  0x4008598e in ipc_task (arg=<optimized out>) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/esp_system/esp_ipc.c:58
#5  0x4008c9b8 in vPortTaskWrapper (pxCode=0x40085954 <ipc_task>, pvParameters=0x0) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162


======================= ALL MEMORY REGIONS ========================
Name   Address   Size   Attrs
.rtc.text 0x400c0000 0x0 RW  
.rtc.dummy 0x3ff80000 0x0 RW  
.rtc.force_fast 0x3ff80000 0x4 RW A
.rtc_noinit 0x50000000 0x0 RW  
.rtc.force_slow 0x50000000 0x0 RW  
.iram0.vectors 0x40080000 0x403 R XA
.iram0.text 0x40080404 0x110d7 RWXA
.dram0.data 0x3ffb0000 0x4394 RW A
.ext_ram_noinit 0x3f800000 0x0 RW  
.ext_ram.bss 0x3f800000 0x0 RW  
.flash.appdesc 0x3f400020 0x100 R  A
.flash.rodata 0x3f400120 0x37ab8 RW A
.flash.text 0x400d0020 0xba7b3 R XA
.phyiram.20 0x4018a7d4 0x61 R XA
.phyiram.18 0x4018a838 0x10e R XA
.phyiram.19 0x4018a948 0x90 R XA
.phyiram.17 0x4018a9d8 0x2d7 R XA
.phyiram.0 0x4018acb0 0x2b R XA
.phyiram.1 0x4018acdc 0x7d R XA
.phyiram.2 0x4018ad5c 0x21e R XA
.phyiram.3 0x4018af7c 0xab R XA
.phyiram.4 0x4018b028 0xff R XA
.phyiram.6 0x4018b128 0x83 R XA
.phyiram.7 0x4018b1ac 0x1ff R XA
.phyiram.8 0x4018b3ac 0x177 R XA
.phyiram.9 0x4018b524 0x8e R XA
.phyiram.13 0x4018b5b4 0xba R XA
.phyiram.12 0x4018b670 0xeb R XA
.phyiram.14 0x4018b75c 0x1cb R XA
.phyiram.16 0x4018b928 0x72 R XA
.phyiram.11 0x4018b99c 0x78 R XA
.phyiram.15 0x4018ba14 0xba R XA
.phyiram.21 0x4018bad0 0x4a R XA
.phyiram.22 0x4018bb1c 0x31 R XA
.phyiram.23 0x4018bb50 0x103 R XA
.phyiram.24 0x4018bc54 0x87 R XA
.iram0.data 0x400914dc 0x0 RW  
.iram0.bss 0x400914dc 0x0 RW  
.dram0.heap_start 0x3ffb9db8 0x0 RW  
.coredump.tasks.data 0x3ffc0cec 0x15c RW 
.coredump.tasks.data 0x3ffc0780 0x560 RW 
.coredump.tasks.data 0x3ffafe68 0x15c RW 
.coredump.tasks.data 0x3ffbc5c0 0x1a0 RW 
.coredump.tasks.data 0x3ffbcb78 0x15c RW 
.coredump.tasks.data 0x3ffbc9d0 0x1a0 RW 
.coredump.tasks.data 0x3ffafb68 0x15c RW 
.coredump.tasks.data 0x3ffbafa0 0x1c0 RW 
.coredump.tasks.data 0x3ffbd4dc 0x15c RW 
.coredump.tasks.data 0x3ffbd350 0x180 RW 
.coredump.tasks.data 0x3ffafa08 0x15c RW 
.coredump.tasks.data 0x3ffaf830 0x1d0 RW 
.coredump.tasks.data 0x3ffaf4a4 0x15c RW 
.coredump.tasks.data 0x3ffaf2c0 0x1d0 RW 

===================== ESP32 CORE DUMP END =====================
===============================================================
Done!
Coredump checksum='744a5c58'
I (2597) esp_core_dump_uart: Core dump has been written to uart.
Entering gdb stub now.
$T0b#e6GNU gdb (esp-gdb) 12.1_20221002
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=xtensa-esp-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/sskw/.local/share/moddable/build/tmp/esp32/m5stack/instrument/echo/xsProj-esp32/build/xs_esp32.elf...
Remote debugging using /dev/ttyUSB0
warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread
0x4010d659 in uart_enable_intr_mask (
    uart_num=<optimized out>, enable_mask=257)
    at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:356
356	    p_uart_obj[uart_num]->rx_int_usr_mask |= enable_mask;
(gdb) 
@meganetaaan
Copy link
Contributor Author

================== CURRENT THREAD REGISTERS ===================
exccause       0x1c (LoadProhibitedCause)
excvaddr       0xb0
#0  0x4010d659 in uart_enable_intr_mask (uart_num=<optimized out>, enable_mask=257) at /home/sskw/.local/share/esp32/esp-idf-v5.1.1/components/driver/uart/uart.c:356

I think this is a kind of null pointer exception.
p_uart_obj[uart_num] is not initialized below.

esp_err_t uart_enable_intr_mask(uart_port_t uart_num, uint32_t enable_mask)
{
    ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
    UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
    /* Keep track of the interrupt toggling. In fact, without such variable,
     * once the RX buffer is full and the RX interrupts disabled, it is
     * impossible what was the previous state (enabled/disabled) of these
     * interrupt masks. Thus, this will be very particularly handy when
     * emptying a filled RX buffer. */
    p_uart_obj[uart_num]->rx_int_usr_mask |= enable_mask; // <- Here
    uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), enable_mask);
    uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), enable_mask);
    UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
    return ESP_OK;
}

The current serial.c has stopped using the inline copy of uart functions, despite the discussion suggesting its use in Issue #931. It appears that the same problem is still occurring. Is that correct?

@phoddie
Copy link
Collaborator

phoddie commented Oct 3, 2023

Thank you for the analysis. I'm not sure how that change was disabled. After re-enabling, some small changes were needed to get it building. But then it works. We'll get that merged.

mkellner pushed a commit that referenced this issue Oct 7, 2023
@phoddie phoddie added the fixed - please verify Issue has been fixed. Please verify and close. label Oct 11, 2023
@ralphwetzel
Copy link
Contributor

Could someone please confirm this is truly fixed?

I'm unable to run the serial echo example even with the latest SDK (4.3.0-31-g1918979ce). Tried this on a Moddable Two and a M5Atom Lite, directly from commandline by (e.g.) mcconfig -d -m -p esp32/moddable_two. The Moddable Two lights up (backlight), but the hangs (my interpretation). xsbug is unable to reset the device or interrupt the code; nothing at the console, no action in the Instruments panel.

Any idea what I'm potentially doing wrong?

@phoddie
Copy link
Collaborator

phoddie commented Nov 22, 2023

@ralphwetzel, yes it is working. But, what your are trying won't work as-is. Let me explain.

The default serial port on Moddable is on pins 1 and 3. You can confirm that in xsbug:

image

Those are the same two pins are used for by the debugging communication in a debug build. When the serial instance is created, it overrides the debugging connection and so xsbug stops responding. (We should change that so it throws an exception, so that you would have a better idea what is happening)

You have a couple options.

  • Use an instrumented build (mcconfig -d -m -p esp32/moddable_two). Since there is no debugging, there is no conflict. The ESP32 serial monitor lets you enter text so you see that it is working.
  • Change the pins for echo's serial port to something else. Of course, then to test you will need to connect to those pins with a serial monitor. That would look like this:
	let serial = new device.io.Serial({
		...device.Serial.default,
		receive: YOUR_RECEIVE_PIN,
		transmit: YOUR_TRANSMIT_PIN,
		baud: 115200,
		...

@phoddie
Copy link
Collaborator

phoddie commented Nov 22, 2023

I added code to reserve the serial pins when debugging. That causes an exception to be thrown when when the serial constructor tries to use the debug serial port. That seems better. I'll get that committed to help minimize confusion in the future.

image

@ralphwetzel
Copy link
Contributor

Hi Peter!
Thank you very much for this explanation.
Makes perfectly sense & I wasn't aware of it at all...

@phoddie
Copy link
Collaborator

phoddie commented Nov 22, 2023

(Closing as this has been fixed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed - please verify Issue has been fixed. Please verify and close.
Projects
None yet
Development

No branches or pull requests

3 participants