I saw a previous post with a similar issue here. In an attempt to try this solution I added this:
add_compile_options(${EXECUTABLE} PUBLIC
-mcpu=cortex-m7
)
add_subdirectory(App)
add_subdirectory(API)
Within my App dir, I keep my main.c, the API directory contains the CubeMX generated BSP, as well as the RTOS directory. I should also note that I am using CMake to build Ninja
High Level Structure
CMakeLists.txt (Where the CMake snippet above exists)
- App
- Src
- Main.c
CMakeLists.txt (Creates executable)
- API
- BSP
- STM32H7_Gen
- CMakeLists.txt
- RTOS
- freeRTOS
- freeRTOS_Plus
- freeRTOS_Config
- CMakeLists.txt
After making that adjustment, there are now linker errors…
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build C:/Users/User/Documents/git/my_app/build/Debug --parallel 8
[build] [1/120] Building ASM object App/CMakeFiles/My_App.dir/__/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Startup/startup_stm32h753zitx.S.obj
[build] FAILED: App/CMakeFiles/My.dir/__/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Startup/startup_stm32h753zitx.S.obj
[build] C:\ST\STM32CubeCLT\GNU-tools-for-STM32\bin\arm-none-eabi-gcc.exe -fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections -DSTM32H753xx -DUSE_HAL_DRIVER -IC:/Users/User/Documents/git/my_app/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Inc -IC:/Users/User/Documents/git/my_app/API/BSP/stm32h753zi_bsp/stm32H753ZI/Drivers/CMSIS/Device/ST/STM32H7xx/Include -IC:/Users/User/Documents/git/my_app/API/BSP/stm32h753zi_bsp/stm32H753ZI/Drivers/CMSIS/Include -IC:/Users/User/Documents/git/my_app/API/BSP/stm32h753zi_bsp/stm32H753ZI/Drivers/STM32H7xx_HAL_Driver/Inc -IC:/Users/User/Documents/git/my_app/API/RTOS/freertos/FreeRTOS/Source/include -IC:/Users/User/Documents/git/my_app/API/RTOS/freertos/Config -IC:/Users/User/Documents/git/my_app/API/RTOS/freertos/FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 -g My_App PUBLIC -mcpu=cortex-m7 -std=gnu17 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H753xx -Og -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -MD -MT App/CMakeFiles/My_App.dir/__/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Startup/startup_stm32h753zitx.S.obj -MF App\CMakeFiles\My_App.dir\__\API\BSP\stm32h753zi_bsp\stm32H753ZI\Core\Startup\startup_stm32h753zitx.S.obj.d -o App/CMakeFiles/My_App.dir/__/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Startup/startup_stm32h753zitx.S.obj -c C:/Users/User/Documents/git/my_app/API/BSP/stm32h753zi_bsp/stm32H753ZI/Core/Startup/startup_stm32h753zitx.S
[build] arm-none-eabi-gcc.exe: warning: My_App: linker input file unused because linking not done
[build] arm-none-eabi-gcc.exe: error: My_App: linker input file not found: No such file or directory
[build] arm-none-eabi-gcc.exe: warning: PUBLIC: linker input file unused because linking not done
[build] arm-none-eabi-gcc.exe: error: PUBLIC: linker input file not found: No such file or directory