Unable to build standard make targets

From the px4/Firmware directory, I have run
cmake .

Then, I try to run make eagle_default followed by make eagle_default upload. However, the eagle_default target is not available. I have previously cloned the PX4/Firmware repository and have run
git submodule update --init --recursive

Why is this target not available?

What branch of px4/Firmware are you using? Can you provide the error text when you run cmake?

I am on the master branch. My remote is:
origin https://github.com/PX4/Firmware.git (fetch)
origin https://github.com/PX4/Firmware.git (push)

Output from running cmake . from Firmware directory:

-- nuttx-px4fmu-v2-default
-- Using C++03
-- Release build type: RelWithDebInfo
-- Adding UAVCAN STM32 platform driver
-- Configuring done
-- Generating done
-- Build files have been written to: blablabla/px4/Firmware

As you can see, there is no error generated.
I then attempt to run make eagle_default, for example from the Firmware directory.

I have made an extra target in my Makefile to list all of the available targets in alphabetical order. http://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile . Here is the output of make list. The output is pretty long. There is no eagle_default target, as well as many of the other standard make targets that are suggested through the tutorials on dev.px4.io.

all build_firmware_px4fmu-v2 build_firmware_px4fmu-v2/fast check_format check_format/fast check_weak check_weak/fast clean clean/fast cmake_check_build_system cmake_force collect_extras collect_extras/fast config config/fast debug debug_ddd debug_ddd/fast debug/fast debug_io debug_io_ddd debug_io_ddd/fast debug_io/fast debug_io_tui debug_io_tui/fast debug_tui debug_tui/fast default_target depend df_driver_framework df_driver_framework/fast drivers__airspeed drivers__airspeed/fast drivers__blinkm drivers__blinkm/fast drivers__boards__px4fmu-v2 drivers__boards__px4fmu-v2/fast drivers__bst drivers__bst/fast drivers__camera_trigger drivers__camera_trigger/fast drivers__device drivers__device/fast drivers__ets_airspeed drivers__ets_airspeed/fast drivers__frsky_telemetry drivers__frsky_telemetry/fast drivers__gimbal drivers__gimbal/fast drivers__gps drivers__gps/fast drivers__hmc5883 drivers__hmc5883/fast drivers__l3gd20 drivers__l3gd20/fast drivers__led drivers__led/fast drivers__lis3mdl drivers__lis3mdl/fast drivers__ll40ls drivers__ll40ls/fast drivers__lsm303d drivers__lsm303d/fast drivers__meas_airspeed drivers__meas_airspeed/fast drivers__mpu6000 drivers__mpu6000/fast drivers__mpu9250 drivers__mpu9250/fast drivers__ms5611 drivers__ms5611/fast drivers__pwm_input drivers__pwm_input/fast drivers__pwm_out_sim drivers__pwm_out_sim/fast drivers__px4flow drivers__px4flow/fast drivers__px4fmu drivers__px4fmu/fast drivers__px4io drivers__px4io/fast drivers__rgbled drivers__rgbled/fast drivers__sf0x drivers__sf0x/fast drivers__snapdragon_rc_pwm drivers__snapdragon_rc_pwm/fast drivers__srf02 drivers__srf02/fast drivers__stm32 drivers__stm32__adc drivers__stm32__adc/fast drivers__stm32/fast drivers__stm32__tone_alarm drivers__stm32__tone_alarm/fast drivers__trone drivers__trone/fast edit_cache edit_cache/fast firmware_nuttx firmware_nuttx/fast fw_io fw_io/fast git_cmake_hexagon git_cmake_hexagon/fast git_driverframework git_driverframework/fast git_ecl git_ecl/fast git_gazebo git_gazebo/fast git_gencpp git_gencpp/fast git_genmsg git_genmsg/fast git_gtest git_gtest/fast git_jmavsim git_jmavsim/fast git_matrix git_matrix/fast git_mavlink git_mavlink/fast git_nuttx git_nuttx/fast git_uavcan git_uavcan/fast help install install/fast install/local install/local/fast install/strip install/strip/fast io_prebuild_targets io_prebuild_targets/fast lib__controllib lib__controllib/fast lib__conversion lib__conversion/fast lib__ecl lib__ecl/fast lib__external_lgpl lib__external_lgpl/fast lib__geo lib__geo/fast lib__geo_lookup lib__geo_lookup/fast lib__launchdetection lib__launchdetection/fast lib__mathlib lib__mathlib/fast lib__mathlib__math__filter lib__mathlib__math__filter/fast lib__runway_takeoff lib__runway_takeoff/fast lib__tailsitter_recovery lib__tailsitter_recovery/fast lib__terrain_estimation lib__terrain_estimation/fast libuavcan_dsdlc libuavcan_dsdlc/fast list_install_components list_install_components/fast mixer_gen mixer_gen/fast modules__attitude_estimator_q modules__attitude_estimator_q/fast modules__commander modules__commander/fast modules__dataman modules__dataman/fast modules__ekf_att_pos_estimator modules__ekf_att_pos_estimator/fast modules__fw_att_control modules__fw_att_control/fast modules__fw_pos_control_l1 modules__fw_pos_control_l1/fast modules__gpio_led modules__gpio_led/fast modules__land_detector modules__land_detector/fast modules__local_position_estimator modules__local_position_estimator/fast modules__mavlink modules__mavlink/fast modules__mc_att_control modules__mc_att_control/fast modules__mc_pos_control modules__mc_pos_control/fast modules__navigator modules__navigator/fast modules__param modules__param/fast modules__position_estimator_inav modules__position_estimator_inav/fast modules__sdlog2 modules__sdlog2/fast modules__sensors modules__sensors/fast modules__systemlib modules__systemlib/fast modules__systemlib__mixer modules__systemlib__mixer/fast modules__uavcan modules__uavcan/fast modules__uORB modules__uORB/fast modules__vtol_att_control modules__vtol_att_control/fast msg_gen msg_gen/fast nuttx_export_px4fmu-v2 nuttx_export_px4fmu-v2/fast nuttx_export_px4io-v2 nuttx_export_px4io-v2/fast package package/fast package_source package_source/fast platforms__common platforms__common/fast platforms__nuttx platforms__nuttx/fast platforms__nuttx__px4_layer platforms__nuttx__px4_layer/fast prebuild_targets prebuild_targets/fast preinstall preinstall/fast px4io-v2 px4io-v2/fast rebuild_cache rebuild_cache/fast romfs romfs/fast sercon sercon/fast serdis serdis/fast submodule_clean submodule_clean/fast systemcmds__bl_update systemcmds__bl_update/fast systemcmds__config systemcmds__config/fast systemcmds__dumpfile systemcmds__dumpfile/fast systemcmds__esc_calib systemcmds__esc_calib/fast systemcmds__mixer systemcmds__mixer/fast systemcmds__mtd systemcmds__mtd/fast systemcmds__nshterm systemcmds__nshterm/fast systemcmds__param systemcmds__param/fast systemcmds__perf systemcmds__perf/fast systemcmds__pwm systemcmds__pwm/fast systemcmds__reboot systemcmds__reboot/fast systemcmds__top systemcmds__top/fast systemcmds__ver systemcmds__ver/fast test test/fast uavcan uavcan/fast uavcan_stm32_driver uavcan_stm32_driver/fast upload upload/fast xml_gen xml_gen/fast

