Page 1 of 1

RTC_NOINIT not starting variable

Posted: Wed Jul 11, 2018 7:25 pm
by urbanze
Why when I create variable with RTC_NOINIT, value is not equal than expected (222 in this example)?
This always are create with (random?) value after non-sw reset, but I expect 222.

Code: Select all

RTC_NOINIT_ATTR uint32_t lol = 222;



extern "C" void app_main()
{
	ESP_LOGI("Before", "%d", lol);

	lol++;

	ESP_LOGI("After", "%d", lol);

	vTaskDelay(pdMS_TO_TICKS(500));
	esp_restart();
}
Terminal output:

ps* What "0x400802f8: _NMIExceptionVector at ??:?" mean? This appear after updated to IDF v3.2-dev-144-g6ee3cf67?

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:780
load:0x40078000,len:4880
load:0x40080000,len:7484
0x40080000: _iram_start at /home/ze/esp/esp-idf/components/freertos/xtensa_vectors.S:1685

entry 0x400802f8
0x400802f8: _NMIExceptionVector at ??:?

I (72) cpu_start: Pro cpu up.
I (72) cpu_start: Starting app cpu, entry point is 0x40080e60
0x40080e60: call_start_cpu1 at /home/ze/esp/esp-idf/components/esp32/cpu_start.c:225

I (0) cpu_start: App cpu up.
I (75) heap_init: Initializing. RAM available for dynamic allocation:
I (82) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (87) heap_init: At 3FFB27B8 len 0002D848 (182 KiB): DRAM
I (94) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (100) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (106) heap_init: At 40087D6C len 00018294 (96 KiB): IRAM
I (113) cpu_start: Pro cpu start user code
I (129) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (130) BEF: 403233837
I (130) AFT: 403233838

Re: RTC_NOINIT not starting variable

Posted: Wed Jul 11, 2018 8:20 pm
by WiFive
How can it be init to 222 if it is no_init? You can check reset reason and decide whether to init in app_main

Re: RTC_NOINIT not starting variable

Posted: Wed Jul 11, 2018 9:10 pm
by urbanze
WiFive wrote:How can it be init to 222 if it is no_init? You can check reset reason and decide whether to init in app_main
....Yeah, this make a little sense, my mistake, sorry and thanks to remember to check reason. :lol: :lol:
Do you have all reasons can be erase no_init? I think is all except sw...

:o :shock: