gwbuhl commented on issue #20216:
URL: https://github.com/apache/nuttx/issues/20216#issuecomment-5756769160

   Further testing found a second independent bug in esp-hal-3rdparty.
   
   The first fix corrects macro precedence:
   
   #define ESP_IRQ_FIRSTPERIPH (RISCV_NIRQ_INTERRUPTS + ESP_NIRQ_DEMUX)
   
   However, with only that fix applied, the second ADC/GDMA open still crashes.
   
   The remaining issue is esp_os_intr_free(). esp_os_intr_alloc_intrstatus()
   returns the real intr_handle_t from esp_get_handle(), but esp_os_intr_free()
   casts that handle to esp_os_intr_handle_t * and reads intr_handle->irq from
   unrelated memory.
   
   Replacing esp_os_intr_free() with logic that searches the NuttX IRQ handle
   map for the matching intr_handle_t, obtains the corresponding IRQ/cpuint,
   and calls esp_teardown_irq() resolves the repeated-allocation failure.
   
   Verified on ESP32-C3 with 5 consecutive ADC/GDMA open/read/close cycles
   using only these two functional fixes and no debug instrumentation.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to