jackon wrote:The system_rtc_memory_write/read can operate 0x60001100~0x60001FFF, total 768B(256B+512B).RTC memory can not be used.
0x60001100~0x600011FF(256B) is reversed for sdk internal use, it's 'system area'. You can operate this area, but sdk uses some addresses in this area also, it may cause fatal error.
0x60001200~0x600013FF is for users.
The first param of system_rtc_memory_write/read is des_addr, range 0~191, map to 0x60001100~0x600013FF, 768B.
If you want to save your data in RTC memory, you can use last 512B.
system_rtc_memory_write/read(0, ......) will operate 0x60001100
system_rtc_memory_write/read(64, ......) will operate 0x60001200
You don't need to know the absolute address of RTC memory.
You use a good tool, you can use it to test again.
SDK random writes at RTC!
Do not use "a good tool"
Test:
bool ICACHE_FLASH_ATTR test_rtc_mem(void) {
uint32 x[128];
uint32 i, t = 0x43545200;
bool chg = false;
#if DEBUGSOO > 1
os_printf("Test rtc memory retention... ");
#endif
if(!system_rtc_mem_read(64, x, sizeof(x))) {
#if DEBUGSOO > 1
os_printf("read error!\n");
#endif
return false;
}
for(i = 0; i < 128; i++) {
if(i == 46) { // bag Espressif! [46+64] = deeep_sleep options (?), [47+64] = espconn_tcp_get_max_con
i++;
t++;
}
else if(x[i] != t) {
x[i] = t;
chg = true;
};
t++;
};
if(chg) {
if(!system_rtc_mem_write(64, x, sizeof(x))) {
#if DEBUGSOO > 1
os_printf("write error!\n");
return false;
#endif
};
#if DEBUGSOO > 1
os_printf("changes, new write\n");
#endif
return false;
};
#if DEBUGSOO > 1
os_printf("Ok.\n");
#endif
return true;
}
60001000 00 00 ff 12 3c 13 39 1d 3b 1f 3c 20 00 00 00 00 ..я.<.9.;.< ....
60001010 00 00 00 00 10 07 c0 07 c0 07 00 07 40 07 40 07 ......А.А...@.@.
60001020 0f 0a 03 0f 07 03 0b 07 03 07 07 02 09 10 8a fe ..............Љю
60001030 0e 80 52 4e 4a 44 40 38 fb 01 05 0b 0f 17 00 05 .ЂRNJD@8ы.......
60001040 09 0f 13 1b 04 08 0c 14 17 1e 08 0c 11 17 1b 22 ..............."
60001050 00 00 00 1b 00 00 33 0d 89 fe f2 0f 00 00 00 00 ......3.‰ют.....
60001060 00 00 60 6e 59 1a 70 46 34 00 c4 c9 e4 21 5e 62 ..`nY.pF4.ДЙд!^b
60001070 f2 68 b2 f6 de db f5 56 b0 a8 b4 d0 ff 17 39 01 тhІцЮЫхV°ЁґРя.9.
60001080 82 4d 44 e4 11 95 70 d3 55 e8 36 01 78 35 3b b4 ‚MDд.•pУUи6.x5;ґ
60001090 aa e3 7f 13 99 7f e8 14 dc 39 7e da eb 58 59 51 Єг..™.и.Ь9~ЪлXYQ
600010a0 54 fb 0b 19 cd 89 25 dd 80 53 66 c3 31 d0 d7 69 Tы..Н‰%ЭЂSfГ1РЧi
600010b0 e9 0b cc ee f7 eb 7d 71 5f 2e 67 00 40 9d 3d ed й.Мочл}q_.g.@ќ=н
600010c0 b2 a3 56 73 49 ba e0 40 a9 01 a6 40 8b dd 66 34 ІЈVsIєа@©.¦@‹Эf4
600010d0 6a 52 e3 ba 49 d8 d1 45 b2 2a 24 73 e3 b7 91 3b jRгєIШСEІ*$sг·‘;
600010e0 02 f5 37 40 35 dc 22 78 e0 84 88 21 a0 36 ed 91 .х7@5Ь"xа„€! 6н‘
600010f0 e7 d2 4d 74 b6 af 5c 43 6c 8a 2e d4 ed 9d a2 ca зТMt¶Ї\ClЉ.ФнќўК
60001100 00 00 00 00 04 00 00 00 68 0f 00 40 00 00 00 00 ........h..@....
60001110 00 00 00 00 00 00 00 00 00 00 00 00 8f 27 30 30 ............Џ'00
60001120 a3 5c 0f 3a f0 2c 52 3f c1 40 f9 e5 c1 e4 df 63 Ј\.:р,R?Б@щеБдЯc
60001130 28 65 d2 d6 dc 56 52 00 bf f8 e0 bc 1b 55 9c 24 (eТЦЬVR.їшај.Uњ$
60001140 00 52 54 43 01 52 54 43 02 52 54 43 03 52 54 43 .RTC.RTC.RTC.RTC
60001150 04 52 54 43 05 52 54 43 06 52 54 43 07 52 54 43 .RTC.RTC.RTC.RTC
60001160 08 52 54 43 09 52 54 43 0a 52 54 43 0b 52 54 43 .RTC.RTC.RTC.RTC
60001170 0c 52 54 43 0d 52 54 43 0e 52 54 43 0f 52 54 43 .RTC.RTC.RTC.RTC
60001180 10 52 54 43 11 52 54 43 12 52 54 43 13 52 54 43 .RTC.RTC.RTC.RTC
60001190 14 52 54 43 15 52 54 43 16 52 54 43 17 52 54 43 .RTC.RTC.RTC.RTC
600011a0 18 52 54 43 19 52 54 43 1a 52 54 43 1b 52 54 43 .RTC.RTC.RTC.RTC
600011b0 1c 52 54 43 1d 52 54 43 1e 52 54 43 1f 52 54 43 .RTC.RTC.RTC.RTC
600011c0 20 52 54 43 21 52 54 43 22 52 54 43 23 52 54 43 RTC!RTC"RTC#RTC
600011d0 24 52 54 43 25 52 54 43 26 52 54 43 27 52 54 43 $RTC%RTC&RTC'RTC
600011e0 28 52 54 43 29 52 54 43 2a 52 54 43 2b 52 54 43 (RTC)RTC*RTC+RTC
600011f0 2c 52 54 43 2d 52 54 43 00 08 00 00 05 00 00 00 ,RTC-RTC........
60001200 30 52 54 43 31 52 54 43 32 52 54 43 33 52 54 43 0RTC1RTC2RTC3RTC
60001210 34 52 54 43 35 52 54 43 36 52 54 43 37 52 54 43 4RTC5RTC6RTC7RTC
60001220 38 52 54 43 39 52 54 43 3a 52 54 43 3b 52 54 43 8RTC9RTC:RTC;RTC
60001230 3c 52 54 43 3d 52 54 43 3e 52 54 43 3f 52 54 43 <RTC=RTC>RTC?RTC
60001240 40 52 54 43 41 52 54 43 42 52 54 43 43 52 54 43 @RTCARTCBRTCCRTC
60001250 44 52 54 43 45 52 54 43 46 52 54 43 47 52 54 43 DRTCERTCFRTCGRTC
60001260 48 52 54 43 49 52 54 43 4a 52 54 43 4b 52 54 43 HRTCIRTCJRTCKRTC
60001270 4c 52 54 43 4d 52 54 43 4e 52 54 43 4f 52 54 43 LRTCMRTCNRTCORTC
60001280 50 52 54 43 51 52 54 43 52 52 54 43 53 52 54 43 PRTCQRTCRRTCSRTC
60001290 54 52 54 43 55 52 54 43 56 52 54 43 57 52 54 43 TRTCURTCVRTCWRTC
600012a0 58 52 54 43 59 52 54 43 5a 52 54 43 5b 52 54 43 XRTCYRTCZRTC[RTC
600012b0 5c 52 54 43 5d 52 54 43 5e 52 54 43 5f 52 54 43 \RTC]RTC^RTC_RTC
600012c0 60 52 54 43 61 52 54 43 62 52 54 43 63 52 54 43 `RTCaRTCbRTCcRTC
600012d0 64 52 54 43 65 52 54 43 66 52 54 43 67 52 54 43 dRTCeRTCfRTCgRTC
600012e0 68 52 54 43 69 52 54 43 6a 52 54 43 6b 52 54 43 hRTCiRTCjRTCkRTC
600012f0 6c 52 54 43 6d 52 54 43 6e 52 54 43 6f 52 54 43 lRTCmRTCnRTCoRTC
60001300 70 52 54 43 71 52 54 43 72 52 54 43 73 52 54 43 pRTCqRTCrRTCsRTC
60001310 74 52 54 43 75 52 54 43 76 52 54 43 77 52 54 43 tRTCuRTCvRTCwRTC
60001320 78 52 54 43 79 52 54 43 7a 52 54 43 7b 52 54 43 xRTCyRTCzRTC{RTC
60001330 7c 52 54 43 7d 52 54 43 7e 52 54 43 7f 52 54 43 |RTC}RTC~RTC.RTC
60001340 22 a2 09 a6 07 99 14 9f 4e 53 0e 11 54 5f 94 14 "ў.¦.™.џNS..T_”.
60001350 c9 4b 8f 7a be 0a a6 0c d3 40 32 37 de d3 52 d6 ЙKЏzѕ.¦.У@27ЮУRЦ
60001360 04 3f 75 7d a2 2d 46 54 2f b1 66 b5 aa da c6 12 .?u}ў-FT/±fµЄЪЖ.
60001370 e7 3b 44 fa 9d 39 7d f2 0d 09 02 98 f2 d7 9a e3 з;Dъќ9}т...тЧљг
60001380 85 e8 24 24 28 2a 28 ec 75 a2 01 4f 55 47 82 9b …и$$(*(мuў.OUG‚›
60001390 5a c2 53 2d 5d d9 c8 2b f3 cc d1 68 44 d7 81 2f ZВS-]ЩИ+уМСhDЧЃ/
600013a0 ac 32 0f ac 5d b8 69 04 da 7e 81 3e 30 ef 8b f6 ¬2.¬]ёi.Ъ~Ѓ>0п‹ц
600013b0 4d fc 22 f2 12 af 79 e4 f0 aa 01 9b ce 57 ec 94 Mь"т.ЇyдрЄ.›ОWм”
600013c0 e3 4e 1d 1e 1b 07 fa 70 45 be 5d 0a 4a 0d 80 51 гN....ъpEѕ].J.ЂQ
600013d0 19 06 af e7 e6 f1 de 43 2a af 9f 4c 97 db 7e 5d ..ЇзжсЮC*ЇџL—Ы~]
600013e0 58 0b de 78 99 01 d6 2c b0 fe 08 80 a0 ee 11 b7 X.Юx™.Ц,°ю.Ђ о.·
600013f0 20 06 c2 30 e0 f1 39 1a 90 a5 d2 3d d5 a1 40 2e .В0ас9.ђҐТ=ХЎ@.