cmake: integrating library for state machine (hsmcpp) with esp-idf needs FreeRTOS CMakeFiles.txt
Posted: Tue Apr 11, 2023 10:18 pm
Hi, I'm trying to integrate hsmcpp library (https://github.com/igor-krechetov/hsmcpp) to my existing project.
This library allows code generation of hierarchical state machines and FSM from statechart diagrams and has a dispatcher for FreeRTOS.
They provide an example https://github.com/igor-krechetov/hsmcp ... 8_freertos to use it with FreeRTOS, that example requires modifying their CMakeLists.txt so it can point to FreeRTOS path (details: https://hsmcpp.readthedocs.io/en/latest ... erfreertos).
The entire CMakeLists.txt provided by them is here https://github.com/igor-krechetov/hsmcp ... eLists.txt the remarkable part is shown below:
As requested I modified the FREERTOS_ROOT path (and also FREERTOS_KERNEL_DIR) so it points to esp-idf freertos component path($IDF_PATH/components/freertos), but I'm struggling with some errors there since the example provided is intended to use with unmodified FreeRTOS and the one provided with esp-idf has modifications to be added in the projects as a component.
Now it fails because CMakeFiles.txt inside FreeRTOS-Kernel folder is missing, the only CMakeFiles.txt file is present on $IDF_PATH/components/freertos, but this one has idf commands like idf_build_get_property() that can't be interpreted by cmake when calls this path using add_subdirectory.
Any hint to solve this?
As a second approach I'm considering to clone FreeRTOS and then add "by hand" the code generated by this example. But I'm not pretty sure if there could be some kind of version mismatch of FreeRTOS, could be messy and in a future I would like to generate the statechart code when building my esp project (modifying the esp project CMakeLists.txt and adding the generated code as a component), so the first approach would be the most appropriate.
Thanks.
This library allows code generation of hierarchical state machines and FSM from statechart diagrams and has a dispatcher for FreeRTOS.
They provide an example https://github.com/igor-krechetov/hsmcp ... 8_freertos to use it with FreeRTOS, that example requires modifying their CMakeLists.txt so it can point to FreeRTOS path (details: https://hsmcpp.readthedocs.io/en/latest ... erfreertos).
The entire CMakeLists.txt provided by them is here https://github.com/igor-krechetov/hsmcp ... eLists.txt the remarkable part is shown below:
- SET(FREERTOS_ROOT "full path to FreeRTOS directory")
- SET(FREERTOS_DIR "${FREERTOS_ROOT}/FreeRTOS")
- SET(FREERTOS_PLUS_DIR "${FREERTOS_ROOT}/FreeRTOS-Plus")
- SET(FREERTOS_KERNEL_DIR "${FREERTOS_DIR}/Source")
- SET(FREERTOS_LIB_DIR "${CMAKE_BINARY_DIR}/freertos")
- SET(FREERTOS_PORT_LIB_DIR "${FREERTOS_LIB_DIR}/portable")
- SET(FREERTOS_LIBS freertos_kernel freertos_kernel_port pthread)
Now it fails because CMakeFiles.txt inside FreeRTOS-Kernel folder is missing, the only CMakeFiles.txt file is present on $IDF_PATH/components/freertos, but this one has idf commands like idf_build_get_property() that can't be interpreted by cmake when calls this path using add_subdirectory.
Any hint to solve this?
As a second approach I'm considering to clone FreeRTOS and then add "by hand" the code generated by this example. But I'm not pretty sure if there could be some kind of version mismatch of FreeRTOS, could be messy and in a future I would like to generate the statechart code when building my esp project (modifying the esp project CMakeLists.txt and adding the generated code as a component), so the first approach would be the most appropriate.
Thanks.