esp-rs / esp-idf-template

A "Hello, world!" template of a Rust binary crate for the ESP-IDF framework.
373 stars 44 forks source link

sdkconfig.defaults ignored #75

Closed br0kenpixel closed 8 months ago

br0kenpixel commented 1 year ago

Hi. I'm having issues changing the SDK configuration. I'd like to disable logging in the bootloader and HAL as well as a few other things, which can be done by adding the following lines to sdkconfig.defaults:

CONFIG_BOOTLOADER_LOG_LEVEL=0
CONFIG_BOOTLOADER_WDT_ENABLE=n
CONFIG_HAL_LOG_LEVEL=0
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_ESP_SYSTEM_PANIC=ESP_SYSTEM_PANIC_PRINT_HALT

After adding these lines to sdkconfig.defaults and running cargo build (with or without --release) I noticed that none of these changes were applied. My ESP32 was still displaying boot logs and calling panic!() would make the chip reboot instead of halting as specified above.

I tried:

None of these helped. Is there extra configuration needed to make this work?

ESP-IDF version: release/v4.4 Board: Generic ESP32 dev board Project generated using: cargo generate https://github.com/esp-rs/esp-idf-template cargo STD support: yes, Dev container support: no

Talebna commented 1 year ago

I'm having this issue. As i'm using an ESP thing board, i need to change the XTAL_FREQ to 26MHz. The sdkconfig.defaults is just ignored. Did you found any workaround ? @br0kenpixel

ivmarkov commented 1 year ago

The bootloader settings affect the bootloader. Meaning - you need to flash the bootloader as well (which is generated as a by-product from the build).

Now, the xtal settings are not bootloader settings so it should just work. I've however noticed that sometimes when using a cargo workspace, the sdkconfig is not always picked up. Not sure yet what is the root cause.

As a workaround, use the $ESP_IDF_SDKCONFIG_DEFAULTS env variable, as described here.

ivmarkov commented 8 months ago

There is no such thing as sdkconfig.defaults being ignored - I've confirmed it. Watch out for:

Vollbrecht commented 8 months ago

There is no such thing as sdkconfig.defaults being ignored - I've confirmed it. Watch out for:

* Using a workspace and NOT placing the file in the workspace root. It MUST be there;

* Trying flags which affect the bootloader. Bootloader WILL be rebuilt as a result, but `espflash` is flashing **its own** bootloader, unless you pull the bootloader built as a side effect from your project and instruct `espflash` to flash that one instead.

Its true that a sdkconfing.defaults file itself will not be ignored - but a wrongly typed config inside for example will be ignored. Overall you are correct that this is a espflash/bootloader problem

ivmarkov commented 8 months ago

Its true that a sdkconfing.defaults file itself will not be ignored - but a wrongly typed config inside for example will be ignored.

Sure. But this is on the ESP-IDF side to eventually address/fix.