I'm trying to customise the ESP32 bootloader in order to implement a rollback mechanism.
I'm a little confused as to how the bootloader build system works..
I see in components/bootloader/subproject/Makefile the list of COMPONENTS: :- includes bootloader_support, log, spi_flash etc.. and the functions in bootloader_support, log etc. are available in the bootloader.
However, I want to load the OTA data partition in order to read a flag in order to test a new OTA partition. When I try to use functions from the spi_flash component, I get linker errors:
......./components/bootloader/subproject/main/drop_ota_ops.c:32: undefined reference to `esp_partition_find_first'
......./components/bootloader/subproject/main/drop_ota_ops.c:36: undefined reference to `esp_partition_mmap'
......./components/bootloader/subproject/main/drop_ota_ops.c:42: undefined reference to `spi_flash_munmap'
I see the note in http://esp-idf.readthedocs.io/en/latest ... oader.html
"In the bootloader space, you can not use the drivers and functions from other components. If necessary, then the required functionality should be placed in the folder bootloader (note that this will increase its size)"
However, the functions from log, bootloader_support components etc. ARE being used in the bootloader.
How can I use the component spi_flash within the bootloader? Or, what's the best way to save some data to be used by the bootloader in determining which OTA partition to boot?
spi_flash in custom bootloader
Re: spi_flash in custom bootloader
https://github.com/espressif/esp-idf/bl ... _utility.c
https://github.com/espressif/esp-idf/bl ... er_flash.c
So basically use bootloader_mmap and bootloader_flash_xxxx functions
https://github.com/espressif/esp-idf/bl ... er_flash.c
So basically use bootloader_mmap and bootloader_flash_xxxx functions
-
- Posts: 31
- Joined: Sun Feb 25, 2018 10:59 am
-
- Posts: 31
- Joined: Sun Feb 25, 2018 10:59 am
Re: spi_flash in custom bootloader
The headers for these functions are in include_priv rather than include - does anyone know the significance of this? I see the source code is included.
Re: spi_flash in custom bootloader
include_priv is included by the bootloader & bootloader_support components, but not from other components.timredfern wrote:The headers for these functions are in include_priv rather than include - does anyone know the significance of this? I see the source code is included.
Originally the idea was that eventually all code calling include_priv functions would be part of bootloader_support. However, since then we decided to encourage users to customise the bootloader - so this will not happen. Probably a better name for this directory now is "include_bootloader".
Who is online
Users browsing this forum: No registered users and 110 guests