Problem With Pixhawk1 Firmware Build

Hello all, for some reason, make px4fmu-v2_default has completely stopped working today. It has been working fine for the past few weeks, but now it triggers an error when linking CXX executable nuttx_px4fmu-v2_default.elf. The full error output is below:

[157/157] Linking CXX executable nuttx_px4io-v2_default.elf

[617/619] Linking CXX executable nuttx_px4fmu-v2_default.elf
FAILED: nuttx_px4fmu-v2_default.elf
: && /usr/local/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-implicit-fallthrough -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 platforms/nuttx/CMakeFiles/nuttx_px4fmu-v2_default.elf.dir///src/platforms/empty.c.obj -o nuttx_px4fmu-v2_default.elf -L/Users/chaseparsons/Firmware/build/px4fmu-v2_default/external/Install/lib -Wl,–script=/Users/chaseparsons/Firmware/build/px4fmu-v2_default/NuttX/nuttx/configs/px4fmu-v2/scripts/ld.script -Wl,-Map=nuttx_px4fmu-v2_default.map -Wl,–warn-common,–gc-sections -Wl,–start-group msg/libuorb_msgs.a src/platforms/common/libplatforms__common.a src/drivers/differential_pressure/ets/libdrivers__ets_airspeed.a src/drivers/differential_pressure/ms4525/libdrivers__ms4525_airspeed.a src/drivers/differential_pressure/ms5525/libdrivers__ms5525_airspeed.a src/drivers/differential_pressure/sdp3x/libdrivers__sdp3x_airspeed.a src/drivers/airspeed/libdrivers__airspeed.a src/drivers/barometer/ms5611/libdrivers__ms5611.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/gps/libdrivers__gps.a src/drivers/imu/l3gd20/libdrivers__l3gd20.a src/drivers/led/libdrivers__led.a src/drivers/imu/lsm303d/libdrivers__lsm303d.a src/drivers/magnetometer/hmc5883/libdrivers__hmc5883.a src/drivers/magnetometer/lis3mdl/libdrivers__lis3mdl.a src/drivers/imu/mpu6000/libdrivers__mpu6000.a src/drivers/imu/mpu9250/libdrivers__mpu9250.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/stm32/libdrivers__stm32.a src/drivers/stm32/adc/libdrivers__stm32__adc.a src/drivers/stm32/tone_alarm/libdrivers__stm32__tone_alarm.a src/drivers/vmount/libdrivers__vmount.a src/drivers/distance_sensor/ll40ls/libdrivers__ll40ls.a src/drivers/distance_sensor/mb12xx/libdrivers__mb12xx.a src/drivers/distance_sensor/sf0x/libdrivers__sf0x.a src/drivers/distance_sensor/sf1xx/libdrivers__sf1xx.a src/drivers/distance_sensor/srf02/libdrivers__srf02.a src/drivers/distance_sensor/srf02_i2c/libdrivers__srf02_i2c.a src/drivers/distance_sensor/teraranger/libdrivers__teraranger.a src/drivers/distance_sensor/tfmini/libdrivers__tfmini.a src/drivers/distance_sensor/ulanding/libdrivers__ulanding.a src/modules/sensors/libmodules__sensors.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/tune_control/libsystemcmds__tune_control.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/launchdetection/liblaunchdetection.a src/modules/fw_pos_control_l1/runway_takeoff/librunway_takeoff.a src/modules/fw_pos_control_l1/libmodules__fw_pos_control_l1.a src/modules/mc_att_control/tailsitter_recovery/libtailsitter_recovery.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/led/liblib__led.a src/lib/mathlib/liblib__mathlib.a src/lib/mixer/liblib__mixer.a src/lib/tunes/liblib__tunes.a src/lib/version/liblib__version.a platforms/nuttx/src/px4_layer/libplatform_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 && :
/usr/local/Cellar/gcc-arm-none-eabi/20160928/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 regionflash’
/usr/local/Cellar/gcc-arm-none-eabi/20160928/bin/…/lib/gcc/arm-none-eabi/5.4.1/…/…/…/…/arm-none-eabi/bin/ld: region `flash’ overflowed by 2941 bytes
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make: *** [px4fmu-v2_default] Error 1

When I build the v3 with make px4fmu-v3_default, it works perfectly fine, but v2 no longer works. I have tried using a distclean, I am running ninja, and I have tried reinstalling homebrew and going through all the dev environment steps, all to no avail. I have run out of ideas to try.

If it helps, jMAVSim has also broken today, after properly working previously. It says it build successfully, but throws exceptions, fails to import parameters, and will not open the application. Full error:


| ___ \ \ \ / / / |
| |/ / \ V / / /| |
| __/ / \ / /
| |
| | / /^\ \ ___ |
_| / / |_/

px4 starting.

ERROR [modules__systemlib__param] decoder init failed
ERROR [modules__systemlib__param] BSON error decoding parameters
ERROR [param] importing from ‘rootfs/eeprom/parameters’ failed (-1)
Command ‘param’ failed, returned 1
INFO [dataman] Unknown restart, data manager file ‘rootfs/fs/microsd/dataman’ size is 11405132 bytes
BAT_N_CELLS: curr: 0 -> new: 3
CAL_ACC0_ID: curr: 0 -> new: 1376264
CAL_ACC0_XOFF: curr: 0.0000 -> new: 0.0100
CAL_ACC0_XSCALE: curr: 1.0000 -> new: 1.0100
CAL_ACC0_YOFF: curr: 0.0000 -> new: -0.0100
CAL_ACC0_YSCALE: curr: 1.0000 -> new: 1.0100
CAL_ACC0_ZOFF: curr: 0.0000 -> new: 0.0100
CAL_ACC0_ZSCALE: curr: 1.0000 -> new: 1.0100
CAL_ACC1_ID: curr: 0 -> new: 1310728
CAL_ACC1_XOFF: curr: 0.0000 -> new: 0.0100
CAL_GYRO0_ID: curr: 0 -> new: 2293768
CAL_GYRO0_XOFF: curr: 0.0000 -> new: 0.0100
CAL_MAG0_ID: curr: 0 -> new: 196616
CAL_MAG0_XOFF: curr: 0.0000 -> new: 0.0100
COM_DISARM_LAND: curr: 0 -> new: 3
COM_OBL_ACT: curr: 0 -> new: 2
COM_OF_LOSS_T: curr: 0.0000 -> new: 5.0000
COM_RC_IN_MODE: curr: 0 -> new: 1
EKF2_ANGERR_INIT: curr: 0.1000 -> new: 0.0100
EKF2_GBIAS_INIT: curr: 0.1000 -> new: 0.0100
EKF2_MAG_TYPE: curr: 0 -> new: 1
MC_PITCH_P: curr: 6.5000 -> new: 6.0000
MC_PITCHRATE_P: curr: 0.1500 -> new: 0.2000
MC_ROLL_P: curr: 6.5000 -> new: 6.0000
MC_ROLLRATE_P: curr: 0.1500 -> new: 0.2000
MPC_HOLD_MAX_Z: curr: 0.6000 -> new: 2.0000
MPC_Z_VEL_I: curr: 0.0200 -> new: 0.1500
MPC_Z_VEL_P: curr: 0.2000 -> new: 0.6000
NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000
NAV_DLL_ACT: curr: 0 -> new: 2
RTL_DESCEND_ALT: curr: 30.0000 -> new: 5.0000
RTL_LAND_DELAY: curr: -1.0000 -> new: 5.0000
RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000
SDLOG_DIRS_MAX: curr: 0 -> new: 7
SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
SYS_AUTOSTART: curr: 0 -> new: 4010
INFO [simulator] Waiting for initial data on UDP port 14560. Please start the flight simulator to proceed…
Buildfile: /Users/chaseparsons/Firmware/Tools/jMAVSim/build.xml

make_dirs:
[mkdir] Created dir: /Users/chaseparsons/Firmware/Tools/jMAVSim/out/production/jMAVSim

compile:
[javac] Compiling 73 source files to /Users/chaseparsons/Firmware/Tools/jMAVSim/out/production/jMAVSim
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /Users/chaseparsons/Firmware/Tools/jMAVSim/src/me/drton/jmavsim/PeripherialBuzzer.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

create_run_jar:
[jar] Building jar: /Users/chaseparsons/Firmware/Tools/jMAVSim/out/production/jmavsim_run.jar

copy_res:
[copy] Copying 17 files to /Users/chaseparsons/Firmware/Tools/jMAVSim/out/production

BUILD SUCCESSFUL
Total time: 4 seconds
Exception in thread “main” java.lang.NoClassDefFoundError: javax/vecmath/Tuple3d
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Caused by: java.lang.ClassNotFoundException: javax.vecmath.Tuple3d
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
… 3 more
Exception in thread “main” java.lang.NoClassDefFoundError: javax/vecmath/Tuple3d
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Caused by: java.lang.ClassNotFoundException: javax.vecmath.Tuple3d
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
… 3 more

If anyone could help, I would greatly appreciate it. Also, I am on Mac OSX.

The code is overflowing the 1MB of flash useable on px4fmu-v2. You will need to remove something from the build to make room. IIRC that’s done here: https://github.com/PX4/Firmware/blob/master/cmake/configs/nuttx_px4fmu-v2_default.cmake

That worked, thank you!

Do you have any idea why I was previously able to build the v2 file without commenting out anything extra a few days ago, but after I did a distclean yesterday, it could not no longer build properly? That seems very strange to me.

A switch to GCC 7-2017-q4 has been made. You can find the updated toolchain installation in the dev guide.