Changing Project configuration and modules in PlatformIO IDE

#1.) Need some help with configuring my project running under PlatformIO IDE and VSCode. I don’t use Arduino. I need to either change or add the Power Management support and the ESP-IDF programming Guide states I may need to use the option CONFIG_PM_ENABLE. So at this point I think I understand the sdkconfig.h file, and have successfully changed options in there to config the project as needed. Is this file where I add a #define CONFIG_PM_ENABLE 1 statement to enable the power management functions?

#2.) There are a lot of modules being included into the main project by default, some of which I don’t need or want. How do I remove them from the project? It looks like GCC is the compiler, so does that mean that if I don’t make a function call to a module, then the Linker will remove that code from the final executable? I know there is a switch in GCC/Linker to not include unreferenced code. Is that whats happening here? If not, where are the GCC/Linker switches referenced during compile time?

Thanks for your help
Jerry

Forgot to mention. The development environment is Windows 7 64-bit.

  1. If you are using ESP-IDF (as you do), changing sdkconfig.h in your project folder is the correct approach.

  2. Unused modules are compiled but not included. If I’m not mistaken it doesn’t use an special gcc flag. Instead the object files are added to an archive file (*.a). And by design, the linker only includes those object files from archives that are needed to satisfy open references. So don’t worry about the size of the finaly binary. The only down-side is the increased compile time.

2 Likes

Thanks Manuelbl,
I did try changing the sdkconfig.h file last night and added these 4 defines.
#define CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP 2 // must be > 1 to compile!!
#define CONFIG_FREERTOS_USE_TICKLESS_IDLE 1
#define CONFIG_PM_ENABLE 1
#define CONFIG_PM_USE_RTC_TIMER_REF 1
The project compiled just fine and the code grew by about 10K in size, so that verified it was the right direction to go.
Thank You for your help.

Jerry

Great to hear… :smiley: