Esp32 ext_ram_noinit_attr

I’m trying to keep data between crashes in the external ram of my esp32 (wrover-B).
Since this option looks kind-of-new (esp-idf 4.4), I don’t know if I’m just using it wrongly or if it is a glitch.

For the platform I’m using
platform =
since the option is not in esp-idf 4.3

So far I’ve checked that the variables are indeed in the right region and that they are not initialized at startup. It looks like even if not initialized, the value after the crash is still always the same but not the one I did set before the crash. (Using assert(0) to trigger the crash).

volatile EXT_RAM_NOINIT_ATTR uint32_t test;
volatile __NOINIT_ATTR uint32_t test2;
volatile RTC_NOINIT_ATTR uint32_t test3;
volatile EXT_RAM_ATTR uint32_t test4;

0x3f800000 : 0x861F5F51, 0x3ffb23d0 : 0xFFAA, 0x50000010 : 0x00AA, 0x3f800004 : 0x0000
… crash…
0x3f800000 : 0x861F5F51, 0x3ffb23d0 : 0xFFAA, 0x50000010 : 0x00AA, 0x3f800004 : 0x0000

printed as follow
printf(“%p : 0x%08X, %p : 0x%04X, %p : 0x%04X, %p : 0x%04X\n”, &test, test, &test2, test2, &test3, test3, &test4, test4);

the value 0xFFAA and 0x00AA are set in the code, so I can see that __NOINIT_ATTR and RTC_NOINIT_ATTR are indeed working as expected. EXT_RAM_ATTR is also legit since the value is set to 0x00.
The problem is really EXT_RAM_NOINIT_ATTR which keep this (wrong) value between crash.

If you have any idea of what I’m doing wrong I’ll gladly take it!

Best to test it in pure Arduino IDE with their latest RC. If that does not work, you can directly open an issue there.

Or, for PlatformIO to update its ESP-IDF version, open an issue at Issues · platformio/platform-espressif32 · GitHub

In fact it is working. I just forgot to take in account the cache… calling
before the reset solved the problem!