Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2.1 anti rollback can't be enabled (build breaks) if silent reboot panic handler enabled (IDFGH-12389) #13417

Closed
3 tasks done
greenaddress opened this issue Mar 19, 2024 · 2 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@greenaddress
Copy link

greenaddress commented Mar 19, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.2.1

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?

Expected behavior is for the build to be successful with any panic handling (print registers and reboot or just silent reboot for example) and anti roll back enabled.

What is the actual behavior?

The actual behavior is that the builds fails with anti roll back enabled and silent reboot panic handling at the same time.

If anti roll back is disabled or if the panic handling is changed to print register and reboot then the build is successful.

Steps to reproduce.

  1. copy recursively somewhere ~/esp/esp-idf/examples/get-started/hello_world/ as a base
  2. create in the hello_world directory you just copied sdkconfig.defaults with the following contents:
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y                                                                                                                                                                                 
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y                                         
CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y                                           
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y                                                
CONFIG_PARTITION_TABLE_CUSTOM=y                                                 
CONFIG_PARTITION_TABLE_OFFSET=0x9000                                            
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y    
  1. Create a partitions.csv file in the same directory with the following content:
# Espressif ESP32 Partition Table                                                                                                                                                                                  
# Name,   Type, SubType, Offset,  Size, Flags                                   
nvs,      data, nvs,     0xA000,  0x4000,                                       
otadata,  data, ota,     0xE000,  0x2000, encrypted                             
ota_0,    app,  ota_0,   ,         1984K,                                       
ota_1,    app,  ota_1,   ,         1984K,                                       
nvs_key,  data, nvs_keys,,            4K, encrypted  
  1. Run idf.py build, you will get an error like the following:
In file included from /home/user1/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include/sys/reent.h:458,
                 from /home/user1/esp/esp-idf/components/newlib/platform_include/sys/reent.h:22,
                 from /home/user1/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include/string.h:11,
                 from /home/user1/esp/esp-idf/components/esp_system/startup.c:8:
/home/user1/esp/esp-idf/components/esp_system/startup.c: In function 'do_core_init':
/home/user1/esp/esp-idf/components/esp_system/startup.c:353:43: error: implicit declaration of function 'esp_app_get_description' [-Werror=implicit-function-declaration]
  353 |     assert(esp_efuse_check_secure_version(esp_app_get_description()->secure_version) == true && "Incorrect secure version of app");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~       
/home/user1/esp/esp-idf/components/esp_system/startup.c:353:68: error: invalid type argument of '->' (have 'int')                                                                                                  
  353 |     assert(esp_efuse_check_secure_version(esp_app_get_description()->secure_version) == true && "Incorrect secure version of app");

Build or installation Logs.

In file included from /home/user1/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include/sys/reent.h:458,
                 from /home/user1/esp/esp-idf/components/newlib/platform_include/sys/reent.h:22,
                 from /home/user1/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/sys-include/string.h:11,
                 from /home/user1/esp/esp-idf/components/esp_system/startup.c:8:
/home/user1/esp/esp-idf/components/esp_system/startup.c: In function 'do_core_init':
/home/user1/esp/esp-idf/components/esp_system/startup.c:353:43: error: implicit declaration of function 'esp_app_get_description' [-Werror=implicit-function-declaration]
  353 |     assert(esp_efuse_check_secure_version(esp_app_get_description()->secure_version) == true && "Incorrect secure version of app");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~       
/home/user1/esp/esp-idf/components/esp_system/startup.c:353:68: error: invalid type argument of '->' (have 'int')                                                                                                  
  353 |     assert(esp_efuse_check_secure_version(esp_app_get_description()->secure_version) == true && "Incorrect secure version of app");

More Information.

if you change the sdkconfig.defaults (remember to delete sdkconfig) to

CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y                                                                                                                                                                                 
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y                                         
CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y                                           
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y                                                
CONFIG_PARTITION_TABLE_CUSTOM=y                                                 
CONFIG_PARTITION_TABLE_OFFSET=0x9000

then it works again.

Equally if app roll back is disabled then the build succeeds.

@greenaddress greenaddress added the Type: Bug bugs in IDF label Mar 19, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 19, 2024
@github-actions github-actions bot changed the title 5.2.1 anti rollback can't be enabled (build breaks) if silent reboot panic handler enabled 5.2.1 anti rollback can't be enabled (build breaks) if silent reboot panic handler enabled (IDFGH-12389) Mar 19, 2024
@KonstantinKondrashov
Copy link
Collaborator

Hi @greenaddress!
Thanks for the report. I confirm that it happens on the 5.2 only, the master and <= 5.1 do not have such an issue.
If you need a fix now - 29770.patch. It should be merged soon.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Mar 20, 2024
espressif-bot pushed a commit that referenced this issue Mar 21, 2024
…OT=y

Fix a case when two options are set as
CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK=y
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y

Closes #13417
@mahavirj
Copy link
Member

Fixed with 00f2e33

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Reviewing Issue is being reviewed labels Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants