Clean Starter project for FreeRTOS and ESP32

TJirsch wrote on March 02, 2019:

Hi, thank you for sharing the information.

as to your questions:

I have existing projects for customers that use the original ESP-IDF Framework and its proposed directory structure and build system (https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#component-makefiles).

This basicly means: Put ESP-IDF in one place and my code in a another place with a structure mostly at my disposure and reference the ESP-IDF by setting a per project variable.
That is fine with me as I can also upgrade to new ESP-IDF versions on a per project basis.
I have integrated the embedded AWS IoT SDK into those project in a similar fashion.

The main point is separation of my project code from the library code.

I would like to switch to “native” AWS FreeRTOS and I have tried to do this with two approaches:

  1. Start from zero in a directory of my own
  2. Work from a running demo project out of the demo folder, as I cannot deliver source code to customers that is located in a demo folder and mixed with library code.

Both strategies fail sooner or later because the references set in the project Makefile and project.mk files for components are relative (…/…/) and propagated to the build process of library components. The folder depth of the project structure for the project is on the same level as components in the lib folder and the build seems to depend on that.
If I move my project folder from demos/espressif/esp32_devkitc_esp_wrover_kit/common/application_code I have to change build vars (COMPONENT_ADD_INCLUDEDIRS, EXTRA_COMPONENT_DIRS). This breaks the build, because they are relative and propagated to the build of library components in freeRTOS/lib etc.

With both strategies 1. and 2., this is where I end up editing individual component.mk files in the lib folder to make them work independently of the project vars. I have gotten really far, but all the work will be useless as soon as a new version comes out, possibly for new reasons, so this is not the way to go. I’d have gone for some small changes, but I realized I was rebuilding the build system towards the original ESP-IDF version.

Also there is library code in demos/espressif/esp32_devkitc_esp_wrover_kit/common/application_code/espressif_code that is application independent and would belong into the freeRTOS/lib folder. This code is also broken for the same reason as the folder move.
Also what I do not want, is to put my code into a folder that represents my special board (demos/espressif/esp32_devkitc_esp_wrover_kit/common/application_code/), that structure is ok for a lib, but not for a project.
Furthermore I using the original FreeRTOS also to connect to GCP (sorry), so I would like to be able to place projects in a folder structure reflecting that, but thats optional.

It might be possible to build a separate library first and then link my code with that, but I will first try to keep the structure depth and just rename the demo folder.
If none of that does not work, I will have to stick to the original version.

I think that lots of people try out the demos and then get stuck on building their own apps as I do. I would be really happy if I missed something, as i would really like to get ota updates and BLE.