编译环境: windows10
1. 下载交叉编译器launchpad()gcc-arm-none-eabi-5_4-2016q3-20160926-win32.zip)
2. 解压缩到x:cygwin64optgcc-arm-none-eabigcc-arm-none-eabi-5_4-2016q3-20160926-win32
3. 配置PATH路径,echo '[[ $PATH == */opt/gcc-arm-none-eabi/bin* ]] || export PATH=/opt/gcc-arm-none-eabi/gcc-arm-none-eabi-5_4-2016q3-20160926-win32/bin:$PATH' >>~/.bashrc
4. clone源码git clone --recursive https://github.com/bitcraze/crazyflie-firmware.git
5. 切换到支持stm32f103的分支,git checkout 2017.06
,这时编译make PLATFORM=CF1
会报错.src/lib/CMSIS/Core/CM3/stm32f10x.h:303:22: fatal error: core_cm3.h: No such file or directory
6. 修改Makefile第250行,# INCLUDES += -Ivendor/CMSIS/CMSIS/Include -Isrc/drivers/bosch/interface
为INCLUDES += -Ivendor/CMSIS/CMSIS/Core/Include -Isrc/drivers/bosch/interface
.路径问题.
7. 此时编译还有问题. ld.exe: cf1.elf section
._usrstack’ will not fit in region RAM'
, ld.exe: region RAM overflowed by 140 bytes
.修改E:workprjemc2crazyflie-firmwaretoolsmakeF103linkerCOMMON.ld
第26行,/*_Minimum_Stack_Size = 0x100 ;*/
为_Minimum_Stack_Size = 0x50 ;
8. 编译make PLATFORM=CF1
,成功生成文件cf1.bin, cf1.dfu, cf1.elf, cf1.hex, cf1.map
,日志:
CLEAN_VERSION
VTMPL version.c
CC version.o
LD cf1.elf
COPY cf1.hex
COPY cf1.bin
DFUse cf1.dfu
Crazyflie Nano (1.0) build!
Build 0:ab6d531c7ca7 (2017.06) MODIFIED
Version extracted from git
Crazyloader build!
text data bss dec hex filename
70884 1404 19040 91328 164c0 cf1.elf