Access esp_app_desc_t

svcguy
Posts: 4
Joined: Wed Oct 31, 2018 4:25 am

Access esp_app_desc_t

Postby svcguy » Fri Aug 13, 2021 4:04 pm

Hello,

I'm using esp-idf 4.3 within VSCode with extension v1.1.1. I would like to get access during runtime to the esp_app_desc_t struct for the project, so I can display my firmware version, etc in a command console. I see that esp_app_desc_t is defined in esp_app_format.h but #include-ing that into my project fails with a "No such file or directory". If I understand correctly, this should be part of the bootloader or bootloader_support component, correct? According to my build output, both are being included.

Here's my build output:

Code: Select all

> Executing task: cmake --build . <

[5/999] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,
*******************************************************************************
[478/999] Performing configure step for 'bootloader'
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.27.0.windows.1")
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/svcgu/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/svcgu/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/svcgu/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/svcgu/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
-- Check for working CXX compiler: C:/Users/svcgu/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/Users/svcgu/OneDrive/Documents/ESP32/pumpTest/sdkconfig
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script C:/Users/svcgu/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: C:/Users/svcgu/esp/esp-idf/components/bootloader C:/Users/svcgu/esp/esp-idf/components/bootloader_support C:/Users/svcgu/esp/esp-idf/components/efuse C:/Users/svcgu/esp/esp-idf/components/esp32 C:/Users/svcgu/esp/esp-idf/components/esp_common C:/Users/svcgu/esp/esp-idf/components/esp_hw_support C:/Users/svcgu/esp/esp-idf/components/esp_rom C:/Users/svcgu/esp/esp-idf/components/esp_system C:/Users/svcgu/esp/esp-idf/components/esptool_py C:/Users/svcgu/esp/esp-idf/components/hal C:/Users/svcgu/esp/esp-idf/components/log C:/Users/svcgu/esp/esp-idf/components/bootloader/subproject/main C:/Users/svcgu/esp/esp-idf/components/bootloader/subproject/components/micro-ecc C:/Users/svcgu/esp/esp-idf/components/newlib C:/Users/svcgu/esp/esp-idf/components/partition_table C:/Users/svcgu/esp/esp-idf/components/soc C:/Users/svcgu/esp/esp-idf/components/spi_flash C:/Users/svcgu/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/svcgu/OneDrive/Documents/ESP32/pumpTest/build/bootloader
[584/999] Performing build step for 'bootloader'
[1/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[2/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[3/86] Generating project_elf_src_esp32.c
[4/86] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[5/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[6/86] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[7/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[8/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[9/86] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[10/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[11/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[12/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/memory_layout_utils.c.obj
[13/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[14/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[15/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[16/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[17/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[18/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[19/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[20/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sigmadelta_periph.c.obj
[21/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[22/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[23/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/soc_memory_layout.c.obj
[24/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[25/86] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[26/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[27/86] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/esp32/spi_flash_rom_patch.c.obj
[28/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[29/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash.c.obj
[30/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[31/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[32/86] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[33/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[34/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[35/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash_config_esp32.c.obj
[36/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_qio_mode.c.obj
[37/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[38/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse_esp32.c.obj
[39/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[40/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[41/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[42/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[43/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[44/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[45/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[46/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[47/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[48/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[49/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/flash_encrypt.c.obj
[50/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[51/86] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[52/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_api.c.obj
[53/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_utility.c.obj
[54/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32/esp_efuse_fields.c.obj
[55/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[56/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[57/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_pm.c.obj
[58/86] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[59/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[60/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[61/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[62/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_wdt.c.obj
[63/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[64/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[65/86] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[66/86] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[67/86] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[68/86] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[69/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[70/86] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[71/86] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[72/86] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[73/86] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[74/86] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[75/86] Linking C static library esp-idf\log\liblog.a
[76/86] Linking C static library esp-idf\esp_rom\libesp_rom.a
[77/86] Linking C static library esp-idf\esp_hw_support\libesp_hw_support.a
[78/86] Linking C static library esp-idf\efuse\libefuse.a
[79/86] Linking C static library esp-idf\bootloader_support\libbootloader_support.a
[80/86] Linking C static library esp-idf\spi_flash\libspi_flash.a
[81/86] Linking C static library esp-idf\micro-ecc\libmicro-ecc.a
[82/86] Linking C static library esp-idf\soc\libsoc.a
[83/86] Linking C static library esp-idf\hal\libhal.a
[84/86] Linking C static library esp-idf\main\libmain.a
[85/86] Linking C executable bootloader.elf
[86/86] Generating binary image from built executable
esptool.py v3.1-dev
Merged 1 ELF section
Generated C:/Users/svcgu/OneDrive/Documents/ESP32/pumpTest/build/bootloader/bootloader.bin
[988/999] Building C object esp-idf/cmd_console/CMakeFiles/__idf_cmd_console.dir/cmd_sys.c.obj
FAILED: esp-idf/cmd_console/CMakeFiles/__idf_cmd_console.dir/cmd_sys.c.obj 
C:\Users\svcgu\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe  -Iconfig -I../components/cmd_console -IC:/Users/svcgu/esp/esp-idf/components/newlib/platform_include -IC:/Users/svcgu/esp/esp-idf/components/freertos/include -IC:/Users/svcgu/esp/esp-idf/components/freertos/port/xtensa/include -IC:/Users/svcgu/esp/esp-idf/components/esp_hw_support/include -IC:/Users/svcgu/esp/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/svcgu/esp/esp-idf/components/heap/include -IC:/Users/svcgu/esp/esp-idf/components/log/include -IC:/Users/svcgu/esp/esp-idf/components/lwip/include/apps -IC:/Users/svcgu/esp/esp-idf/components/lwip/include/apps/sntp -IC:/Users/svcgu/esp/esp-idf/components/lwip/lwip/src/include -IC:/Users/svcgu/esp/esp-idf/components/lwip/port/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/lwip/port/esp32/include/arch -IC:/Users/svcgu/esp/esp-idf/components/soc/include -IC:/Users/svcgu/esp/esp-idf/components/soc/esp32/. -IC:/Users/svcgu/esp/esp-idf/components/soc/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/hal/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/hal/include -IC:/Users/svcgu/esp/esp-idf/components/esp_rom/include -IC:/Users/svcgu/esp/esp-idf/components/esp_rom/esp32 -IC:/Users/svcgu/esp/esp-idf/components/esp_common/include -IC:/Users/svcgu/esp/esp-idf/components/esp_system/include -IC:/Users/svcgu/esp/esp-idf/components/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/driver/include -IC:/Users/svcgu/esp/esp-idf/components/driver/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/esp_ringbuf/include -IC:/Users/svcgu/esp/esp-idf/components/efuse/include -IC:/Users/svcgu/esp/esp-idf/components/efuse/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/xtensa/include -IC:/Users/svcgu/esp/esp-idf/components/xtensa/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/espcoredump/include -IC:/Users/svcgu/esp/esp-idf/components/esp_timer/include -IC:/Users/svcgu/esp/esp-idf/components/esp_ipc/include -IC:/Users/svcgu/esp/esp-idf/components/esp_pm/include -IC:/Users/svcgu/esp/esp-idf/components/vfs/include -IC:/Users/svcgu/esp/esp-idf/components/esp_wifi/include -IC:/Users/svcgu/esp/esp-idf/components/esp_wifi/esp32/include -IC:/Users/svcgu/esp/esp-idf/components/esp_event/include -IC:/Users/svcgu/esp/esp-idf/components/esp_netif/include -IC:/Users/svcgu/esp/esp-idf/components/esp_eth/include -IC:/Users/svcgu/esp/esp-idf/components/tcpip_adapter/include -IC:/Users/svcgu/esp/esp-idf/components/app_trace/include -IC:/Users/svcgu/esp/esp-idf/components/console -IC:/Users/svcgu/esp/esp-idf/components/spi_flash/include -mlongcalls -Wno-frame-address   -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 -ggdb -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3-dirty\" -DESP_PLATFORM -MD -MT esp-idf/cmd_console/CMakeFiles/__idf_cmd_console.dir/cmd_sys.c.obj -MF esp-idf\cmd_console\CMakeFiles\__idf_cmd_console.dir\cmd_sys.c.obj.d -o esp-idf/cmd_console/CMakeFiles/__idf_cmd_console.dir/cmd_sys.c.obj   -c ../components/cmd_console/cmd_sys.c
../components/cmd_console/cmd_sys.c:24:10: fatal error: esp_app_format.h: No such file or directory
 #include "esp_app_format.h"
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
[992/999] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/main.c.obj
ninja: build stopped: subcommand failed.
The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command cmake --build ." terminated with exit code: 1.
Is there something I'm doing wrong? What I'd like to do is something like this:

Code: Select all

printf("FW name: %s\r\nFW ver: %s\r\nCompile Info: %s, %s", app_desc_s.version, app_desc_s.project_name, app_desc_s.time, app_desc_s.date);
Replacing app_desc_s with whatever the declared global variable name is

Thanks,
Andy

Victoria Nope
Posts: 75
Joined: Fri Dec 04, 2020 9:56 pm

Re: Access esp_app_desc_t

Postby Victoria Nope » Fri Aug 13, 2021 9:26 pm

You can get the running application descriptor with the esp_ota_get_app_description function.

svcguy
Posts: 4
Joined: Wed Oct 31, 2018 4:25 am

Re: Access esp_app_desc_t

Postby svcguy » Sat Aug 14, 2021 3:54 am

Hi,

Thanks for the response! I see that esp_ota_get_app_description is included from esp_ota_ops.h, but #include-ing that gives a fatal error: esp_ota_ops.h: No such file or directory as well. How can I get this into my project?

Victoria Nope
Posts: 75
Joined: Fri Dec 04, 2020 9:56 pm

Re: Access esp_app_desc_t

Postby Victoria Nope » Sun Aug 15, 2021 11:18 pm

Aha, I see. Well, the problem is then related to your first build error as well and it seems that some IDF components are not being included in your project's build process. Phew, that's what I'm afraid I cannot help you with.

My personal steps to try in case when IDF components stopped being included in my project's build might be:

1. Clean the project, build again
2. Try to create plain vanilla project, include the header and build
3. Check if my cat did not add EXCLUDE_COMPONENTS build variable somewhere
4. Start banging my head against the wall for not having a cat
5. Resync IDF repository, clean and build the project
6. Start praying to space forces after which giving up programming, starting new carrier as a local farmer

No, seriously. This is what should not happen "by default" and I would not like to break your environment even more if this is not just that particular project issue.

svcguy
Posts: 4
Joined: Wed Oct 31, 2018 4:25 am

Re: Access esp_app_desc_t

Postby svcguy » Tue Aug 17, 2021 7:33 pm

:D
I did try #1. I like #2 and #5, I’ll give them a go. As for #3 and #4 I can’t speak to the whereabouts of your cat over the last couple of days, but hopefully it has not been messing around with my project!

…and #6 is always on the table…

Andy

Who is online

Users browsing this forum: No registered users and 92 guests