Porting project for ESP32

Hey fellow software people.

I want to port this here framework for DASH7 protocol for LoRa for use with the ESP32 platform.
They even have a section about porting: https://sub-iot.github.io/Sub-IoT-Stack/docs/porting/
I have chosen this as a final project for my Bachelors in Electronics. I could have chosen something hardware related, but I wanted a challenge and also do something useful. And this would be very useful, in my opinion, to enable the use of ESP32’s with the DASH7 standard. My intention is not to make a complete implementation of the standard at this point. Rather to get something simple running and add on top of that. Get a “Hello World!” message sent over the airwaves, and that will be my project, for now. And perhaps other people can take over and add what ever they feel might be missing.

But I’m having some real problems getting started. This framework I want to port is a CMake project using ARM Cortex-M GCC-based toolchain. See details here: https://sub-iot.github.io/Sub-IoT-Stack/docs/building/

The ESP32 also uses a similar CMake build engine. Only it is Xtensa cores. In the above link there is an example for how to compile. And it suggest replacing the ARM toolchain with something else, if needed. This is where I am confused. Looking at some examples for using the ESP-IDF in CMake projects, I figured I’d add these lines to the root CMakeLists.txt

cmake_minimum_required(VERSION 3.5…3.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

idf_build_process(esp32)

project(hello-world)

IF(NOT CMAKE_TOOLCHAIN_FILE)

SET(CMAKE_TOOLCHAIN_FILE $ENV{IDF_PATH}/tools/cmake/project.cmake)

ENDIF()

But, I think I am missing something major here. (please don’t laugh) :grimacing:

I found this example of how to use ESP-IDF in Custom CMake projects.
https://github.com/espressif/esp-idf/tree/master/examples/build_system/cmake/idf_as_lib
And it seems like exactly what I want to do. But how to smash this into my project so that something compiles? Any nudge in the right direction is greatly appreciated. :blush:

Toolchain files need to be provided before specifying any languages. That project() call has implicit C and CXX languages, so the compilers are searched for before your toolchain file has any effect.