STM32开发总结-stm32-cmake-stm32f429
如何使用cmake编译stm32F29程序
主要参考:https://github.com/ObKo/stm32-cmake和https://github.com/yendreij/stm32-cmake-cpp
步骤:
1.安装依赖库
stm32-cmake中的packes文件夹里面的内容比较旧,所以无法通过cmake实现,只能手动安装。
1.1 STM32Cube_FW_F4_V1.6.0,下载解压,编译时指定目录即可。
1.2 SetupSTM32CubeMX-4.25.0安装可以参考:https://blog.csdn.net/zoomdy/article/details/79217847
2.下载源代码
https://github.com/ObKo/stm32-cmake
3.编译
rm * -rf && cmake .. -DCMAKE_BUILD_TYPE=Debug -DSTM32_CHIP=STM32F429IG -DCMAKE_MODULE_PATH=/home/vgaozh/aicore/Bach/stm32-cmake/cmake/ -DCMAKE_TOOLCHAIN_FILE=/home/vgaozh/aicore/Bach/stm32-cmake/cmake/gcc_stm32.cmake -DSTM32Cube_DIR=/home/vgaozh/tools/en.stm32cubemx/STM32Cube_FW_F4_V1.6.0 -DTOOLCHAIN_PREFIX=/home/vgaozh/aicore/rtx/gcc-arm-none-eabi-5_4-2016q3
-- No TARGET_TRIPLET specified, using default: arm-none-eabi
-- No STM32_FAMILY specified, trying to get it from STM32_CHIP
-- Selected STM32 family: F4
-- The ASM compiler identification is GNU
-- Found assembler: /home/vgaozh/aicore/rtx/gcc-arm-none-eabi-5_4-2016q3/bin/arm-none-eabi-gcc
-- STM32F429IG is 429xx device
-- Found CMSIS: /home/vgaozh/tools/en.stm32cubemx/STM32Cube_FW_F4_V1.6.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include;/home/vgaozh/tools/en.stm32cubemx/STM32Cube_FW_F4_V1.6.0/Drivers/CMSIS/Include
-- No linker script specified, generating default
-- STM32F429IG has 1024KiB of flash memory and 192KiB of RAM
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vgaozh/aicore/Bach/stm32-cmake/stm32-template/build
vgaozh@vi5:~/aicore/Bach/stm32-cmake/stm32-template/build$ make
Scanning dependencies of target stm32-template
[ 25%] Building C object CMakeFiles/stm32-template.dir/main.c.obj
[ 50%] Building C object CMakeFiles/stm32-template.dir/home/vgaozh/tools/en.stm32cubemx/STM32Cube_FW_F4_V1.6.0/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c.obj
[ 75%] Building ASM object CMakeFiles/stm32-template.dir/home/vgaozh/tools/en.stm32cubemx/STM32Cube_FW_F4_V1.6.0/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f429xx.s.obj
[100%] Linking C executable stm32-template
text data bss dec hex filename
1028 1076 540 2644 a54 stm32-template
[100%] Built target stm32-template
4.运行测试
未测试
总结:
浙公网安备 33010602011771号