[Ovmsdev] RTC slow memory and persistent metrics limits

Craig Leres leres at xse.com
Sun Sep 6 00:34:39 HKT 2020

With the recent bump in persistent metrics size I did some testing to 
see what the actual limit is. First I found that if you make the 
persistent_metrics struct too large you get linker errors (which is nice):

     ... section `.rtc_noinit' will not fit in region `rtc_slow_seg'
     ... ld: RTC_SLOW segment data does not fit
     ... region `rtc_slow_seg' overflowed by 8272 bytes

The documentation says there is 8K but I see less than 4K is actually 
available to us. This limit is set in esp-idf in 

   rtc_slow_seg(RW)  :                org = 0x50000000 + 
                                      len = 0x1000 - 

(0x1000 = 4096). Testing shows 348 bytes are in use by other code. I can 
account for only 8 bytes of this in esp-idf exposed code so I assume the 
other 340 bytes are used in an esp32 library we don't get source for.

Regarding the 8K vs. 4K discrepancy, I found this thread about rtc_slow_mem:


     If I understand right, the RTC_SLOW_SEG is 8K not 4K.
     Am I missing something?


     I think the higher 4k are reserved for future use by the WiFi
     driver. In the current versions (latest git), you can modify
     the size to 8k if you need.

I do not see this (a way to adjust the size) in the github version of 
esp32.ld, it looks the same as what we're using.

The bottom line is we're currently limited to 155 persistent floats 
(20+24*155 = 3740 < 3748) without making the persistent metrics code 
fancier (or trying to use more of the 8K of rtc slow memory).


More information about the OvmsDev mailing list