spi_flash in custom bootloader
Posted: Tue Jun 19, 2018 5:12 pm
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?
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?