编译时出现:
/home/ygl/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: ../../nuttx_px4fmu-v2_default.elf section `.text' will not fit in region `flash'
/home/ygl/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8103924 of ../../nuttx_px4fmu-v2_default.elf section `__param' is not within region `flash'
/home/ygl/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8103924 of ../../nuttx_px4fmu-v2_default.elf section `__param' is not within region `flash'
/home/ygl/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8103924 of ../../nuttx_px4fmu-v2_default.elf section `__param' is not within region `flash'
/home/ygl/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: region `flash' overflowed by 18133 bytes
collect2: error: ld returned 1 exit status
platforms/nuttx/CMakeFiles/nuttx_px4fmu-v2_default.elf.dir/build.make:224: recipe for target 'nuttx_px4fmu-v2_default.elf' failed
make[3]: *** [nuttx_px4fmu-v2_default.elf] Error 1
CMakeFiles/Makefile2:7209: recipe for target 'platforms/nuttx/CMakeFiles/nuttx_px4fmu-v2_default.elf.dir/all' failed
make[2]: *** [platforms/nuttx/CMakeFiles/nuttx_px4fmu-v2_default.elf.dir/all] Error 2
Makefile:105: recipe for target 'all' failed
make[1]: *** [all] Error 2
Makefile:176: recipe for target 'px4fmu-v2_default' failed
make: *** [px4fmu-v2_default] Error 2
解决办法:
打开编译后的文件 ./build/nuttx_px4fmu-v2_default/NuttX/nuttx/configs/px4fmu-v2/scripts/ld.script
将flash (rx) : ORIGIN = 0x08004000, LENGTH = 1008K
修改成flash (rx) : ORIGIN = 0x08004000, LENGTH = 1508K
参考:百度贴吧pixhawk吧,https://tieba.baidu.com/p/4742461734?red_tag=1798969688&traceid=