PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.48k stars 13.51k forks source link

Make px4fmu-v2_default #8837

Closed ismatouu closed 6 years ago

ismatouu commented 6 years ago

Hello, Any help is appreciated [1/3] Linking CXX executable nuttx_px4fmu-v2_default.elf FAILED: : && /home/ismat/gcc-arm-none-eabi-5_4-2016q2/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 -DCUSTOM_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/home/ismat/Firmware/build/px4fmu-v2_default/external/Install/lib -Wl,--script=/home/ismat/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/libplatformscommon.a src/drivers/differential_pressure/ets/libdriversets_airspeed.a src/drivers/differential_pressure/ms4525/libdriversms4525_airspeed.a src/drivers/differential_pressure/ms5525/libdriversms5525_airspeed.a src/drivers/differential_pressure/sdp3x/libdriverssdp3x_airspeed.a src/drivers/distance_sensor/ll40ls/libdrivers__ll40ls.a src/drivers/distance_sensor/mb12xx/libdriversmb12xx.a src/drivers/distance_sensor/sf0x/libdriverssf0x.a src/drivers/distance_sensor/sf1xx/libdrivers__sf1xx.a src/drivers/distance_sensor/srf02/libdriverssrf02.a src/drivers/distance_sensor/srf02_i2c/libdriverssrf02_i2c.a src/drivers/distance_sensor/teraranger/libdriversteraranger.a src/drivers/distance_sensor/tfmini/libdriverstfmini.a src/drivers/distance_sensor/ulanding/libdriversulanding.a src/drivers/airspeed/libdriversairspeed.a src/drivers/barometer/ms5611/libdriversms5611.a src/drivers/boards/common/libboards_common.a src/drivers/boards/common/stm32/libboard_stm32.a src/drivers/boards/px4fmu-v2/libdriversboards__px4fmu-v2.a src/drivers/camera_trigger/libdriverscamera_trigger.a src/drivers/device/libdriversdevice.a src/drivers/gps/libdriversgps.a src/drivers/l3gd20/libdriversl3gd20.a src/drivers/led/libdriversled.a src/drivers/lsm303d/libdriverslsm303d.a src/drivers/magnetometer/hmc5883/libdrivershmc5883.a src/drivers/magnetometer/lis3mdl/libdriverslis3mdl.a src/drivers/mpu6000/libdriversmpu6000.a src/drivers/mpu9250/libdriversmpu9250.a src/drivers/pwm_input/libdrivers__pwm_input.a src/drivers/pwm_out_sim/libdriverspwm_out_sim.a src/drivers/px4flow/libdriverspx4flow.a src/drivers/px4fmu/libdriverspx4fmu.a src/drivers/px4io/libdriverspx4io.a src/drivers/rgbled/libdriversrgbled.a src/drivers/stm32/libdriversstm32.a src/drivers/stm32/adc/libdriversstm32adc.a src/drivers/stm32/tone_alarm/libdriversstm32tone_alarm.a src/drivers/vmount/libdriversvmount.a src/modules/sensors/libmodulessensors.a src/systemcmds/hardfault_log/libsystemcmds__hardfault_log.a src/systemcmds/mixer/libsystemcmdsmixer.a src/systemcmds/mtd/libsystemcmdsmtd.a src/systemcmds/param/libsystemcmdsparam.a src/systemcmds/perf/libsystemcmdsperf.a src/systemcmds/pwm/libsystemcmdspwm.a src/systemcmds/reboot/libsystemcmdsreboot.a src/systemcmds/top/libsystemcmdstop.a src/systemcmds/tune_control/libsystemcmdstune_control.a src/systemcmds/ver/libsystemcmds__ver.a src/modules/camera_feedback/libmodulescamera_feedback.a src/modules/commander/libmodulescommander.a src/modules/events/libmodulesevents.a src/modules/land_detector/libmodulesland_detector.a src/modules/load_mon/libmodulesload_mon.a src/modules/mavlink/libmodulesmavlink.a src/modules/navigator/libmodulesnavigator.a src/modules/ekf2/libmodulesekf2.a src/modules/fw_att_control/libmodulesfw_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/libmodulesfw_pos_control_l1.a src/modules/mc_att_control/tailsitter_recovery/libtailsitter_recovery.a src/modules/mc_att_control/libmodulesmc_att_control.a src/modules/mc_pos_control/libmodulesmc_pos_control.a src/modules/vtol_att_control/libmodulesvtol_att_control.a src/modules/logger/libmoduleslogger.a src/modules/dataman/libmodulesdataman.a src/modules/systemlib/libmodulessystemlib.a src/modules/systemlib/param/libmodulessystemlibparam.a src/modules/uORB/libmodulesuORB.a src/lib/controllib/liblibcontrollib.a src/lib/conversion/liblibconversion.a src/lib/DriverFramework/framework/liblibDriverFrameworkframework.a src/lib/ecl/liblibecl.a src/lib/geo/liblib__geo.a src/lib/geo_lookup/liblibgeo_lookup.a src/lib/led/liblibled.a src/lib/mathlib/liblibmathlib.a src/lib/mixer/liblibmixer.a src/lib/tunes/liblibtunes.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 && : /home/ismat/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 regionflash' /home/ismat/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 2369 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

taileron commented 6 years ago

GCC above 6.3.1 optimises the memory usage while compiling as I learned ... GCC 7.2.1 is now recommended. see #8773

ismatouu commented 6 years ago

@taileron so, the GCC 5.4 will not build the px4fmu-v2_default ..?

taileron commented 6 years ago

current master still generates an error: overflow by 3445 bytes for v2_default with GCC 5.4.1 without the GCC memory optimisation feature it needs to remove unused modules to build successful GCC 7.2.1 takes this feature reducing memory usage to fit into small flash size probably V3_default is suitable to the desired target e.g. in my PixFalcon V3_default works perfect

vuanhduy commented 6 years ago

I have just compiled the code myself and it was fine. Did you adjust something in the px4fmu-v2_default file? the reason you got that error is to have the px4 image file bigger that 1 MB. In other words, you can only install limited number of modules due to the small flash memory of your flight controller.

taileron commented 6 years ago

... exactly that´s it, but GCC 7.2.1 uses a memory optimisation feature that saves space to integrate more modules if necessary. Currently both GCC (5.4.1 or 7.2.1) can be used to compile PX4. I´m copying the desired GCC folders into a fixed system path for fast changing between the GCC versions cause I need an additional one for compiling e.g. Betaflight. All my Pixhawks now have real 2 Mb flash so I haven´t tried it anymore yet to compile V2.

taileron commented 6 years ago

with the current master it works with both GCC versions, tried it now -> solved

huangwen0907 commented 6 years ago

I have a similar problem with this

/home/hw0907/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8102214 of nuttx_px4fmu-v2_default.elf section __param' is not within regionflash' /home/hw0907/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 .ARM.exidx' will not fit in regionflash' /home/hw0907/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8102214 of nuttx_px4fmu-v2_default.elf section __param' is not within regionflash' /home/hw0907/gcc-arm-none-eabi-5_4-2016q2/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld: address 0x8102214 of nuttx_px4fmu-v2_default.elf section __param' is not within regionflash' /home/hw0907/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 12245 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

hamishwillee commented 6 years ago

This error means that the flash is too big (>1MB). As of this morning the build worked fine IFF you use the supported compiler. However as the firmware is so close to the limit, it may break again "somewhat randomly".

The issue is documented in the building section for this target: https://dev.px4.io/en/setup/building_px4.html#building_nuttx

I am therefore closing.