esp-rs / esp-idf-template

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

Build optimization flags should use CONFIG_COMPILER_OPTIMIZATION_* instead of CMAKE_BUILD_TYPE #162

Open georgik opened 8 months ago

georgik commented 8 months ago

Motivations

Current version of template is using CMAKE_BUILD_TYPE to determine Release/Debug build. Which will result in the command like this:

idf.py -DCMAKE_BUILD_TYPE=Debug build flash monitor

The template should use CONFIG_COMPILER_OPTIMIZATION_DEBUG, CONFIG_COMPILER_OPTIMIZATION_SIZE, CONFIG_COMPILER_OPTIMIZATION_PERF and so on.

Setting CMAKE_BUILD_TYPE in IDF is not a supported way of changing optimization level, more details: https://github.com/espressif/esp-idf/issues/4189

ivmarkov commented 8 months ago

@georgik Would you mind opening a PR for that?