What problem could this be? Compiling the first Firmware, must be files missing

This is my first time compiling the firmware. It is under ubuntu16.04.

I have succeeded all steps before “Snapdragon Flight section” in this page Ubuntu/Debian Linux · PX4 Developer Guide, I didn’t use the automatic sh files, instead I input each command manually and watch its results.
I have successfully run “make posix jmavsim” and see the simulation windows and did the takeoff and land commanders.

However, when I try to go ahead and “make px4fmu-v2_default”, I got this trunk of error message:

[1/3] Linking CXX executable nuttx_px4fmu-v2_default.elf
FAILED: : && /usr/bin/arm-none-eabi-g++ -fno-common -ffunction-sections -fdata-sections -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fno-common -ffunction-sections -fdata-sections -g -fno-exceptions -fno-rtti -std=gnu++11 -fno-threadsafe-statics -DCONFIG_WCHAR_BUILTIN -D__CUSTOM_FILE_IO__ -fcheck-new -Wall -Warray-bounds -Wdisabled-optimization -Werror -Wextra -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-field-initializers -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-unused-parameter -Wunused-but-set-variable -Wformat=1 -Wdouble-promotion -Wno-missing-field-initializers -Wno-overloaded-virtual -Wreorder -fvisibility=hidden -include visibility.h -fno-strict-aliasing -fomit-frame-pointer -funsafe-math-optimizations -ffunction-sections -fdata-sections -fno-strength-reduce -fno-builtin-printf -Os -DNDEBUG -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -nodefaultlibs -nostdlib -Wl,–warn-common,–gc-sections src/firmware/nuttx/CMakeFiles/nuttx_px4fmu-v2_default.elf.dir///platforms/empty.c.obj -o nuttx_px4fmu-v2_default.elf -L/home/xu/WorkPX4/src/Firmware/build/px4fmu-v2_default/external/Install/lib -T/home/xu/WorkPX4/src/Firmware/build/px4fmu-v2_default/NuttX/nuttx/configs/px4fmu-v2/scripts/ld.script -Wl,-Map=/home/xu/WorkPX4/src/Firmware/build/px4fmu-v2_default/nuttx_px4fmu-v2_default.map -Wl,–warn-common -Wl,–gc-sections -Wl,–start-group msg/libuorb_msgs.a src/drivers/airspeed/libdrivers__airspeed.a src/drivers/boards/common/libboards_common.a src/drivers/boards/common/stm32/libboard_stm32.a src/drivers/boards/px4fmu-v2/libdrivers__boards__px4fmu-v2.a src/drivers/camera_trigger/libdrivers__camera_trigger.a src/drivers/device/libdrivers__device.a src/drivers/frsky_telemetry/libdrivers__frsky_telemetry.a src/drivers/gps/libdrivers__gps.a src/drivers/hmc5883/libdrivers__hmc5883.a src/drivers/l3gd20/libdrivers__l3gd20.a src/drivers/led/libdrivers__led.a src/drivers/lis3mdl/libdrivers__lis3mdl.a src/drivers/ll40ls/libdrivers__ll40ls.a src/drivers/lsm303d/libdrivers__lsm303d.a src/drivers/mpu6000/libdrivers__mpu6000.a src/drivers/mpu9250/libdrivers__mpu9250.a src/drivers/ms4525_airspeed/libdrivers__ms4525_airspeed.a src/drivers/ms5525_airspeed/libdrivers__ms5525_airspeed.a src/drivers/ms5611/libdrivers__ms5611.a src/drivers/pwm_input/libdrivers__pwm_input.a src/drivers/pwm_out_sim/libdrivers__pwm_out_sim.a src/drivers/px4flow/libdrivers__px4flow.a src/drivers/px4fmu/libdrivers__px4fmu.a src/drivers/px4io/libdrivers__px4io.a src/drivers/rgbled/libdrivers__rgbled.a src/drivers/sdp3x_airspeed/libdrivers__sdp3x_airspeed.a src/drivers/sf0x/libdrivers__sf0x.a src/drivers/sf1xx/libdrivers__sf1xx.a src/drivers/stm32/libdrivers__stm32.a src/drivers/stm32/adc/libdrivers__stm32__adc.a src/drivers/stm32/tone_alarm/libdrivers__stm32__tone_alarm.a src/drivers/teraranger/libdrivers__teraranger.a src/drivers/vmount/libdrivers__vmount.a src/modules/sensors/libmodules__sensors.a src/systemcmds/bl_update/libsystemcmds__bl_update.a src/systemcmds/hardfault_log/libsystemcmds__hardfault_log.a src/systemcmds/mixer/libsystemcmds__mixer.a src/systemcmds/mtd/libsystemcmds__mtd.a src/systemcmds/param/libsystemcmds__param.a src/systemcmds/perf/libsystemcmds__perf.a src/systemcmds/pwm/libsystemcmds__pwm.a src/systemcmds/reboot/libsystemcmds__reboot.a src/systemcmds/top/libsystemcmds__top.a src/systemcmds/ver/libsystemcmds__ver.a src/modules/camera_feedback/libmodules__camera_feedback.a src/modules/commander/libmodules__commander.a src/modules/events/libmodules__events.a src/modules/land_detector/libmodules__land_detector.a src/modules/load_mon/libmodules__load_mon.a src/modules/mavlink/libmodules__mavlink.a src/modules/navigator/libmodules__navigator.a src/modules/ekf2/libmodules__ekf2.a src/modules/fw_att_control/libmodules__fw_att_control.a src/modules/fw_pos_control_l1/libmodules__fw_pos_control_l1.a src/modules/gnd_att_control/libmodules__gnd_att_control.a src/modules/gnd_pos_control/libmodules__gnd_pos_control.a src/modules/mc_att_control/libmodules__mc_att_control.a src/modules/mc_pos_control/libmodules__mc_pos_control.a src/modules/vtol_att_control/libmodules__vtol_att_control.a src/modules/logger/libmodules__logger.a src/modules/dataman/libmodules__dataman.a src/modules/systemlib/libmodules__systemlib.a src/modules/systemlib/param/libmodules__systemlib__param.a src/modules/uORB/libmodules__uORB.a src/lib/controllib/liblib__controllib.a src/lib/conversion/liblib__conversion.a src/lib/DriverFramework/framework/liblib__DriverFramework__framework.a src/lib/ecl/liblib__ecl.a src/lib/geo/liblib__geo.a src/lib/geo_lookup/liblib__geo_lookup.a src/lib/launchdetection/liblib__launchdetection.a src/lib/led/liblib__led.a src/lib/mathlib/liblib__mathlib.a src/lib/mathlib/math/filter/liblib__mathlib__math__filter.a src/lib/mixer/liblib__mixer.a src/lib/runway_takeoff/liblib__runway_takeoff.a src/lib/tailsitter_recovery/liblib__tailsitter_recovery.a src/lib/version/liblib__version.a src/platforms/common/libplatforms__common.a src/platforms/nuttx/libplatforms__nuttx.a src/platforms/nuttx/px4_layer/libplatforms__nuttx__px4_layer.a NuttX/apps/libapps.a NuttX/nuttx/arch/arm/src/libarch.a NuttX/nuttx/binfmt/libbinfmt.a NuttX/nuttx/binfmt/libbinfmt.a NuttX/nuttx/libc/libc.a NuttX/nuttx/configs/libconfigs.a NuttX/nuttx/libxx/libcxx.a NuttX/nuttx/drivers/libdrivers.a NuttX/nuttx/fs/libfs.a NuttX/nuttx/mm/libmm.a NuttX/nuttx/sched/libsched.a -Wl,–end-group -lm -lgcc ROMFS/libromfs.a src/lib/DriverFramework/framework/src/libdf_driver_framework.a && :
/LinuxSpace/Softwares/PX4/Development/ToolChain/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 .data' will not fit in region flash’
/LinuxSpace/Softwares/PX4/Development/ToolChain/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 1797 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Makefile:153: recipe for target ‘px4fmu-v2_default’ failed
make: *** [px4fmu-v2_default] Error 1

