How do I link amazon freertos to my project

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 in advance

Is this the kit you have? https://www.cypress.com/documentation/development-kitsboards/psoc-64-standard-secure-aws-wi-fi-bt-pioneer-kit-cy8ckit If it looks like FreeRTOS is included in the SDK that comes with the kit. If that is the case I think you should be able to add FreeRTOS using the development tools that come with the kit. Can you be more specific about what you want to integrate? Just the kernel, or more?

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.

This is the git repo for the kernel: GitHub - FreeRTOS/FreeRTOS-Kernel: FreeRTOS kernel files only, submoduled into https://github.com/Free That is a little different because it contains the port files for all the kernel ports so you have to choose the right one. The following links will help - you can look at which port file your prototype project is using too.

https://freertos.org/Creating-a-new-FreeRTOS-project.html
Source code organisation

The documentation for the demo you are already using should tell you which port file to select.

thank you for the reply.
I am building aws freertos as a submodule and I can build it using CMake and I can run the demos using the cmake command line Getting started with the Cypress CY8CKIT-064S0S2-4343W kit - FreeRTOS (amazon.com)
but now I am adding a top level CMakelists.txt to build both freertos as a subdirectory I am not sure that top level file should look like for this board I have seen the example of the file in Getting started with the Espressif ESP32-DevKitC and the ESP-WROVER-KIT - FreeRTOS (amazon.com)

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?

Hi @senfrost,

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)   

Hi @gedeonag
I this is my current CMakelists.txt

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?

You will have to set the AFR_TOOLCHAIN_PATH

set (AFR_TOOLCHAIN_PATH "/path/to/toolchain" CACHE INTERNAL "compiler path")

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

yeah looks weird… could it be the windows paths? “/” vs “\”
i am testing on a linux box, cmake is working smoothly after adding

AFR_TOOLCHAIN_PATH