espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.97k stars 7.11k forks source link

Support for BOOTLOADER_CUSTOM_RESERVE_RTC missing for ESP32C2 (IDFGH-9324) #10704

Open HomeACcessoryKid opened 1 year ago

HomeACcessoryKid commented 1 year ago

Answers checklist.

IDF version.

v5.0

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

What is the expected behavior?

support for CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC in ESP32-C2

What is the actual behavior?

It is missing as an option from idf.py menuconfig

when compiling code that works fine on other platforms, this is the essential hint that it is missing:

/project/LCM4ESP32/main/ota.c:117:9: error: implicit declaration of function 'bootloader_common_get_rtc_retain_mem_reboot_counter'

Steps to reproduce.

  1. use the code of HomeACcessoryKid/LCM4ESP32 and set device to esp32-c2
  2. compile the app code: idf.py app
  3. observe compile error
  4. go into menuconfig/bootloader options and missing RTC memory options

Build or installation Logs.

root@25e7affaca0f:/project/LCM4ESP32# idf.py app
Executing action: app
Running ninja in directory /project/LCM4ESP32/build
Executing "ninja app"...
[2/8] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/ota.c.objFAILED: esp-idf/main/CMakeFiles/__idf_main.dir/ota.c.obj 
ccache /opt/esp/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DUNITY_INCLUDE_CONFIG_H -I/project/LCM4ESP32/build/config -I/project/LCM4ESP32/main -I/opt/esp/idf/components/newlib/platform_include -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/include -I/opt/esp/idf/components/freertos/esp_additions/include/freertos -I/opt/esp/idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include -I/opt/esp/idf/components/freertos/esp_additions/include -I/opt/esp/idf/components/esp_hw_support/include -I/opt/esp/idf/components/esp_hw_support/include/soc -I/opt/esp/idf/components/esp_hw_support/include/soc/esp32c2 -I/opt/esp/idf/components/esp_hw_support/port/esp32c2/. -I/opt/esp/idf/components/esp_hw_support/port/esp32c2/private_include -I/opt/esp/idf/components/heap/include -I/opt/esp/idf/components/log/include -I/opt/esp/idf/components/soc/include -I/opt/esp/idf/components/soc/esp32c2/. -I/opt/esp/idf/components/soc/esp32c2/include -I/opt/esp/idf/components/hal/esp32c2/include -I/opt/esp/idf/components/hal/include -I/opt/esp/idf/components/hal/platform_port/include -I/opt/esp/idf/components/esp_rom/include -I/opt/esp/idf/components/esp_rom/include/esp32c2 -I/opt/esp/idf/components/esp_rom/esp32c2 -I/opt/esp/idf/components/esp_common/include -I/opt/esp/idf/components/esp_system/include -I/opt/esp/idf/components/esp_system/port/soc -I/opt/esp/idf/components/esp_system/port/include/riscv -I/opt/esp/idf/components/esp_system/port/include/private -I/opt/esp/idf/components/riscv/include -I/opt/esp/idf/components/lwip/include -I/opt/esp/idf/components/lwip/include/apps -I/opt/esp/idf/components/lwip/include/apps/sntp -I/opt/esp/idf/components/lwip/lwip/src/include -I/opt/esp/idf/components/lwip/port/esp32/include -I/opt/esp/idf/components/lwip/port/esp32/include/arch -I/opt/esp/idf/components/esp_ringbuf/include -I/opt/esp/idf/components/efuse/include -I/opt/esp/idf/components/efuse/esp32c2/include -I/opt/esp/idf/components/driver/include -I/opt/esp/idf/components/driver/deprecated -I/opt/esp/idf/components/esp_pm/include -I/opt/esp/idf/components/mbedtls/port/include -I/opt/esp/idf/components/mbedtls/mbedtls/include -I/opt/esp/idf/components/mbedtls/mbedtls/library -I/opt/esp/idf/components/mbedtls/esp_crt_bundle/include -I/opt/esp/idf/components/esp_app_format/include -I/opt/esp/idf/components/bootloader_support/include -I/opt/esp/idf/components/bootloader_support/bootloader_flash/include -I/opt/esp/idf/components/esp_partition/include -I/opt/esp/idf/components/app_update/include -I/opt/esp/idf/components/spi_flash/include -I/opt/esp/idf/components/pthread/include -I/opt/esp/idf/components/esp_timer/include -I/opt/esp/idf/components/app_trace/include -I/opt/esp/idf/components/esp_event/include -I/opt/esp/idf/components/nvs_flash/include -I/opt/esp/idf/components/esp_phy/include -I/opt/esp/idf/components/esp_phy/esp32c2/include -I/opt/esp/idf/components/vfs/include -I/opt/esp/idf/components/esp_netif/include -I/opt/esp/idf/components/wpa_supplicant/include -I/opt/esp/idf/components/wpa_supplicant/port/include -I/opt/esp/idf/components/wpa_supplicant/esp_supplicant/include -I/opt/esp/idf/components/esp_wifi/include -I/opt/esp/idf/components/unity/include -I/opt/esp/idf/components/unity/unity/src -I/opt/esp/idf/components/cmock/CMock/src -I/opt/esp/idf/components/console -I/opt/esp/idf/components/http_parser -I/opt/esp/idf/components/esp-tls -I/opt/esp/idf/components/esp-tls/esp-tls-crypto -I/opt/esp/idf/components/esp_adc/include -I/opt/esp/idf/components/esp_adc/interface -I/opt/esp/idf/components/esp_adc/esp32c2/include -I/opt/esp/idf/components/esp_adc/deprecated/include -I/opt/esp/idf/components/esp_eth/include -I/opt/esp/idf/components/esp_hid/include -I/opt/esp/idf/components/tcp_transport/include -I/opt/esp/idf/components/esp_http_client/include -I/opt/esp/idf/components/esp_http_server/include -I/opt/esp/idf/components/esp_https_ota/include -I/opt/esp/idf/components/esp_https_server/include -I/opt/esp/idf/components/esp_lcd/include -I/opt/esp/idf/components/esp_lcd/interface -I/opt/esp/idf/components/protobuf-c/protobuf-c -I/opt/esp/idf/components/protocomm/include/common -I/opt/esp/idf/components/protocomm/include/security -I/opt/esp/idf/components/protocomm/include/transports -I/opt/esp/idf/components/esp_local_ctrl/include -I/opt/esp/idf/components/esp_psram/include -I/opt/esp/idf/components/espcoredump/include -I/opt/esp/idf/components/espcoredump/include/port/riscv -I/opt/esp/idf/components/wear_levelling/include -I/opt/esp/idf/components/sdmmc/include -I/opt/esp/idf/components/fatfs/diskio -I/opt/esp/idf/components/fatfs/vfs -I/opt/esp/idf/components/fatfs/src -I/opt/esp/idf/components/idf_test/include -I/opt/esp/idf/components/idf_test/include/esp32c2 -I/opt/esp/idf/components/ieee802154/include -I/opt/esp/idf/components/json/cJSON -I/opt/esp/idf/components/mqtt/esp-mqtt/include -I/opt/esp/idf/components/spiffs/include -I/opt/esp/idf/components/wifi_provisioning/include -march=rv32imc  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -nostartfiles -Og -fmacro-prefix-map=/project/LCM4ESP32=. -fmacro-prefix-map=/opt/esp/idf=/IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v5.0\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/ota.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/ota.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/ota.c.obj -c /project/LCM4ESP32/main/ota.c
/project/LCM4ESP32/main/ota.c: In function 'ota_rtc_read_task':
/project/LCM4ESP32/main/ota.c:117:9: error: implicit declaration of function 'bootloader_common_get_rtc_retain_mem_reboot_counter' [-Werror=implicit-function-declaration]
  117 |     if (bootloader_common_get_rtc_retain_mem_reboot_counter()) { //if zero, RTC CRC not valid
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/LCM4ESP32/main/ota.c:118:34: error: implicit declaration of function 'bootloader_common_get_rtc_retain_mem'; did you mean 'bootloader_common_get_chip_ver_pkg'? [-Werror=implicit-function-declaration]
  118 |         rtc_retain_mem_t* rtcmem=bootloader_common_get_rtc_retain_mem(); //access to the memory struct
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  bootloader_common_get_chip_ver_pkg
/project/LCM4ESP32/main/ota.c:118:34: warning: initialization of 'rtc_retain_mem_t *' from 'int' makes pointer from integer without a cast [-Wint-conversio]
/project/LCM4ESP32/main/ota.c:119:21: error: 'rtc_retain_mem_t' has no member named 'custom'
  119 |         count=rtcmem->custom[0]; //byte zero for count
      |                     ^~
/project/LCM4ESP32/main/ota.c:123:5: error: implicit declaration of function 'bootloader_common_reset_rtc_retain_mem' [-Werror=implicit-function-declaratio]
  123 |     bootloader_common_reset_rtc_retain_mem(); //this will clear RTC
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/LCM4ESP32/main/ota.c: In function 'ota_rtc_write_task':
/project/LCM4ESP32/main/ota.c:1080:30: warning: initialization of 'rtc_retain_mem_t *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
 1080 |     rtc_retain_mem_t* rtcmem=bootloader_common_get_rtc_retain_mem(); //access to the memory struct
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/project/LCM4ESP32/main/ota.c:1083:11: error: 'rtc_retain_mem_t' has no member named 'custom'
 1083 |     rtcmem->custom[1]=1; //byte one for temp_boot signal (from app to bootloader)
      |           ^~
/project/LCM4ESP32/main/ota.c:1084:5: error: implicit declaration of function 'bootloader_common_update_rtc_retain_mem' [-Werror=implicit-function-declaration]
 1084 |     bootloader_common_update_rtc_retain_mem(NULL,false); //this will update the CRC only
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
HINT: Please check that the function name is correct. Also it is possible that you've forgot to import bootloader_common_get_rtc_retain_mem_reboot_counter library(s) in header file or add the necessary REQURIES component. Try to add missing libraries to your project header file or check idf_component_register(REQUIRES ...) section in your component CmakeList.txt file. For more information run 'idf.py docs -sp api-guides/build-system.html'.
Also, please check if the function has been removed, renamed or replaced by an alternative function - refer to the migration guide for more information.
ninja failed with exit code 1, output of the command is in the /project/LCM4ESP32/build/log/idf_py_stderr_output_32484 and /project/LCM4ESP32/build/log/idf_py_stdout_output_32484
root@25e7affaca0f:/project/LCM4ESP32# idf.py fullclean >/dev/null 2>&1; rm -rf /mnt/main
root@25e7affaca0f:/project/LCM4ESP32# idf.py menuconfig
Executing action: menuconfig
Running cmake in directory /project/LCM4ESP32/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32c2 -DCCACHE_ENABLE=1 /project/LCM4ESP32"...
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/esp/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/esp/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/esp/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c2
-- Project sdkconfig file /project/LCM4ESP32/sdkconfig
Loading defaults file /project/LCM4ESP32/sdkconfig.defaults...
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Found Python3: /opt/esp/python_env/idf5.0_py3.8_env/bin/python (found version "3.8.10") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "LCM4ESP32" version: 0.9.9
-- Adding linker script /project/LCM4ESP32/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /opt/esp/idf/components/esp_system/ld/esp32c2/sections.ld.in
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.api.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.rvfp.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.version.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.mbedtls.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-time.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-nano.ld
-- Adding linker script /opt/esp/idf/components/esp_rom/esp32c2/ld/esp32c2.rom.heap.ld
-- Adding linker script /opt/esp/idf/components/soc/esp32c2/ld/esp32c2.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_common esp_eth esp_event esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip main mbedtls mqtt newlib nvs_flash openthread partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
-- Component paths: /opt/esp/idf/components/app_trace /opt/esp/idf/components/app_update /opt/esp/idf/components/bootloader /opt/esp/idf/components/bootloader_support /opt/esp/idf/components/bt /opt/esp/idf/components/cmock /opt/esp/idf/components/console /opt/esp/idf/components/cxx /opt/esp/idf/components/driver /opt/esp/idf/components/efuse /opt/esp/idf/components/esp-tls /opt/esp/idf/components/esp_adc /opt/esp/idf/components/esp_app_format /opt/esp/idf/components/esp_common /opt/esp/idf/components/esp_eth /opt/esp/idf/components/esp_event /opt/esp/idf/components/esp_hid /opt/esp/idf/components/esp_http_client /opt/esp/idf/components/esp_http_server /opt/esp/idf/components/esp_https_ota /opt/esp/idf/components/esp_https_server /opt/esp/idf/components/esp_hw_support /opt/esp/idf/components/esp_lcd /opt/esp/idf/components/esp_local_ctrl /opt/esp/idf/components/esp_netif /opt/esp/idf/components/esp_partition /opt/esp/idf/components/esp_phy /opt/esp/idf/components/esp_pm /opt/esp/idf/components/esp_psram /opt/esp/idf/components/esp_ringbuf /opt/esp/idf/components/esp_rom /opt/esp/idf/components/esp_system /opt/esp/idf/components/esp_timer /opt/esp/idf/components/esp_wifi /opt/esp/idf/components/espcoredump /opt/esp/idf/components/esptool_py /opt/esp/idf/components/fatfs /opt/esp/idf/components/freertos /opt/esp/idf/components/hal /opt/esp/idf/components/heap /opt/esp/idf/components/http_parser /opt/esp/idf/components/idf_test /opt/esp/idf/components/ieee802154 /opt/esp/idf/components/json /opt/esp/idf/components/log /opt/esp/idf/components/lwip /project/LCM4ESP32/main /opt/esp/idf/components/mbedtls /opt/esp/idf/components/mqtt /opt/esp/idf/components/newlib /opt/esp/idf/components/nvs_flash /opt/esp/idf/components/openthread /opt/esp/idf/components/partition_table /opt/esp/idf/components/protobuf-c /opt/esp/idf/components/protocomm /opt/esp/idf/components/pthread /opt/esp/idf/components/riscv /opt/esp/idf/components/sdmmc /opt/esp/idf/components/soc /opt/esp/idf/components/spi_flash /opt/esp/idf/components/spiffs /opt/esp/idf/components/tcp_transport /opt/esp/idf/components/ulp /opt/esp/idf/components/unity /opt/esp/idf/components/usb /opt/esp/idf/components/vfs /opt/esp/idf/components/wear_levelling /opt/esp/idf/components/wifi_provisioning /opt/esp/idf/components/wpa_supplicant
-- Configuring done
-- Generating done
-- Build files have been written to: /project/LCM4ESP32/build
Running ninja in directory /project/LCM4ESP32/build
Executing "ninja menuconfig"...
[0/1] cd /project/LCM4ESP32/build && /opt/esp/python_env/idf5.0_py3.8_env/bi...GET=esp32c2 --env IDF_ENV_FPGA= --output config /project/LCM4ESP32/sdkconfig
Loading defaults file /project/LCM4ESP32/sdkconfig.defaults...
WARNING: Menuconfig may fail because of the TERM environment variable is set to "xterm". Please consult the documentation of your terminal to set it up. Some good, proved to been working setups include xterm-256color, screen-256color, rxvt-unicode-256color, alacritty.
Loaded configuration '/project/LCM4ESP32/sdkconfig'
Configuration (/project/LCM4ESP32/sdkconfig) was not saved
Loading defaults file /project/LCM4ESP32/sdkconfig.defaults...

More Information.

Using Docker container v5.0 but inspected source of master branch

When looking for CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC it is clear that ESP32-C2 is forgotten somehow.

./components/esp_system/ld/esp32c3/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32c3/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32c6/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32c6/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32h4/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32h4/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32h2/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32h2/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32s3/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32s3/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
./components/esp_system/ld/esp32s2/memory.ld.in:#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
./components/esp_system/ld/esp32s2/memory.ld.in:#define ESP_BOOTLOADER_RESERVE_RTC (CONFIG_BOOTLOADER_RESERVE_RTC_SIZE + CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC_SIZE)
ESP-Marius commented 1 year ago

Hi,

This is actually as intended. C2 doesnt have any RTC memory, so this kconfig option is disabled. (You can actually see its dependency in kconfig depends on SOC_RTC_FAST_MEM_SUPPORTED)

HomeACcessoryKid commented 1 year ago

If C2 doesn't have any RTC, then the documentation of this feature must be made a lot clearer. Based on that documentation I decided to raise this bug. https://docs.espressif.com/projects/esp-idf/en/latest/esp32c2/api-reference/kconfig.html#config-bootloader-custom-reserve-rtc Considering that you have dynamic documentation per platform, then you have to make the conclusion clear:
There is no RTC on a C2. Just write it down.

Having said that, is there an alternative (short of abusing flash memory) to transfer information across a powered reset?

As always, thanks for the wonderful development platform that the ESP is!

ESP-Marius commented 1 year ago

Point taken about the docs, I'll make a ticket for it and see if it is somehow possible for us filter out these options that will always be false.

Regarding other options, there are the RTC_CNTL_STOREX_REG registers, but I'm afraid these are used for internal IDF stuff, so I cant recommend you to use these.

So NVS is the only "good" suggestion I can think of.

HomeACcessoryKid commented 1 year ago

Clear answer, thank you.

Having said that, and considering that the CUSTOM_RTC feature was able to address 16 bytes only anyhow, is it not possible to carve out 16 bytes out of this RTC_CNTL_STOREX_REG space? Or even 4? Not that I know what that implies, but 16 seems a very small number, right? Because you rightfully wrote "good" when referring to flash. Let alone that NVS is hard (if at all) to use sending info from or to the bootloader.

ESP-Marius commented 1 year ago

You can see what these registers are used for here. It doesn't look like any of them are likely to available for users, but maybe there are some circumstances where we could free up one or two of them. I'm not that familiar with the details of the RTC related code, but i'll poke the guys responsible for this and ask them.

CUSTOM_RTC feature was able to address 16 bytes only anyhow

We actually recently fixed this (as you implied, this size limit was pretty arbitrary... ), so you are now free to use as much RTC memory as you want for this.

ESP-Marius commented 1 year ago

Asked around and unfortunately it doesnt seem like we'll be able to release any of these registers for end-user use-cases.

HomeACcessoryKid commented 2 months ago

Hi Marius, Picking this up again with a new idea. Upon reading the code for the registers, I think that there is a lot of free namespace for the RESET_REASON definitions. So, with a 15 bit space (with the half-word and top bit stuff), the definitions could go as high as 32767, right? So plenty of space.

It would be nice if there would be an extension of the esp_restart(void) function where a parameter is given to indicate a reboot from another ota partition than the current selected one. We know that RTC_SW_CPU_RESET is encoded as 12.

Simple encoding could be done with a value of 28 (12+16) to indicate RTC_SW_CPU_RESET_OTA1 instead of RTC_SW_CPU_RESET. Or, to cover all ota definitions and also factory reset you could assign 28 to factory and 32-47 to OTA0-OTA15

Other ideas can valid as well, but with plenty of space, these could be valuable functions.

Thanks for your attention...