I have not been able to find out how to compile for release mode. When I copy an example and compile the example with make VERBOSE=1 I see that the compiler flags are -Og -ggdb, but I want the flags to be -Os -O3.
I tried "cmake -DCMAKE_BUILD_TYPE=Release" but that added a ton of files and broke the example.
How to compile for release mode with -Os -O3
Re: How to compile for release mode with -Os -O3
Hi willhelm,
If you open the project configuration menu, there's an item to set the compiler optimization level. We don't currently support the "normal" CMake way of setting debug/release. Recent ESP-IDF versions support -Og, -Os and -O2 as separate levels.
Setting "-Os -O3" is the same as setting "-O3". To quote the gcc man page: "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective."
ESP-IDF doesn't currently support -O3, recommend using -O2 if you want the best performance and don't mind some binary size increase or -Os if you want minimal binary size. On our architecture -O3 can also grow the binary size significantly compared to -O2, leading to lower real-world performance on ESP32s because of the flash cache without major benefits. For this reason we haven't prioritised supporting this level.
Angus
If you open the project configuration menu, there's an item to set the compiler optimization level. We don't currently support the "normal" CMake way of setting debug/release. Recent ESP-IDF versions support -Og, -Os and -O2 as separate levels.
Setting "-Os -O3" is the same as setting "-O3". To quote the gcc man page: "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective."
ESP-IDF doesn't currently support -O3, recommend using -O2 if you want the best performance and don't mind some binary size increase or -Os if you want minimal binary size. On our architecture -O3 can also grow the binary size significantly compared to -O2, leading to lower real-world performance on ESP32s because of the flash cache without major benefits. For this reason we haven't prioritised supporting this level.
Angus
Who is online
Users browsing this forum: Google [Bot] and 238 guests