tmedicci commented on PR #14465:
URL: https://github.com/apache/nuttx/pull/14465#issuecomment-2452092699

   > @tmedicci We cannot reproduce this issue with other boards and qemu which 
use xtensa arch, and we also do not have an ESP32 board. Could you provide the 
ELF file, or could you help debug using J-Link to gather more information? 
Thanks.
   
   Hi! Of course, check the backtrace using the J-Link:
   
   ```
   #0  nxsem_wait (sem=0x40086140) at semaphore/sem_wait.c:263
   #1  0x400e3e0a in nxmutex_lock (mutex=0x40086140) at misc/lib_mutex.c:253
   #2  0x400e54b4 in mm_lock (heap=0x40086140) at mm_heap/mm_lock.c:97
   #3  0x400e5330 in mm_addregion (heap=0x40086140, heapstart=0x400862b8, 
heapsize=105800)
       at mm_heap/mm_initialize.c:112
   #4  0x400e5471 in mm_initialize (name=<optimized out>, heapstart=0x400862b8, 
heapsize=105800)
       at mm_heap/mm_initialize.c:287
   #5  0x400e64b9 in esp32_iramheap_initialize () at chip/esp32_iramheap.c:62
   #6  0x400e64a1 in up_extraheaps_init () at chip/esp32_extraheaps.c:66
   #7  0x400e1b6a in nx_start () at init/nx_start.c:603
   #8  0x4008291a in __esp32_start () at chip/esp32_start.c:293
   #9  __start () at chip/esp32_start.c:358
   ```
   
   It fails to run `atomic_compare_exchange_weak_explicit` when adding the IRAM 
heap. Pay attention that this heap region is accessible through the instruction 
bus and any non-word-aligned access would trigger an exception. If the 
exception triggers, it's treated 
[here](https://github.com/apache/incubator-nuttx/blob/18718316dcddd93b0326da977acdabd9207f73b4/arch/xtensa/src/esp32/esp32_user.c#L352)
 and the execution is supposed to return from the moment it was firstly 
triggered. This function, somehow, makes this mechanism break.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to