I am using a CY8CKIT-064S0S2-4343W and I have followed all the demo steps and I am using CMake but now I want to link freertos into my own project how do I do this as there is no instructions on the AWS get started guide
any example of linking to an external project would be great
Thanks for the reply.
Yes that is the kit I have but I am only using it for prototyping my project so I trying to not you to use the IDE to build the project but to use cmake instead. I am trying to have the freertos kernel and some of the other libraries such as coreHTTP and coreJSON and and the secure sockets abstraction library
The core libraries are in their own repos with the intention that you can Git submodule them into your project. Alternatively, you can just copy the code into your application, but doing so breaks the link with the git repo so you loose all the version history and the ability to quickly pull in any future versions. Here is an example for coreHTTP: https://github.com/FreeRTOS/coreHTTP/tree/9f511d57f4f4048654389259a1a483b0f71f6951
Build the .c files and ensure the .h files are in the compiler’s include path. You will also need the configuration file per library, which you can copy from your prototype project.
cmake_minimum_required(VERSION 3.13)
project(freertos_examples)
add_executable(my_app src/main.c)
# Tell IDF build to link against this target.
set(IDF_PROJECT_EXECUTABLE my_app)
# Add FreeRTOS as a subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD espressif.esp32_devkitc CACHE INTERNAL "")
add_subdirectory(freertos)
# Link against the mqtt library so that we can use it. Dependencies are transitively
# linked.
target_link_libraries(my_app PRIVATE AFR::mqtt)
Is it possible to have an example of what this top file should look like?
I have tried a little example and it worked for me (passing the cmake stage)
with:
$ cmake -S . -B build_dir # from the root directory of the project
cmake_minimum_required(VERSION 3.13)
project(freertos_examples)
add_executable(my_app src/main.c)
# Tell IDF build to link against this target.
set(IDF_PROJECT_EXECUTABLE my_app)
# Add FreeRTOS as a subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD ti.cc3220_launchpad CACHE INTERNAL "")
set(AFR_TOOLCHAIN arm-ti CACHE INTERNAL "")
add_subdirectory(amazon-freertos)
# Link against the mqtt library so that we can use it. Dependencies are transitively
# linked.
target_link_libraries(my_app PRIVATE AFR::mqtt_demo_helpers)
cmake_minimum_required(VERSION 3.13)
project(my_app)
add_executable(${PROJECT_NAME} src/main.c)
set(IDF_PROJECT_EXECUTABLE ${PROJECT_NAME})
# Add FreeRTOS as a subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD cypress.CY8CKIT_064S0S2_4343W CACHE INTERNAL "")
set(AFR_TOOLCHAIN arm-gcc CACHE INTERNAL "")
add_subdirectory(freertos)
# Link against the mqtt library so that we can use it. Dependencies are transitively
# linked.
target_link_libraries(${PROJECT_NAME} PRIVATE
AFR::freertos
AFR::kernel
AFR::core_http
AFR::core_json
AFR::secure_sockets
AFR::ble
AFR::wifi
)
but when I run cmake -S . -B .\build -G "MinGW Makefiles" it uses my mingw gcc compiler and not my arm-none-eabi-gcc compiler but when I build freertos using cmake -DVENDOR=cypress -DBOARD=CY8CKIT_064S0S2_4343W -DCOMPILER=arm-gcc -S .\freertos\ -B .\build\ -G "MinGW Makefiles" it does use my arm-none-eabi-gcc compiler.
any ideas of how I can fix this?
Sorry for the late reply.cmake_minimum_required(VERSION 3.13)
this is my new CMakeList.txt
project(my_app)
add_executable(${PROJECT_NAME} src/main.c)
set(IDF_PROJECT_EXECUTABLE ${PROJECT_NAME})
# Add FreeRTOS as a subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD cypress.CY8CKIT_064S0S2_4343W CACHE INTERNAL "")
set(AFR_TOOLCHAIN arm-gcc CACHE INTERNAL "")
set(AFR_COMPILER arm-none-eabi-gcc CACHE INTERNAL "ARM compiler")
set (AFR_TOOLCHAIN_PATH "C:/path/to/toolchain" CACHE INTERNAL "compiler path")
add_subdirectory(freertos)
# Link against the mqtt library so that we can use it. Dependencies are transitively
# linked.
target_link_libraries(${PROJECT_NAME} PRIVATE
AFR::freertos
AFR::kernel
AFR::core_http
AFR::core_json
AFR::secure_sockets
AFR::ble
AFR::wifi
)
and it still cant find the arm compiler I really have no idea how this isnt working
@senfrost Can you share tree diagram of your project how the project is setup?
Is that below way?
├── CMakeLists.txt
├── components
├── freertos
├── freertos-configs
├── partition-table.csv
├── README.md
├── src
└── Testing-Commands.txt