I don’t know what is this, and where this error comes from? any dependency or toolchain problems?
could any one help me out?

try “make px4fmu-v4_default”

1 Like

thanks for your reply, i am not near the computer right now, i will try it asap. but i tried “make px4mu_v3_default”, the message is similar.

Yes you are out of flash memory on v2 and apparently v3 if you got the same message. Here is some more info

1 Like

Thanks, Carl, Looks like it went through, however, it didn’t show up the 100% finished message as shown in https://dev.px4.io/en/setup/building_px4.html

it shows this:

– Build Type: MinSizeRel
– PX4 VERSION: v1.7.0-rc3-76-g324c515
– CONFIG: nuttx_px4fmu-v4_default
– Build Type: MinSizeRel
– The ASM compiler identification is GNU
– Found assembler: /LinuxSpace/Softwares/PX4/Development/ToolChain/gcc-arm-none-eabi-5_4-2016q2/bin/arm-none-eabi-gcc
– Found PythonInterp: /usr/bin/python (found version “2.7.12”)
– Found PY_jinja2: /usr/local/lib/python2.7/dist-packages/jinja2
– C compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
– C++ compiler: arm-none-eabi-g++ (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
– Using C++03
– Release build type: MinSizeRel
– Adding UAVCAN STM32 platform driver
– NuttX: px4fmu-v4 nsh cortex-m4
– ROMFS: px4fmu_common
– Configuring done
– Generating done
– Build files have been written to: /home/xu/WorkPX4/src/Firmware/build/px4fmu-v4_default
[897/897] Creating /home/xu/WorkPX4/sr…x4fmu-v4_default/px4fmu-v4_default.px4

Is this a success? If it is I actually have another question, I only have Pixhawk 2 board, could I load V4 firmware into it? Or Is there anyway, I can set a constraint to the flash memory when compiling, so that the v2 and v3 can also be compiled?

Yes it is a success. No you can not flash v4 onto it. Try to remove things you don’t need from the makefile

1 Like

so the socalled “remove modules” is to remove things from makefile?
The other thing, if I am a px4 developer, does that mean I cannot use a normal version of Qgroundcontrol? Can I install the QGroundControl stable version normally, while load my newly compiled firmware from QGC and load it to a plane? and I cannot find the related documentations, could you help me out? Thank you very much!

yes

Not sure what you mean here. If you develop code it is usually easier to flash the firmware without QGC directly using e.g. “make px4fmu-v2_default upload”. Then when testing you can use standard QGC, or the daily build if you need something that is not in stable yet. Regarding the documentation, if something is missing from the dev guide please raise an issue on the repo

1 Like

I met the same problem recently and I have changed the MEMORY-flahs(rx)-LENGTH in./platforms/nuttx/nuttx-configs/px4fmu-v2/scripts/ld.script . it’s working now.


you can also check this blog for more details. And here is the result.