It looks like you have the wrong idea to me. Those “targets” are all the modules, libraries, drivers, etc. (basically features) which get built by cmake, compiled from all the CMakeLists.txt files in firmware/src/. Those aren’t the build targets you are looking for.

What you mean by “targets” I think are actually cmake config files, and are found in firmware/cmake/configs/

There is a separate cmake file for each “target” (config). The eagle configs are located there with the rest

The proper way to build eagle_default would be to execute in the root firmware directory $make eagle_default or, if you are using posix, specifically, $make posix_eagle_default.

Look at the MakeFile, starting at line 146, and you will see where make will call the correct cmake config.

I don’t think that the targets listed are compiled. CMake should generate a Makefile after I run cmake ., which lists all of the above targets as available targets for compilation. Those targets are the targets that are defined in the generated Makefile.

CMake should be able to generate a Makefile that works on all platforms for cross-compilation, so long as the Toolchain file is well-defined. So the call to make target should not be different for POSIX or Windows. Perhaps it is in this case.

I have, from the Firmware/ directory, attempted to run make eagle_default. I attempt to run cmake . to generate a new Makefile, but this does not generate a Makefile with the correct targets as defined on dev.px4.io.

My problem was that I ran cmake . from the Firmware/ directory before attempting to run make target. This generated a new Makefile in the Firmware/ directory with available targets defined in some CMake file or another. I’m not sure how that works actually. How can I run cmake to generate an updated Makefile if I need to?

The MakeFile already exists for all the configs / targets and you can see it in the repository.

I don’t know why you would need to generate a new Makefile using cmake. It doesn’t seem like the toolchain is set up to work that way.


If you called $cmake . in the firmware directory, then you would have overwritten the Makefile from the github repository (the one that has the correct targets defined).

Try this
$git checkout origin/<your firmware version> Makefile $make <target>

That will get you the correct Makefile and then you can try to build the target again.

The documentation for Building the Code might help you.

Ok, thank you. How can I add programs to the build process so that I may push them to my board?

I highly recommend you read through the Developer Documentation if you plan to develop software for the PX4 flight stack.

In particular, there is this section on Writing an Application that will introduce you creating your own programs and processes.

Also I recommend you familiarize yourself with the various example projects which already exist in the source.

Once you have created your programs, you will have to determine how to add them to the target config, and how to execute them. As far as I understand, this is platform dependent. I have only developed for px4fmu+nuttx, so I can’t help you there.

Good luck!