-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
ESP32S3 SPIFFS flash access during RMT transmission causes panic (IDFGH-11099) #12271
Comments
@higaski Could it be that the |
That would only be possible if the data would be static. |
I haven't tried this with std::array, but simple C Edit: no, indeed, that doesn't seem to be the case here. Although the array is stored in Flash (.rodata), it is copied onto the stack before passing it to rmt_transmit. At least that's the case if i build the reproducer project locally. Disassembly:
Please ignore the question about the map file. |
Yes exactly. I've actually been burned by this before by placing big constexpr std::array luts inside functions (e.g. CRC calculations without specific hardware), thinking that this would be a fast way to handle things. Turns out, yes, the look-up is fast... once the whole array has been copied onto the stack. 😄 |
Hi @higaski The issue is discovered by this Kconfig: diff --git a/components/esp_hw_support/intr_alloc.c b/components/esp_hw_support/intr_alloc.c
index 02d72ccd5d1..99906ad9a1f 100644
--- a/components/esp_hw_support/intr_alloc.c
+++ b/components/esp_hw_support/intr_alloc.c
@@ -560,7 +560,7 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre
//Allocate that int!
if (flags & ESP_INTR_FLAG_SHARED) {
//Populate vector entry and add to linked list.
- shared_vector_desc_t *sh_vec=malloc(sizeof(shared_vector_desc_t));
+ shared_vector_desc_t *sh_vec=heap_caps_malloc(sizeof(shared_vector_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
if (sh_vec == NULL) {
portEXIT_CRITICAL(&spinlock);
free(ret);
@@ -583,7 +583,7 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre
vd->flags = VECDESC_FL_NONSHARED;
if (handler) {
#if CONFIG_APPTRACE_SV_ENABLE
- non_shared_isr_arg_t *ns_isr_arg=malloc(sizeof(non_shared_isr_arg_t));
+ non_shared_isr_arg_t *ns_isr_arg=heap_caps_malloc(sizeof(non_shared_isr_arg_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
if (!ns_isr_arg) {
portEXIT_CRITICAL(&spinlock);
free(ret);
|
That was a fast catch, thanks! |
Btw, I spot a missing |
Answers checklist.
IDF version.
v5.2-dev-2934-g3b748a6cb7
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32-S3-DevKitC-1
Power Supply used.
USB
What is the expected behavior?
I've an application in which I need to access a SPIFFS partition upon a HTTP request to serve some data while RMT transmissions are running on a high priority task. For some reason I can't get that combination to work properly. Every time I access the SPIFFS partition while the RMT transmission is ongoing I'm getting core0 panics
I can't tell why though. I've enabled the CONFIG_RMT_ISR_IRAM_SAFE option and attached the IRAM attribute to my RMT callback. Thankfully I can reproduce the issue in about 200 lines of code. The example connects to WiFi using the "common protocols example" code. HTTP requests to the devices IP address will read an index.html and text.png file from SPIFFS and show them in a browser. A high priority task does some RMT transmissions in the meantime.
Here is a zip containing everything (sdkconfig might be important?):
esp_idf_issue_12271-master.zip
What is the actual behavior?
ESP32 crashes with a core0 cache panic
Steps to reproduce.
Debug Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: