I have an unexpected problem using the esp32 with idf and c++:
When I activate "optimize for size", I get a message:
(see below). Activating "Debug without optimization", the panic does not occur but the program works fine.Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
What can I do to optimize for size without a core panic?
Thank you very much and any help appreciated !
-- Details:
Log with "optimize for size":
Log with "Debug without optimization" (code working):I (281) cpu_start: Single core mode
I (289) cpu_start: Pro cpu start user code
I (289) cpu_start: cpu freq: 160000000 Hz
I (289) cpu_start: Application information:
I (294) cpu_start: Project name: device
I (299) cpu_start: App version: 1
I (303) cpu_start: Compile time: Oct 31 2023 17:59:51
I (309) cpu_start: ELF file SHA256: f2d5e1871...
I (314) cpu_start: ESP-IDF: v5.2-dev-3318-g8fc8f3f479-dirty
I (322) cpu_start: Min chip rev: v0.0
I (326) cpu_start: Max chip rev: v3.99
I (331) cpu_start: Chip rev: v1.0
I (336) heap_init: Initializing. RAM available for dynamic allocation:
I (343) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (349) heap_init: At 3FFB7378 len 00028C88 (163 KiB): DRAM
I (355) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (362) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (368) heap_init: At 40093E64 len 0000C19C (48 KiB): IRAM
I (374) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (382) spi_flash: detected chip: gd
I (385) spi_flash: flash io: dio
W (389) ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`
I (397) main_task: Started on CPU0
I (397) main_task: Calling app_main()
Initializing raise_event_mutex!
XXXXXXXX [-------] ***
| Starting system ...
00000000 [-------] Initializing flash
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Core 0 register dump:
PC : 0x400d6b90 PS : 0x00060034 A0 : 0x8008988e A1 : 0x3ffb19a0
A2 : 0x3ffb3bc4 A3 : 0x00000001 A4 : 0x0300124c A5 : 0x00000000
A6 : 0xffffffff A7 : 0x3ffb9420 A8 : 0x80083e1c A9 : 0x3ffb1980
A10 : 0x3ffb3c00 A11 : 0x00000000 A12 : 0x0300124c A13 : 0x00000020
A14 : 0x00001004 A15 : 0x000000ff SAR : 0x00000018 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x400d2a6b EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x400d6b90
Backtrace: 0x400d6b8d:0x3ffb19a0 0x4008988b:0x3ffb19c0 0x40089639:0x3ffb19e0 0x400829ea:0x3ffb19f0 0x4008bbca:0x3ffb9210 0x4008ba20:0x3ffb9230 0x40093929:0x3ffb9250 0x40083a0d:0x3ffb92d0 0x401080c7:0x3ffb9310 0x400dfc42:0x3ffb9330 0x4013c821:0x3ffb9350 0x400e0725:0x3ffb9370 0x400dedd1:0x3ffb93d0 0x400df9bb:0x3ffb94e0 0x400dfd9b:0x3ffb9540 0x400dfe3d:0x3ffb9570 0x400de988:0x3ffb95a0 0x400de99e:0x3ffb95d0 0x400d6d84:0x3ffb95f0 0x400d6184:0x3ffb9610 0x40141adf:0x3ffb9690
ELF file SHA256: f2d5e1871
Rebooting...
...snip...
I (457) spi_flash: detected chip: gd
I (459) spi_flash: flash io: dio
W (463) ADC: legacy driver is deprecated, please migrate to `esp_adc/adc_oneshot.h`
I (472) main_task: Started on CPU0
I (472) main_task: Calling app_main()
Initializing raise_event_mutex!
XXXXXXXX [-------] ***
| Starting system ...
00000000 [-------] Initializing flash
00000001 [Info ] This is esp32 chip with 1 CPU core(s), WiFi/BT/BLE,
| silicon revision 100
| Minimum free heap size: 288116 bytes
00000002 [-------] Initially disabling gpios ...
I (512) gpio: GPIO[2]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
...snip...