Page 1 of 1

Custom bootloader with CMake

Posted: Mon May 13, 2019 2:40 pm
by umaeder
Hi

I'm trying to set up a custom bootloader, following the guides in https://docs.espressif.com/projects/esp ... bootloader and https://docs.espressif.com/projects/esp ... he-project. However, it seems like my bootloader is ignored, and the bootloader in $IDF_PATH/components/bootloader always gets precedence.

I'm using the CMake build system on esp-idf v3.3beta3. It looks like it's ignoring the CMakeLists.txt in components/bootloader/subproject/ entirely...

Appreciate any hints on what's wrong here, thanks!

- Urban

Re: Custom bootloader with CMake

Posted: Wed May 15, 2019 4:33 am
by ESP_renz
Hi Urban,

I'm assuming you haven't done heavy modifications to the project_include.cmake, since the problem occurs even if we just take a copy of the original component and plop it in the components folder. The problem lies with bootloader subproject build still using the original copy of the component.

In my case the app build recognizes that there is an 'override' to the bootloader component (observe the component paths).

Code: Select all

-- Component names: soc log heap xtensa-debug-module app_trace freertos vfs newlib esp_ringbuf driver esp_event ethernet mbedtls micro-ecc efuse bootloader_support partition_table app_update spi_flash nvs_flash lwip tcpip_adapter pthread smartconfig_ack wpa_supplicant espcoredump esp32 cxx bootloader asio jsmn aws_iot bt coap console nghttp esp-tls esp_adc_cal tcp_transport esp_http_client esp_http_server esp_https_ota openssl esp_https_server esptool_py expat wear_levelling sdmmc fatfs freemodbus idf_test json libsodium mdns mqtt protobuf-c protocomm spiffs ulp unity wifi_provisioning main
-- Component paths: /idf/esp-idf/components/soc;/idf/esp-idf/components/log;/idf/esp-idf/components/heap;/idf/esp-idf/components/xtensa-debug-module;/idf/esp-idf/components/app_trace;/idf/esp-idf/components/freertos;/idf/esp-idf/components/vfs;/idf/esp-idf/components/newlib;/idf/esp-idf/components/esp_ringbuf;/idf/esp-idf/components/driver;/idf/esp-idf/components/esp_event;/idf/esp-idf/components/ethernet;/idf/esp-idf/components/mbedtls;/idf/esp-idf/components/micro-ecc;/idf/esp-idf/components/efuse;/idf/esp-idf/components/bootloader_support;/idf/esp-idf/components/partition_table;/idf/esp-idf/components/app_update;/idf/esp-idf/components/spi_flash;/idf/esp-idf/components/nvs_flash;/idf/esp-idf/components/lwip;/idf/esp-idf/components/tcpip_adapter;/idf/esp-idf/components/pthread;/idf/esp-idf/components/smartconfig_ack;/idf/esp-idf/components/wpa_supplicant;/idf/esp-idf/components/espcoredump;/idf/esp-idf/components/esp32;/idf/esp-idf/components/cxx;/idf/esp-idf/examples/get-started/hello_world/components/bootloader;/idf/esp-idf/components/asio;/idf/esp-idf/components/jsmn;/idf/esp-idf/components/aws_iot;/idf/esp-idf/components/bt;/idf/esp-idf/components/coap;/idf/esp-idf/components/console;/idf/esp-idf/components/nghttp;/idf/esp-idf/components/esp-tls;/idf/esp-idf/components/esp_adc_cal;/idf/esp-idf/components/tcp_transport;/idf/esp-idf/components/esp_http_client;/idf/esp-idf/components/esp_http_server;/idf/esp-idf/components/esp_https_ota;/idf/esp-idf/components/openssl;/idf/esp-idf/components/esp_https_server;/idf/esp-idf/components/esptool_py;/idf/esp-idf/components/expat;/idf/esp-idf/components/wear_levelling;/idf/esp-idf/components/sdmmc;/idf/esp-idf/components/fatfs;/idf/esp-idf/components/freemodbus;/idf/esp-idf/components/idf_test;/idf/esp-idf/components/json;/idf/esp-idf/components/libsodium;/idf/esp-idf/components/mdns;/idf/esp-idf/components/mqtt;/idf/esp-idf/components/protobuf-c;/idf/esp-idf/components/protocomm;/idf/esp-idf/components/spiffs;/idf/esp-idf/components/ulp;/idf/esp-idf/components/unity;/idf/esp-idf/components/wifi_provisioning;/idf/esp-idf/examples/get-started/hello_world/main
However, the bootloader subproject build still uses the original component:

Code: Select all

- Component names: soc esp32 log bootloader spi_flash micro-ecc efuse bootloader_support main esptool_py partition_table
-- Component paths: /idf/esp-idf/components/soc;/idf/esp-idf/components/esp32;/idf/esp-idf/components/log;/idf/esp-idf/components/bootloader;/idf/esp-idf/components/spi_flash;/idf/esp-idf/components/micro-ecc;/idf/esp-idf/components/efuse;/idf/esp-idf/components/bootloader_support;/idf/esp-idf/components/bootloader/subproject/main;/idf/esp-idf/components/esptool_py;/idf/esp-idf/components/partition_table
Working on the fix for this.

Re: Custom bootloader with CMake

Posted: Thu May 23, 2019 12:20 pm
by ESP_renz
Hi urban,

The fix has already been merged for master: https://github.com/espressif/esp-idf/co ... 75a1c0be2a. It might take some time to get it backported to v3.3. In the meantime, you can redo the changes in the linked commit on your custom bootloader.

Renz