diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Makefile | 263 | ||||
-rw-r--r-- | ROMFS/.gitignore | 1 | ||||
-rw-r--r-- | ROMFS/Makefile | 123 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.FMU_quad_x (renamed from ROMFS/scripts/rc.FMU_quad_x) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.PX4IO (renamed from ROMFS/scripts/rc.PX4IO) | 2 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.PX4IOAR (renamed from ROMFS/scripts/rc.PX4IOAR) | 2 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.boarddetect (renamed from ROMFS/scripts/rc.boarddetect) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.hil (renamed from ROMFS/scripts/rc.hil) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.jig (renamed from ROMFS/scripts/rc.jig) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.logging (renamed from ROMFS/scripts/rc.logging) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.sensors (renamed from ROMFS/scripts/rc.sensors) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.standalone (renamed from ROMFS/scripts/rc.standalone) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/init.d/rc.usb (renamed from ROMFS/scripts/rc.usb) | 0 | ||||
-rwxr-xr-x | ROMFS/px4fmu_common/init.d/rcS (renamed from ROMFS/scripts/rcS) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/logging/logconv.m (renamed from ROMFS/logging/logconv.m) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_AERT.mix (renamed from ROMFS/mixers/FMU_AERT.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_AET.mix (renamed from ROMFS/mixers/FMU_AET.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_Q.mix (renamed from ROMFS/mixers/FMU_Q.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_RET.mix (renamed from ROMFS/mixers/FMU_RET.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_X5.mix (renamed from ROMFS/mixers/FMU_X5.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_delta.mix | 50 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_hex_+.mix (renamed from ROMFS/mixers/FMU_hex_+.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_hex_x.mix (renamed from ROMFS/mixers/FMU_hex_x.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_octo_+.mix (renamed from ROMFS/mixers/FMU_octo_+.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_octo_x.mix (renamed from ROMFS/mixers/FMU_octo_x.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_pass.mix (renamed from ROMFS/mixers/FMU_pass.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_quad_+.mix (renamed from ROMFS/mixers/FMU_quad_+.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_quad_v.mix (renamed from ROMFS/mixers/FMU_quad_v.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/FMU_quad_x.mix (renamed from ROMFS/mixers/FMU_quad_x.mix) | 0 | ||||
-rw-r--r-- | ROMFS/px4fmu_common/mixers/README (renamed from ROMFS/mixers/README) | 0 | ||||
-rwxr-xr-x | Tools/px_uploader.py | 679 | ||||
-rw-r--r-- | apps/drivers/boards/px4fmu/Makefile | 41 | ||||
-rw-r--r-- | apps/drivers/l3gd20/Makefile | 42 | ||||
-rw-r--r-- | apps/drivers/mpu6000/Makefile | 42 | ||||
-rw-r--r-- | apps/mavlink/.context | 0 | ||||
-rw-r--r-- | apps/mavlink/Makefile | 44 | ||||
-rw-r--r-- | apps/mavlink_onboard/Makefile | 44 | ||||
-rw-r--r-- | apps/px4/tests/.context | 0 | ||||
-rw-r--r-- | apps/sensors/.context | 0 | ||||
-rw-r--r-- | apps/system/i2c/Makefile | 2 | ||||
-rw-r--r-- | apps/systemcmds/boardinfo/.context | 0 | ||||
-rw-r--r-- | apps/systemcmds/calibration/Makefile | 44 | ||||
-rwxr-xr-x | apps/systemcmds/calibration/calibration.c | 147 | ||||
-rwxr-xr-x | apps/systemcmds/calibration/channels_cal.c | 196 | ||||
-rwxr-xr-x | apps/systemcmds/calibration/range_cal.c | 224 | ||||
-rw-r--r-- | apps/systemcmds/calibration/servo_cal.c | 264 | ||||
-rw-r--r-- | apps/systemcmds/delay_test/delay_test.c | 160 | ||||
-rw-r--r-- | apps/systemcmds/eeprom/Makefile | 44 | ||||
-rw-r--r-- | apps/systemcmds/perf/.context | 0 | ||||
-rw-r--r-- | apps/systemcmds/preflight_check/Makefile | 44 | ||||
-rw-r--r-- | apps/systemcmds/reboot/.context | 0 | ||||
-rw-r--r-- | apps/systemcmds/top/.context | 0 | ||||
-rw-r--r-- | apps/systemcmds/top/Makefile | 44 | ||||
-rw-r--r-- | apps/systemlib/Makefile | 14 | ||||
-rw-r--r-- | makefiles/board_px4fmu.mk | 10 | ||||
-rw-r--r-- | makefiles/board_px4io.mk | 10 | ||||
-rw-r--r-- | makefiles/config_px4fmu_default.mk | 88 | ||||
-rw-r--r-- | makefiles/config_px4io_default.mk | 5 | ||||
-rw-r--r-- | makefiles/firmware.mk | 443 | ||||
-rw-r--r-- | makefiles/module.mk | 230 | ||||
-rw-r--r-- | makefiles/nuttx.mk (renamed from apps/hott_telemetry/Makefile) | 51 | ||||
-rw-r--r-- | makefiles/setup.mk | 91 | ||||
-rw-r--r-- | makefiles/toolchain_gnu-arm-eabi.mk | 265 | ||||
-rw-r--r-- | makefiles/upload.mk | 41 | ||||
-rwxr-xr-x | nuttx/configs/px4fmu/include/board.h | 6 | ||||
-rw-r--r-- | nuttx/configs/px4fmu/include/nsh_romfsimg.h | 42 | ||||
-rw-r--r-- | nuttx/configs/px4fmu/nsh/appconfig | 8 | ||||
-rwxr-xr-x | nuttx/configs/px4fmu/nsh/defconfig | 2 | ||||
-rw-r--r-- | platforms/empty.c | 3 | ||||
-rw-r--r-- | src/drivers/ardrone_interface/ardrone_interface.c (renamed from apps/ardrone_interface/ardrone_interface.c) | 0 | ||||
-rw-r--r-- | src/drivers/ardrone_interface/ardrone_motor_control.c (renamed from apps/ardrone_interface/ardrone_motor_control.c) | 0 | ||||
-rw-r--r-- | src/drivers/ardrone_interface/ardrone_motor_control.h (renamed from apps/ardrone_interface/ardrone_motor_control.h) | 0 | ||||
-rw-r--r-- | src/drivers/ardrone_interface/module.mk | 40 | ||||
-rw-r--r-- | src/drivers/blinkm/blinkm.cpp (renamed from apps/drivers/blinkm/blinkm.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/blinkm/module.mk (renamed from apps/examples/kalman_demo/Makefile) | 8 | ||||
-rw-r--r-- | src/drivers/bma180/bma180.cpp (renamed from apps/drivers/bma180/bma180.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/bma180/module.mk (renamed from apps/drivers/bma180/Makefile) | 8 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/module.mk | 9 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_can.c (renamed from apps/drivers/boards/px4fmu/px4fmu_can.c) | 5 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_init.c (renamed from apps/drivers/boards/px4fmu/px4fmu_init.c) | 37 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_internal.h (renamed from apps/drivers/boards/px4fmu/px4fmu_internal.h) | 7 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_led.c (renamed from apps/drivers/boards/px4fmu/px4fmu_led.c) | 0 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_pwm_servo.c (renamed from apps/drivers/boards/px4fmu/px4fmu_pwm_servo.c) | 0 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_spi.c (renamed from apps/drivers/boards/px4fmu/px4fmu_spi.c) | 18 | ||||
-rw-r--r-- | src/drivers/boards/px4fmu/px4fmu_usb.c (renamed from apps/drivers/boards/px4fmu/px4fmu_usb.c) | 0 | ||||
-rw-r--r-- | src/drivers/gps/gps.cpp (renamed from apps/drivers/gps/gps.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/gps/gps_helper.cpp (renamed from apps/drivers/gps/gps_helper.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/gps/gps_helper.h (renamed from apps/drivers/gps/gps_helper.h) | 0 | ||||
-rw-r--r-- | src/drivers/gps/module.mk (renamed from apps/drivers/gps/Makefile) | 11 | ||||
-rw-r--r-- | src/drivers/gps/mtk.cpp (renamed from apps/drivers/gps/mtk.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/gps/mtk.h (renamed from apps/drivers/gps/mtk.h) | 0 | ||||
-rw-r--r-- | src/drivers/gps/ubx.cpp (renamed from apps/drivers/gps/ubx.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/gps/ubx.h (renamed from apps/drivers/gps/ubx.h) | 0 | ||||
-rw-r--r-- | src/drivers/hil/hil.cpp (renamed from apps/drivers/hil/hil.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/hil/module.mk (renamed from apps/drivers/hmc5883/Makefile) | 10 | ||||
-rw-r--r-- | src/drivers/hmc5883/hmc5883.cpp (renamed from apps/drivers/hmc5883/hmc5883.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/hmc5883/module.mk | 43 | ||||
-rw-r--r-- | src/drivers/hott_telemetry/hott_telemetry_main.c (renamed from apps/hott_telemetry/hott_telemetry_main.c) | 12 | ||||
-rw-r--r-- | src/drivers/hott_telemetry/messages.c (renamed from apps/hott_telemetry/messages.c) | 6 | ||||
-rw-r--r-- | src/drivers/hott_telemetry/messages.h (renamed from apps/hott_telemetry/messages.h) | 5 | ||||
-rw-r--r-- | src/drivers/hott_telemetry/module.mk (renamed from apps/drivers/blinkm/Makefile) | 11 | ||||
-rw-r--r-- | src/drivers/l3gd20/l3gd20.cpp (renamed from apps/drivers/l3gd20/l3gd20.cpp) | 5 | ||||
-rw-r--r-- | src/drivers/l3gd20/module.mk | 6 | ||||
-rw-r--r-- | src/drivers/mb12xx/mb12xx.cpp (renamed from apps/drivers/mb12xx/mb12xx.cpp) | 2 | ||||
-rw-r--r-- | src/drivers/mb12xx/module.mk (renamed from apps/drivers/mb12xx/Makefile) | 8 | ||||
-rw-r--r-- | src/drivers/mpu6000/module.mk (renamed from apps/systemcmds/boardinfo/Makefile) | 13 | ||||
-rw-r--r-- | src/drivers/mpu6000/mpu6000.cpp (renamed from apps/drivers/mpu6000/mpu6000.cpp) | 2 | ||||
-rw-r--r-- | src/drivers/ms5611/module.mk (renamed from apps/drivers/ms5611/Makefile) | 8 | ||||
-rw-r--r-- | src/drivers/ms5611/ms5611.cpp (renamed from apps/drivers/ms5611/ms5611.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/px4fmu/fmu.cpp (renamed from apps/drivers/px4fmu/fmu.cpp) | 0 | ||||
-rw-r--r-- | src/drivers/px4fmu/module.mk | 6 | ||||
-rw-r--r-- | src/drivers/px4io/module.mk (renamed from apps/drivers/px4io/Makefile) | 9 | ||||
-rw-r--r-- | src/drivers/px4io/px4io.cpp (renamed from apps/drivers/px4io/px4io.cpp) | 2 | ||||
-rw-r--r-- | src/drivers/px4io/uploader.cpp (renamed from apps/drivers/px4io/uploader.cpp) | 5 | ||||
-rw-r--r-- | src/drivers/px4io/uploader.h (renamed from apps/drivers/px4io/uploader.h) | 5 | ||||
-rw-r--r-- | src/include/mavlink/mavlink_log.h (renamed from apps/mavlink/mavlink_log.h) | 0 | ||||
-rw-r--r-- | src/include/visibility.h (renamed from apps/systemcmds/calibration/calibration.h) | 48 | ||||
-rw-r--r-- | src/modules/att_pos_estimator_ekf/KalmanNav.cpp (renamed from apps/examples/kalman_demo/KalmanNav.cpp) | 0 | ||||
-rw-r--r-- | src/modules/att_pos_estimator_ekf/KalmanNav.hpp (renamed from apps/examples/kalman_demo/KalmanNav.hpp) | 0 | ||||
-rw-r--r-- | src/modules/att_pos_estimator_ekf/kalman_main.cpp (renamed from apps/examples/kalman_demo/kalman_demo.cpp) | 4 | ||||
-rw-r--r-- | src/modules/att_pos_estimator_ekf/module.mk (renamed from apps/drivers/px4fmu/Makefile) | 15 | ||||
-rw-r--r-- | src/modules/att_pos_estimator_ekf/params.c (renamed from apps/examples/kalman_demo/params.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp (renamed from apps/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp) | 1 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c (renamed from apps/attitude_estimator_ekf/attitude_estimator_ekf_params.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.h (renamed from apps/attitude_estimator_ekf/attitude_estimator_ekf_params.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h (renamed from apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/cross.c (renamed from apps/attitude_estimator_ekf/codegen/cross.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/cross.h (renamed from apps/attitude_estimator_ekf/codegen/cross.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/eye.c (renamed from apps/attitude_estimator_ekf/codegen/eye.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/eye.h (renamed from apps/attitude_estimator_ekf/codegen/eye.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/mrdivide.c (renamed from apps/attitude_estimator_ekf/codegen/mrdivide.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/mrdivide.h (renamed from apps/attitude_estimator_ekf/codegen/mrdivide.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/norm.c (renamed from apps/attitude_estimator_ekf/codegen/norm.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/norm.h (renamed from apps/attitude_estimator_ekf/codegen/norm.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rdivide.c (renamed from apps/attitude_estimator_ekf/codegen/rdivide.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rdivide.h (renamed from apps/attitude_estimator_ekf/codegen/rdivide.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rtGetInf.c (renamed from apps/attitude_estimator_ekf/codegen/rtGetInf.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rtGetInf.h (renamed from apps/attitude_estimator_ekf/codegen/rtGetInf.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rtGetNaN.c (renamed from apps/attitude_estimator_ekf/codegen/rtGetNaN.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rtGetNaN.h (renamed from apps/attitude_estimator_ekf/codegen/rtGetNaN.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rt_defines.h (renamed from apps/attitude_estimator_ekf/codegen/rt_defines.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.c (renamed from apps/attitude_estimator_ekf/codegen/rt_nonfinite.c) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.h (renamed from apps/attitude_estimator_ekf/codegen/rt_nonfinite.h) | 0 | ||||
-rwxr-xr-x | src/modules/attitude_estimator_ekf/codegen/rtwtypes.h (renamed from apps/attitude_estimator_ekf/codegen/rtwtypes.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/modules/attitude_estimator_ekf/module.mk (renamed from apps/attitude_estimator_ekf/Makefile) | 21 | ||||
-rw-r--r-- | src/modules/commander/calibration_routines.c (renamed from apps/commander/calibration_routines.c) | 0 | ||||
-rw-r--r-- | src/modules/commander/calibration_routines.h (renamed from apps/commander/calibration_routines.h) | 0 | ||||
-rw-r--r-- | src/modules/commander/commander.c (renamed from apps/commander/commander.c) | 0 | ||||
-rw-r--r-- | src/modules/commander/commander.h (renamed from apps/commander/commander.h) | 0 | ||||
-rw-r--r-- | src/modules/commander/module.mk (renamed from apps/drivers/hil/Makefile) | 13 | ||||
-rw-r--r-- | src/modules/commander/state_machine_helper.c (renamed from apps/commander/state_machine_helper.c) | 0 | ||||
-rw-r--r-- | src/modules/commander/state_machine_helper.h (renamed from apps/commander/state_machine_helper.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/.gitignore (renamed from apps/mavlink/.gitignore) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink.c (renamed from apps/mavlink/mavlink.c) | 2 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_bridge_header.h (renamed from apps/mavlink/mavlink_bridge_header.h) | 2 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_hil.h (renamed from apps/mavlink/mavlink_hil.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_log.c (renamed from apps/mavlink/mavlink_log.c) | 2 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_parameters.c (renamed from apps/mavlink/mavlink_parameters.c) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_parameters.h (renamed from apps/mavlink/mavlink_parameters.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.c (renamed from apps/mavlink/mavlink_receiver.c) | 4 | ||||
-rw-r--r-- | src/modules/mavlink/missionlib.c (renamed from apps/mavlink/missionlib.c) | 2 | ||||
-rw-r--r-- | src/modules/mavlink/missionlib.h (renamed from apps/mavlink/missionlib.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/module.mk (renamed from apps/ardrone_interface/Makefile) | 17 | ||||
-rw-r--r-- | src/modules/mavlink/orb_listener.c (renamed from apps/mavlink/orb_listener.c) | 3 | ||||
-rw-r--r-- | src/modules/mavlink/orb_topics.h (renamed from apps/mavlink/orb_topics.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/util.h (renamed from apps/mavlink/util.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/waypoints.c (renamed from apps/mavlink/waypoints.c) | 0 | ||||
-rw-r--r-- | src/modules/mavlink/waypoints.h (renamed from apps/mavlink/waypoints.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/mavlink.c (renamed from apps/mavlink_onboard/mavlink.c) | 0 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/mavlink_bridge_header.h (renamed from apps/mavlink_onboard/mavlink_bridge_header.h) | 2 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/mavlink_receiver.c (renamed from apps/mavlink_onboard/mavlink_receiver.c) | 0 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/module.mk (renamed from apps/commander/Makefile) | 15 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/orb_topics.h (renamed from apps/mavlink_onboard/orb_topics.h) | 0 | ||||
-rw-r--r-- | src/modules/mavlink_onboard/util.h (renamed from apps/mavlink_onboard/util.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe1_types.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe1_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe2_types.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe2_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_data.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_data.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.c (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/kalman_dlqe3_types.h (renamed from apps/position_estimator_mc/codegen/kalman_dlqe3_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_types.h (renamed from apps/position_estimator_mc/codegen/positionKalmanFilter1D_types.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/randn.c (renamed from apps/position_estimator_mc/codegen/randn.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/randn.h (renamed from apps/position_estimator_mc/codegen/randn.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rtGetInf.c (renamed from apps/position_estimator_mc/codegen/rtGetInf.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rtGetInf.h (renamed from apps/position_estimator_mc/codegen/rtGetInf.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rtGetNaN.c (renamed from apps/position_estimator_mc/codegen/rtGetNaN.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rtGetNaN.h (renamed from apps/position_estimator_mc/codegen/rtGetNaN.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rt_nonfinite.c (renamed from apps/position_estimator_mc/codegen/rt_nonfinite.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rt_nonfinite.h (renamed from apps/position_estimator_mc/codegen/rt_nonfinite.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/codegen/rtwtypes.h (renamed from apps/position_estimator_mc/codegen/rtwtypes.h) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/kalman_dlqe1.m (renamed from apps/position_estimator_mc/kalman_dlqe1.m) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/kalman_dlqe2.m (renamed from apps/position_estimator_mc/kalman_dlqe2.m) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/kalman_dlqe3.m (renamed from apps/position_estimator_mc/kalman_dlqe3.m) | 0 | ||||
-rw-r--r-- | src/modules/position_estimator_mc/module.mk (renamed from apps/position_estimator_mc/Makefile) | 10 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/positionKalmanFilter1D.m (renamed from apps/position_estimator_mc/positionKalmanFilter1D.m) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/positionKalmanFilter1D_dT.m (renamed from apps/position_estimator_mc/positionKalmanFilter1D_dT.m) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/position_estimator_mc_main.c (renamed from apps/position_estimator_mc/position_estimator_mc_main.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/position_estimator_mc_params.c (renamed from apps/position_estimator_mc/position_estimator_mc_params.c) | 0 | ||||
-rwxr-xr-x | src/modules/position_estimator_mc/position_estimator_mc_params.h (renamed from apps/position_estimator_mc/position_estimator_mc_params.h) | 0 | ||||
-rw-r--r-- | src/modules/sdlog/module.mk (renamed from apps/sdlog/Makefile) | 10 | ||||
-rw-r--r-- | src/modules/sdlog/sdlog.c (renamed from apps/sdlog/sdlog.c) | 0 | ||||
-rw-r--r-- | src/modules/sdlog/sdlog_ringbuffer.c (renamed from apps/sdlog/sdlog_ringbuffer.c) | 0 | ||||
-rw-r--r-- | src/modules/sdlog/sdlog_ringbuffer.h (renamed from apps/sdlog/sdlog_ringbuffer.h) | 0 | ||||
-rw-r--r-- | src/modules/sensors/.context (renamed from apps/commander/.context) | 0 | ||||
-rw-r--r-- | src/modules/sensors/module.mk (renamed from apps/sensors/Makefile) | 13 | ||||
-rw-r--r-- | src/modules/sensors/sensor_params.c (renamed from apps/sensors/sensor_params.c) | 0 | ||||
-rw-r--r-- | src/modules/sensors/sensors.cpp (renamed from apps/sensors/sensors.cpp) | 2 | ||||
-rw-r--r-- | src/modules/test/foo.c | 4 | ||||
-rw-r--r-- | src/modules/test/module.mk | 4 | ||||
-rw-r--r-- | src/systemcmds/bl_update/bl_update.c (renamed from apps/systemcmds/bl_update/bl_update.c) | 2 | ||||
-rw-r--r-- | src/systemcmds/bl_update/module.mk (renamed from apps/px4/tests/Makefile) | 11 | ||||
-rw-r--r-- | src/systemcmds/boardinfo/boardinfo.c (renamed from apps/systemcmds/boardinfo/boardinfo.c) | 2 | ||||
-rw-r--r-- | src/systemcmds/boardinfo/module.mk (renamed from apps/systemcmds/reboot/Makefile) | 11 | ||||
-rw-r--r-- | src/systemcmds/eeprom/24xxxx_mtd.c (renamed from apps/systemcmds/eeprom/24xxxx_mtd.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/eeprom/eeprom.c (renamed from apps/systemcmds/eeprom/eeprom.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/eeprom/module.mk | 39 | ||||
-rw-r--r-- | src/systemcmds/i2c/i2c.c (renamed from apps/systemcmds/i2c/i2c.c) | 2 | ||||
-rw-r--r-- | src/systemcmds/i2c/module.mk (renamed from apps/systemcmds/i2c/Makefile) | 9 | ||||
-rw-r--r-- | src/systemcmds/mixer/mixer.c (renamed from apps/systemcmds/mixer/mixer.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/mixer/module.mk (renamed from apps/systemcmds/mixer/Makefile) | 9 | ||||
-rw-r--r-- | src/systemcmds/param/module.mk (renamed from apps/systemcmds/param/Makefile) | 10 | ||||
-rw-r--r-- | src/systemcmds/param/param.c (renamed from apps/systemcmds/param/param.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/perf/module.mk (renamed from apps/systemcmds/perf/Makefile) | 9 | ||||
-rw-r--r-- | src/systemcmds/perf/perf.c (renamed from apps/systemcmds/perf/perf.c) | 2 | ||||
-rw-r--r-- | src/systemcmds/preflight_check/module.mk (renamed from apps/systemcmds/bl_update/Makefile) | 12 | ||||
-rw-r--r-- | src/systemcmds/preflight_check/preflight_check.c (renamed from apps/systemcmds/preflight_check/preflight_check.c) | 2 | ||||
-rw-r--r-- | src/systemcmds/pwm/module.mk (renamed from apps/systemcmds/pwm/Makefile) | 9 | ||||
-rw-r--r-- | src/systemcmds/pwm/pwm.c (renamed from apps/systemcmds/pwm/pwm.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/reboot/module.mk | 41 | ||||
-rw-r--r-- | src/systemcmds/reboot/reboot.c (renamed from apps/systemcmds/reboot/reboot.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/.context (renamed from apps/examples/cdcacm/.context) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/module.mk | 28 | ||||
-rw-r--r-- | src/systemcmds/tests/test_adc.c (renamed from apps/px4/tests/test_adc.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_bson.c (renamed from apps/px4/tests/test_bson.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_float.c (renamed from apps/px4/tests/test_float.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_gpio.c (renamed from apps/px4/tests/test_gpio.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_hott_telemetry.c (renamed from apps/px4/tests/test_hott_telemetry.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_hrt.c (renamed from apps/px4/tests/test_hrt.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_int.c (renamed from apps/px4/tests/test_int.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_jig_voltages.c (renamed from apps/px4/tests/test_jig_voltages.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_led.c (renamed from apps/px4/tests/test_led.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_sensors.c (renamed from apps/px4/tests/test_sensors.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_servo.c (renamed from apps/px4/tests/test_servo.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_sleep.c (renamed from apps/px4/tests/test_sleep.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_time.c (renamed from apps/px4/tests/test_time.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_uart_baudchange.c (renamed from apps/px4/tests/test_uart_baudchange.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_uart_console.c (renamed from apps/px4/tests/test_uart_console.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_uart_loopback.c (renamed from apps/px4/tests/test_uart_loopback.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/test_uart_send.c (renamed from apps/px4/tests/test_uart_send.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/tests.h (renamed from apps/px4/tests/tests.h) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/tests_file.c (renamed from apps/px4/tests/tests_file.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/tests_main.c (renamed from apps/px4/tests/tests_main.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/tests/tests_param.c (renamed from apps/px4/tests/tests_param.c) | 0 | ||||
-rw-r--r-- | src/systemcmds/top/module.mk (renamed from apps/systemcmds/delay_test/Makefile) | 12 | ||||
-rw-r--r-- | src/systemcmds/top/top.c (renamed from apps/systemcmds/top/top.c) | 0 |
292 files changed, 2302 insertions, 2221 deletions
diff --git a/.gitignore b/.gitignore index 8e9075ba4..de03b0a60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .built +.context *.context *.bdat *.pdat @@ -43,7 +44,6 @@ nuttx/nuttx.hex .settings Firmware.sublime-workspace .DS_Store -nsh_romfsimg.h cscope.out .configX-e nuttx-export.zip @@ -55,3 +55,8 @@ mavlink/include/mavlink/v0.9/ core .gdbinit mkdeps +Archives +Build +!ROMFS/*/*.d +!ROMFS/*/*/*.d +!ROMFS/*/*/*/*.d @@ -1,43 +1,53 @@ # -# Top-level Makefile for building PX4 firmware images. -# -# -# Note that this is a transitional process; the eventual goal is for this -# project to slim down and simply generate PX4 link kits via the NuttX -# 'make export' mechanism. -# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. # # -# Some useful paths. +# Top-level Makefile for building PX4 firmware images. # -export PX4BASE = $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) -export NUTTX_SRC = $(PX4BASE)/nuttx -export NUTTX_APPS = $(PX4BASE)/apps -export MAVLINK_SRC = $(PX4BASE)/mavlink -export ROMFS_SRC = $(PX4BASE)/ROMFS -export IMAGE_DIR = $(PX4BASE)/Images # -# Tools +# Get path and tool configuration # -MKFW = $(PX4BASE)/Tools/px_mkfw.py -UPLOADER = $(PX4BASE)/Tools/px_uploader.py +export PX4_BASE := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))/ +include $(PX4_BASE)makefiles/setup.mk # -# What are we currently configured for? +# Canned firmware configurations that we build. # -CONFIGURED = $(PX4BASE)/.configured -ifneq ($(wildcard $(CONFIGURED)),) -export TARGET := $(shell cat $(CONFIGURED)) -endif +CONFIGS ?= $(subst config_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)config_*.mk)))) # -# What we will build +# Boards that we build NuttX export kits for. # -FIRMWARE_BUNDLE = $(IMAGE_DIR)/$(TARGET).px4 -FIRMWARE_BINARY = $(IMAGE_DIR)/$(TARGET).bin -FIRMWARE_PROTOTYPE = $(IMAGE_DIR)/$(TARGET).prototype +BOARDS := $(subst board_,,$(basename $(notdir $(wildcard $(PX4_MK_DIR)board_*.mk)))) # # Debugging @@ -45,120 +55,151 @@ FIRMWARE_PROTOTYPE = $(IMAGE_DIR)/$(TARGET).prototype MQUIET = --no-print-directory #MQUIET = --print-directory -all: $(FIRMWARE_BUNDLE) +################################################################################ +# No user-serviceable parts below +################################################################################ # -# Generate a wrapped .px4 file from the built binary +# If the user has listed a config as a target, strip it out and override CONFIGS. # -$(FIRMWARE_BUNDLE): $(FIRMWARE_BINARY) $(MKFW) $(FIRMWARE_PROTOTYPE) - @echo Generating $@ - @$(MKFW) --prototype $(FIRMWARE_PROTOTYPE) \ - --git_identity $(PX4BASE) \ - --image $(FIRMWARE_BINARY) > $@ +FIRMWARE_GOAL = firmware +EXPLICIT_CONFIGS := $(filter $(CONFIGS),$(MAKECMDGOALS)) +ifneq ($(EXPLICIT_CONFIGS),) +CONFIGS := $(EXPLICIT_CONFIGS) +.PHONY: $(EXPLICIT_CONFIGS) +$(EXPLICIT_CONFIGS): all # -# Build the firmware binary. +# If the user has asked to upload, they must have also specified exactly one +# config. # -.PHONY: $(FIRMWARE_BINARY) -$(FIRMWARE_BINARY): setup_$(TARGET) configure-check - @echo Building $@ for $(TARGET) - @make -C $(NUTTX_SRC) -r $(MQUIET) all - @cp $(NUTTX_SRC)/nuttx.bin $@ +ifneq ($(filter upload,$(MAKECMDGOALS)),) +ifneq ($(words $(EXPLICIT_CONFIGS)),1) +$(error In order to upload, exactly one board config must be specified) +endif +FIRMWARE_GOAL = upload +.PHONY: upload +upload: + @: +endif +endif # -# The 'configure' targets select one particular firmware configuration -# and makes it current. +# Built products # -configure_px4fmu: - @echo Configuring for px4fmu - @make -C $(PX4BASE) distclean - @cd $(NUTTX_SRC)/tools && /bin/sh configure.sh px4fmu/nsh - @echo px4fmu > $(CONFIGURED) - -configure_px4io: - @echo Configuring for px4io - @make -C $(PX4BASE) distclean - @cd $(NUTTX_SRC)/tools && /bin/sh configure.sh px4io/io - @echo px4io > $(CONFIGURED) - -configure-check: -ifeq ($(wildcard $(CONFIGURED)),) - @echo - @echo "Not configured - use 'make configure_px4fmu' or 'make configure_px4io' first" - @echo - @exit 1 -endif +STAGED_FIRMWARES = $(foreach config,$(CONFIGS),$(IMAGE_DIR)$(config).px4) +FIRMWARES = $(foreach config,$(CONFIGS),$(BUILD_DIR)$(config).build/firmware.px4) +all: $(STAGED_FIRMWARES) # -# Per-configuration additional targets +# Copy FIRMWARES into the image directory. # -.PHONY: px4fmu_setup -setup_px4fmu: - @echo Generating ROMFS - @make -C $(ROMFS_SRC) all - -setup_px4io: - -# fake target to make configure-check happy if TARGET is not set -setup_: +$(STAGED_FIRMWARES): $(IMAGE_DIR)%.px4: $(BUILD_DIR)%.build/firmware.px4 + @echo %% Copying $@ + $(Q) $(COPY) $< $@ # -# Firmware uploading. +# Generate FIRMWARES. # - -# serial port defaults by operating system. -SYSTYPE = $(shell uname) -ifeq ($(SYSTYPE),Darwin) -SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" -endif -ifeq ($(SYSTYPE),Linux) -SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" -endif -ifeq ($(SERIAL_PORTS),) -SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" -endif - -upload: $(FIRMWARE_BUNDLE) $(UPLOADER) - $(UPLOADER) --port $(SERIAL_PORTS) $(FIRMWARE_BUNDLE) +.PHONY: $(FIRMWARES) +$(BUILD_DIR)%.build/firmware.px4: config = $(patsubst $(BUILD_DIR)%.build/firmware.px4,%,$@) +$(BUILD_DIR)%.build/firmware.px4: work_dir = $(BUILD_DIR)$(config).build/ +$(FIRMWARES): $(BUILD_DIR)%.build/firmware.px4: + @echo %%%% + @echo %%%% Building $(config) in $(work_dir) + @echo %%%% + $(Q) mkdir -p $(work_dir) + $(Q) make -r -C $(work_dir) \ + -f $(PX4_MK_DIR)firmware.mk \ + CONFIG=$(config) \ + WORK_DIR=$(work_dir) \ + $(FIRMWARE_GOAL) # -# JTAG firmware uploading with OpenOCD +# Build the NuttX export archives. # -ifeq ($(JTAGCONFIG),) -JTAGCONFIG=interface/olimex-jtag-tiny.cfg -endif - -upload-jtag-px4fmu: - @echo Attempting to flash PX4FMU board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown - -upload-jtag-px4io: all - @echo Attempting to flash PX4IO board via JTAG - @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown - +# Note that there are no explicit dependencies extended from these +# archives. If NuttX is updated, the user is expected to rebuild the +# archives/build area manually. Likewise, when the 'archives' target is +# invoked, all archives are always rebuilt. # -# Hacks and fixups +# XXX Should support fetching/unpacking from a separate directory to permit +# downloads of the prebuilt archives as well... # +# XXX PX4IO configuration name is bad - NuttX configs should probably all be "px4" +# +NUTTX_ARCHIVES = $(foreach board,$(BOARDS),$(ARCHIVE_DIR)$(board).export) +.PHONY: archives +archives: $(NUTTX_ARCHIVES) -ifeq ($(SYSTYPE),Darwin) -# PATH inherited by Eclipse may not include toolchain install location -export PATH := $(PATH):/usr/local/bin +# We cannot build these parallel; note that we also force -j1 for the +# sub-make invocations. +ifneq ($(filter archives,$(MAKECMDGOALS)),) +.NOTPARALLEL: endif +$(ARCHIVE_DIR)%.export: board = $(notdir $(basename $@)) +$(ARCHIVE_DIR)%.export: configuration = $(if $(filter $(board),px4io),io,nsh) +$(NUTTX_ARCHIVES): $(ARCHIVE_DIR)%.export: $(NUTTX_SRC) $(NUTTX_APPS) + @echo %% Configuring NuttX for $(board) + $(Q) (cd $(NUTTX_SRC) && $(RMDIR) nuttx-export) + $(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) distclean + $(Q) (cd $(NUTTX_SRC)tools && ./configure.sh $(board)/$(configuration)) + @echo %% Exporting NuttX for $(board) + $(Q) make -r -j1 -C $(NUTTX_SRC) -r $(MQUIET) export + $(Q) mkdir -p $(dir $@) + $(Q) $(COPY) $(NUTTX_SRC)nuttx-export.zip $@ + # # Cleanup targets. 'clean' should remove all built products and force # a complete re-compilation, 'distclean' should remove everything # that's generated leaving only files that are in source control. # -.PHONY: clean upload-jtag-px4fmu +.PHONY: clean clean: - @make -C $(NUTTX_SRC) -r $(MQUIET) distclean - @make -C $(ROMFS_SRC) -r $(MQUIET) clean + $(Q) $(RMDIR) $(BUILD_DIR)*.build + $(Q) $(REMOVE) -f $(IMAGE_DIR)*.px4 .PHONY: distclean -distclean: - @rm -f $(CONFIGURED) - @make -C $(NUTTX_SRC) -r $(MQUIET) distclean - @make -C $(ROMFS_SRC) -r $(MQUIET) distclean - +distclean: clean + $(Q) $(REMOVE) -f $(ARCHIVE_DIR)*.export + $(Q) make -C $(NUTTX_SRC) -r $(MQUIET) distclean + +# +# Print some help text +# +.PHONY: help +help: + @echo "" + @echo " PX4 firmware builder" + @echo " ====================" + @echo "" + @echo " Available targets:" + @echo " ------------------" + @echo "" + @echo " archives" + @echo " Build the NuttX RTOS archives that are used by the firmware build." + @echo "" + @echo " all" + @echo " Build all firmware configs: $(CONFIGS)" + @echo " A limited set of configs can be built with CONFIGS=<list-of-configs>" + @echo "" + @for config in $(CONFIGS); do \ + echo " $$config"; \ + echo " Build just the $$config firmware configuration."; \ + echo ""; \ + done + @echo " clean" + @echo " Remove all firmware build pieces." + @echo "" + @echo " distclean" + @echo " Remove all compilation products, including NuttX RTOS archives." + @echo "" + @echo " Common options:" + @echo " ---------------" + @echo "" + @echo " V=1" + @echo " If V is set, more verbose output is printed during the build. This can" + @echo " help when diagnosing issues with the build or toolchain." + @echo "" diff --git a/ROMFS/.gitignore b/ROMFS/.gitignore deleted file mode 100644 index 30d3d7fe5..000000000 --- a/ROMFS/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/img diff --git a/ROMFS/Makefile b/ROMFS/Makefile deleted file mode 100644 index 11a4650fa..000000000 --- a/ROMFS/Makefile +++ /dev/null @@ -1,123 +0,0 @@ -# -# Makefile to generate a PX4FMU ROMFS image. -# -# In normal use, 'make install' will generate a new ROMFS header and place it -# into the px4fmu configuration in the appropriate location. -# - -# -# Directories of interest -# -SRCROOT ?= $(dir $(lastword $(MAKEFILE_LIST))) -BUILDROOT ?= $(SRCROOT)/img -ROMFS_HEADER ?= $(SRCROOT)/../nuttx/configs/px4fmu/include/nsh_romfsimg.h - -# -# List of files to install in the ROMFS, specified as <source>~<destination> -# -ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ - $(SRCROOT)/scripts/rc.sensors~init.d/rc.sensors \ - $(SRCROOT)/scripts/rc.logging~init.d/rc.logging \ - $(SRCROOT)/scripts/rc.standalone~init.d/rc.standalone \ - $(SRCROOT)/scripts/rc.PX4IO~init.d/rc.PX4IO \ - $(SRCROOT)/scripts/rc.PX4IOAR~init.d/rc.PX4IOAR \ - $(SRCROOT)/scripts/rc.FMU_quad_x~init.d/rc.FMU_quad_x \ - $(SRCROOT)/scripts/rc.usb~init.d/rc.usb \ - $(SRCROOT)/scripts/rc.hil~init.d/rc.hil \ - $(SRCROOT)/mixers/FMU_pass.mix~mixers/FMU_pass.mix \ - $(SRCROOT)/mixers/FMU_Q.mix~mixers/FMU_Q.mix \ - $(SRCROOT)/mixers/FMU_X5.mix~mixers/FMU_X5.mix \ - $(SRCROOT)/mixers/FMU_AERT.mix~mixers/FMU_AERT.mix \ - $(SRCROOT)/mixers/FMU_AET.mix~mixers/FMU_AET.mix \ - $(SRCROOT)/mixers/FMU_RET.mix~mixers/FMU_ERT.mix \ - $(SRCROOT)/mixers/FMU_quad_x.mix~mixers/FMU_quad_x.mix \ - $(SRCROOT)/mixers/FMU_quad_+.mix~mixers/FMU_quad_+.mix \ - $(SRCROOT)/mixers/FMU_quad_v.mix~mixers/FMU_quad_v.mix \ - $(SRCROOT)/mixers/FMU_hex_x.mix~mixers/FMU_hex_x.mix \ - $(SRCROOT)/mixers/FMU_hex_+.mix~mixers/FMU_hex_+.mix \ - $(SRCROOT)/mixers/FMU_octo_x.mix~mixers/FMU_octo_x.mix \ - $(SRCROOT)/mixers/FMU_octo_+.mix~mixers/FMU_octo_+.mix \ - $(SRCROOT)/logging/logconv.m~logging/logconv.m - -# the EXTERNAL_SCRIPTS variable is used to add out of tree scripts -# to ROMFS. -ROMFS_FSSPEC += $(EXTERNAL_SCRIPTS) - -# -# Add the PX4IO firmware to the spec if someone has dropped it into the -# source directory, or otherwise specified its location. -# -# Normally this is only something you'd do when working on PX4IO; most -# users will upgrade with firmware off the microSD card. -# -PX4IO_FIRMWARE ?= $(SRCROOT)/px4io.bin -ifneq ($(wildcard $(PX4IO_FIRMWARE)),) -ROMFS_FSSPEC += $(PX4IO_FIRMWARE)~px4io.bin -endif - -################################################################################ -# No user-serviceable parts below -################################################################################ - -# -# Just the source files from the ROMFS spec, so that we can fail cleanly if they don't -# exist -# -ROMFS_SRCFILES = $(foreach spec,$(ROMFS_FSSPEC),$(firstword $(subst ~, ,$(spec)))) - -# -# Just the destination directories from the ROMFS spec -# -ROMFS_DIRS = $(sort $(dir $(foreach spec,$(ROMFS_FSSPEC),$(lastword $(subst ~, ,$(spec)))))) - - -# -# Intermediate products -# -ROMFS_IMG = $(BUILDROOT)/romfs.img -ROMFS_WORKDIR = $(BUILDROOT)/romfs - -# -# Convenience target for rebuilding the ROMFS header -# -all: $(ROMFS_HEADER) - -$(ROMFS_HEADER): $(ROMFS_IMG) $(dir $(ROMFS_HEADER)) - @echo Generating the ROMFS header... - @(cd $(dir $(ROMFS_IMG)) && xxd -i $(notdir $(ROMFS_IMG))) | sed -e 's/char/const char/' > $@ - -$(ROMFS_IMG): $(ROMFS_WORKDIR) - @echo Generating the ROMFS image... - @genromfs -f $@ -d $(ROMFS_WORKDIR) -V "NSHInitVol" - -$(ROMFS_WORKDIR): $(ROMFS_SRCFILES) - @echo Rebuilding the ROMFS work area... - @rm -rf $(ROMFS_WORKDIR) - @mkdir -p $(ROMFS_WORKDIR) - @for dir in $(ROMFS_DIRS) ; do mkdir -p $(ROMFS_WORKDIR)/$$dir; done - @for spec in $(ROMFS_FSSPEC) ; do \ - echo $$spec | sed -e 's%^.*~% %' ;\ - `echo "cp $$spec" | sed -e 's%~% $(ROMFS_WORKDIR)/%'` ;\ - done - -$(BUILDROOT): - @mkdir -p $(BUILDROOT) - -clean: - @rm -rf $(BUILDROOT) - -distclean: clean - @rm -f $(PX4IO_FIRMWARE) $(ROMFS_HEADER) - -.PHONY: all install clean distclean - -# -# Hacks and fixups -# -SYSTYPE = $(shell uname) - -ifeq ($(SYSTYPE),Darwin) -# PATH inherited by Eclipse may not include toolchain install location -export PATH := $(PATH):/usr/local/bin -endif - diff --git a/ROMFS/scripts/rc.FMU_quad_x b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x index 8787443ea..8787443ea 100644 --- a/ROMFS/scripts/rc.FMU_quad_x +++ b/ROMFS/px4fmu_common/init.d/rc.FMU_quad_x diff --git a/ROMFS/scripts/rc.PX4IO b/ROMFS/px4fmu_common/init.d/rc.PX4IO index 625f23bdd..7ae4a5586 100644 --- a/ROMFS/scripts/rc.PX4IO +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IO @@ -104,4 +104,4 @@ then blinkm systemstate else echo "no BlinkM found, OK." -fi
\ No newline at end of file +fi diff --git a/ROMFS/scripts/rc.PX4IOAR b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR index 6af91992e..ab29e21c7 100644 --- a/ROMFS/scripts/rc.PX4IOAR +++ b/ROMFS/px4fmu_common/init.d/rc.PX4IOAR @@ -96,4 +96,4 @@ fi # echo "[init] startup done" -exit
\ No newline at end of file +exit diff --git a/ROMFS/scripts/rc.boarddetect b/ROMFS/px4fmu_common/init.d/rc.boarddetect index f233e51df..f233e51df 100644 --- a/ROMFS/scripts/rc.boarddetect +++ b/ROMFS/px4fmu_common/init.d/rc.boarddetect diff --git a/ROMFS/scripts/rc.hil b/ROMFS/px4fmu_common/init.d/rc.hil index 980b78edd..980b78edd 100644 --- a/ROMFS/scripts/rc.hil +++ b/ROMFS/px4fmu_common/init.d/rc.hil diff --git a/ROMFS/scripts/rc.jig b/ROMFS/px4fmu_common/init.d/rc.jig index e2b5d8f30..e2b5d8f30 100644 --- a/ROMFS/scripts/rc.jig +++ b/ROMFS/px4fmu_common/init.d/rc.jig diff --git a/ROMFS/scripts/rc.logging b/ROMFS/px4fmu_common/init.d/rc.logging index 09c2d00d1..09c2d00d1 100644 --- a/ROMFS/scripts/rc.logging +++ b/ROMFS/px4fmu_common/init.d/rc.logging diff --git a/ROMFS/scripts/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 42c2f52e9..42c2f52e9 100644 --- a/ROMFS/scripts/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors diff --git a/ROMFS/scripts/rc.standalone b/ROMFS/px4fmu_common/init.d/rc.standalone index 67e95215b..67e95215b 100644 --- a/ROMFS/scripts/rc.standalone +++ b/ROMFS/px4fmu_common/init.d/rc.standalone diff --git a/ROMFS/scripts/rc.usb b/ROMFS/px4fmu_common/init.d/rc.usb index 31af3991a..31af3991a 100644 --- a/ROMFS/scripts/rc.usb +++ b/ROMFS/px4fmu_common/init.d/rc.usb diff --git a/ROMFS/scripts/rcS b/ROMFS/px4fmu_common/init.d/rcS index c0a70f7dd..c0a70f7dd 100755 --- a/ROMFS/scripts/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS diff --git a/ROMFS/logging/logconv.m b/ROMFS/px4fmu_common/logging/logconv.m index 3750ddae2..3750ddae2 100644 --- a/ROMFS/logging/logconv.m +++ b/ROMFS/px4fmu_common/logging/logconv.m diff --git a/ROMFS/mixers/FMU_AERT.mix b/ROMFS/px4fmu_common/mixers/FMU_AERT.mix index 75e82bb00..75e82bb00 100644 --- a/ROMFS/mixers/FMU_AERT.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_AERT.mix diff --git a/ROMFS/mixers/FMU_AET.mix b/ROMFS/px4fmu_common/mixers/FMU_AET.mix index 20cb88b91..20cb88b91 100644 --- a/ROMFS/mixers/FMU_AET.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_AET.mix diff --git a/ROMFS/mixers/FMU_Q.mix b/ROMFS/px4fmu_common/mixers/FMU_Q.mix index ebcb66b24..ebcb66b24 100644 --- a/ROMFS/mixers/FMU_Q.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_Q.mix diff --git a/ROMFS/mixers/FMU_RET.mix b/ROMFS/px4fmu_common/mixers/FMU_RET.mix index 95beb8927..95beb8927 100644 --- a/ROMFS/mixers/FMU_RET.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_RET.mix diff --git a/ROMFS/mixers/FMU_X5.mix b/ROMFS/px4fmu_common/mixers/FMU_X5.mix index 9f81e1dc3..9f81e1dc3 100644 --- a/ROMFS/mixers/FMU_X5.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_X5.mix diff --git a/ROMFS/px4fmu_common/mixers/FMU_delta.mix b/ROMFS/px4fmu_common/mixers/FMU_delta.mix new file mode 100644 index 000000000..981466704 --- /dev/null +++ b/ROMFS/px4fmu_common/mixers/FMU_delta.mix @@ -0,0 +1,50 @@ +Delta-wing mixer for PX4FMU +=========================== + +This file defines mixers suitable for controlling a delta wing aircraft using +PX4FMU. The configuration assumes the elevon servos are connected to PX4FMU +servo outputs 0 and 1 and the motor speed control to output 3. Output 2 is +assumed to be unused. + +Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0 +(roll), 1 (pitch) and 3 (thrust). + +See the README for more information on the scaler format. + +Elevon mixers +------------- +Three scalers total (output, roll, pitch). + +On the assumption that the two elevon servos are physically reversed, the pitch +input is inverted between the two servos. + +The scaling factor for roll inputs is adjusted to implement differential travel +for the elevons. + +M: 2 +O: 10000 10000 0 -10000 10000 +S: 0 0 3000 5000 0 -10000 10000 +S: 0 1 5000 5000 0 -10000 10000 + +M: 2 +O: 10000 10000 0 -10000 10000 +S: 0 0 5000 3000 0 -10000 10000 +S: 0 1 -5000 -5000 0 -10000 10000 + +Output 2 +-------- +This mixer is empty. + +Z: + +Motor speed mixer +----------------- +Two scalers total (output, thrust). + +This mixer generates a full-range output (-1 to 1) from an input in the (0 - 1) +range. Inputs below zero are treated as zero. + +M: 1 +O: 10000 10000 0 -10000 10000 +S: 0 3 0 20000 -10000 -10000 10000 + diff --git a/ROMFS/mixers/FMU_hex_+.mix b/ROMFS/px4fmu_common/mixers/FMU_hex_+.mix index b5e38ce9e..b5e38ce9e 100644 --- a/ROMFS/mixers/FMU_hex_+.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_hex_+.mix diff --git a/ROMFS/mixers/FMU_hex_x.mix b/ROMFS/px4fmu_common/mixers/FMU_hex_x.mix index 8e8d122ad..8e8d122ad 100644 --- a/ROMFS/mixers/FMU_hex_x.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_hex_x.mix diff --git a/ROMFS/mixers/FMU_octo_+.mix b/ROMFS/px4fmu_common/mixers/FMU_octo_+.mix index 2cb70e814..2cb70e814 100644 --- a/ROMFS/mixers/FMU_octo_+.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_octo_+.mix diff --git a/ROMFS/mixers/FMU_octo_x.mix b/ROMFS/px4fmu_common/mixers/FMU_octo_x.mix index edc71f013..edc71f013 100644 --- a/ROMFS/mixers/FMU_octo_x.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_octo_x.mix diff --git a/ROMFS/mixers/FMU_pass.mix b/ROMFS/px4fmu_common/mixers/FMU_pass.mix index e9a81f2bb..e9a81f2bb 100644 --- a/ROMFS/mixers/FMU_pass.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_pass.mix diff --git a/ROMFS/mixers/FMU_quad_+.mix b/ROMFS/px4fmu_common/mixers/FMU_quad_+.mix index dfdf1d58e..dfdf1d58e 100644 --- a/ROMFS/mixers/FMU_quad_+.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_quad_+.mix diff --git a/ROMFS/mixers/FMU_quad_v.mix b/ROMFS/px4fmu_common/mixers/FMU_quad_v.mix index 2a4a0f341..2a4a0f341 100644 --- a/ROMFS/mixers/FMU_quad_v.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_quad_v.mix diff --git a/ROMFS/mixers/FMU_quad_x.mix b/ROMFS/px4fmu_common/mixers/FMU_quad_x.mix index 12a3bee20..12a3bee20 100644 --- a/ROMFS/mixers/FMU_quad_x.mix +++ b/ROMFS/px4fmu_common/mixers/FMU_quad_x.mix diff --git a/ROMFS/mixers/README b/ROMFS/px4fmu_common/mixers/README index 6649c53c2..6649c53c2 100644 --- a/ROMFS/mixers/README +++ b/ROMFS/px4fmu_common/mixers/README diff --git a/Tools/px_uploader.py b/Tools/px_uploader.py index cce388d71..d2ebf1698 100755 --- a/Tools/px_uploader.py +++ b/Tools/px_uploader.py @@ -41,20 +41,19 @@ # The uploader uses the following fields from the firmware file: # # image -# The firmware that will be uploaded. +# The firmware that will be uploaded. # image_size -# The size of the firmware in bytes. +# The size of the firmware in bytes. # board_id -# The board for which the firmware is intended. +# The board for which the firmware is intended. # board_revision -# Currently only used for informational purposes. +# Currently only used for informational purposes. # import sys import argparse import binascii import serial -import os import struct import json import zlib @@ -64,292 +63,294 @@ import array from sys import platform as _platform + class firmware(object): - '''Loads a firmware file''' - - desc = {} - image = bytes() - crctab = array.array('I', [ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ]) - crcpad = bytearray('\xff\xff\xff\xff') - - def __init__(self, path): - - # read the file - f = open(path, "r") - self.desc = json.load(f) - f.close() - - self.image = bytearray(zlib.decompress(base64.b64decode(self.desc['image']))) - - # pad image to 4-byte length - while ((len(self.image) % 4) != 0): - self.image.append('\xff') - - def property(self, propname): - return self.desc[propname] - - def __crc32(self, bytes, state): - for byte in bytes: - index = (state ^ byte) & 0xff - state = self.crctab[index] ^ (state >> 8) - return state - - def crc(self, padlen): - state = self.__crc32(self.image, int(0)) - for i in range(len(self.image), (padlen - 1), 4): - state = self.__crc32(self.crcpad, state) - return state + '''Loads a firmware file''' + + desc = {} + image = bytes() + crctab = array.array('I', [ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d]) + crcpad = bytearray('\xff\xff\xff\xff') + + def __init__(self, path): + + # read the file + f = open(path, "r") + self.desc = json.load(f) + f.close() + + self.image = bytearray(zlib.decompress(base64.b64decode(self.desc['image']))) + + # pad image to 4-byte length + while ((len(self.image) % 4) != 0): + self.image.append('\xff') + + def property(self, propname): + return self.desc[propname] + + def __crc32(self, bytes, state): + for byte in bytes: + index = (state ^ byte) & 0xff + state = self.crctab[index] ^ (state >> 8) + return state + + def crc(self, padlen): + state = self.__crc32(self.image, int(0)) + for i in range(len(self.image), (padlen - 1), 4): + state = self.__crc32(self.crcpad, state) + return state + class uploader(object): - '''Uploads a firmware file to the PX FMU bootloader''' - - # protocol bytes - INSYNC = chr(0x12) - EOC = chr(0x20) - - # reply bytes - OK = chr(0x10) - FAILED = chr(0x11) - INVALID = chr(0x13) # rev3+ - - # command bytes - NOP = chr(0x00) # guaranteed to be discarded by the bootloader - GET_SYNC = chr(0x21) - GET_DEVICE = chr(0x22) - CHIP_ERASE = chr(0x23) - CHIP_VERIFY = chr(0x24) # rev2 only - PROG_MULTI = chr(0x27) - READ_MULTI = chr(0x28) # rev2 only - GET_CRC = chr(0x29) # rev3+ - REBOOT = chr(0x30) - - INFO_BL_REV = chr(1) # bootloader protocol revision - BL_REV_MIN = 2 # minimum supported bootloader protocol - BL_REV_MAX = 3 # maximum supported bootloader protocol - INFO_BOARD_ID = chr(2) # board type - INFO_BOARD_REV = chr(3) # board revision - INFO_FLASH_SIZE = chr(4) # max firmware size in bytes - - PROG_MULTI_MAX = 60 # protocol max is 255, must be multiple of 4 - READ_MULTI_MAX = 60 # protocol max is 255, something overflows with >= 64 - - def __init__(self, portname, baudrate): - # open the port, keep the default timeout short so we can poll quickly - self.port = serial.Serial(portname, baudrate, timeout=0.25) - - def close(self): - if self.port is not None: - self.port.close() - - def __send(self, c): -# print("send " + binascii.hexlify(c)) - self.port.write(str(c)) - - def __recv(self, count = 1): - c = self.port.read(count) - if len(c) < 1: - raise RuntimeError("timeout waiting for data") -# print("recv " + binascii.hexlify(c)) - return c - - def __recv_int(self): - raw = self.__recv(4) - val = struct.unpack("<I", raw) - return val[0] - - def __getSync(self): - self.port.flush() - c = self.__recv() - if c is not self.INSYNC: - raise RuntimeError("unexpected 0x%x instead of INSYNC" % ord(c)) - c = self.__recv() - if c == self.INVALID: - raise RuntimeError("bootloader reports INVALID OPERATION") - if c == self.FAILED: - raise RuntimeError("bootloader reports OPERATION FAILED") - if c != self.OK: - raise RuntimeError("unexpected response 0x%x instead of OK" % ord(c)) - - # attempt to get back into sync with the bootloader - def __sync(self): - # send a stream of ignored bytes longer than the longest possible conversation - # that we might still have in progress -# self.__send(uploader.NOP * (uploader.PROG_MULTI_MAX + 2)) - self.port.flushInput() - self.__send(uploader.GET_SYNC - + uploader.EOC) - self.__getSync() - -# def __trySync(self): -# c = self.__recv() -# if (c != self.INSYNC): -# #print("unexpected 0x%x instead of INSYNC" % ord(c)) -# return False; -# c = self.__recv() -# if (c != self.OK): -# #print("unexpected 0x%x instead of OK" % ord(c)) -# return False -# return True - - # send the GET_DEVICE command and wait for an info parameter - def __getInfo(self, param): - self.__send(uploader.GET_DEVICE + param + uploader.EOC) - value = self.__recv_int() - self.__getSync() - return value - - # send the CHIP_ERASE command and wait for the bootloader to become ready - def __erase(self): - self.__send(uploader.CHIP_ERASE - + uploader.EOC) - # erase is very slow, give it 10s - deadline = time.time() + 10 - while time.time() < deadline: - try: - self.__getSync() - return - except RuntimeError as ex: - # we timed out, that's OK - continue - - raise RuntimeError("timed out waiting for erase") - - # send a PROG_MULTI command to write a collection of bytes - def __program_multi(self, data): - self.__send(uploader.PROG_MULTI - + chr(len(data))) - self.__send(data) - self.__send(uploader.EOC) - self.__getSync() - - # verify multiple bytes in flash - def __verify_multi(self, data): - self.__send(uploader.READ_MULTI - + chr(len(data)) - + uploader.EOC) - self.port.flush() - programmed = self.__recv(len(data)) - if programmed != data: - print(("got " + binascii.hexlify(programmed))) - print(("expect " + binascii.hexlify(data))) - return False - self.__getSync() - return True - - # send the reboot command - def __reboot(self): - self.__send(uploader.REBOOT - + uploader.EOC) - self.port.flush() - - # v3+ can report failure if the first word flash fails - if self.bl_rev >= 3: - self.__getSync() - - # split a sequence into a list of size-constrained pieces - def __split_len(self, seq, length): - return [seq[i:i+length] for i in range(0, len(seq), length)] - - # upload code - def __program(self, fw): - code = fw.image - groups = self.__split_len(code, uploader.PROG_MULTI_MAX) - for bytes in groups: - self.__program_multi(bytes) - - # verify code - def __verify_v2(self, fw): - self.__send(uploader.CHIP_VERIFY - + uploader.EOC) - self.__getSync() - code = fw.image - groups = self.__split_len(code, uploader.READ_MULTI_MAX) - for bytes in groups: - if (not self.__verify_multi(bytes)): - raise RuntimeError("Verification failed") - - def __verify_v3(self, fw): - expect_crc = fw.crc(self.fw_maxsize) - self.__send(uploader.GET_CRC - + uploader.EOC) - report_crc = self.__recv_int() - self.__getSync() - if report_crc != expect_crc: - print(("Expected 0x%x" % expect_crc)) - print(("Got 0x%x" % report_crc)) - raise RuntimeError("Program CRC failed") - - # get basic data about the board - def identify(self): - # make sure we are in sync before starting - self.__sync() - - # get the bootloader protocol ID first - self.bl_rev = self.__getInfo(uploader.INFO_BL_REV) - if (self.bl_rev < uploader.BL_REV_MIN) or (self.bl_rev > uploader.BL_REV_MAX): - print(("Unsupported bootloader protocol %d" % uploader.INFO_BL_REV)) - raise RuntimeError("Bootloader protocol mismatch") - - self.board_type = self.__getInfo(uploader.INFO_BOARD_ID) - self.board_rev = self.__getInfo(uploader.INFO_BOARD_REV) - self.fw_maxsize = self.__getInfo(uploader.INFO_FLASH_SIZE) - - # upload the firmware - def upload(self, fw): - # Make sure we are doing the right thing - if self.board_type != fw.property('board_id'): - raise RuntimeError("Firmware not suitable for this board (run 'make configure_px4fmu && make clean' or 'make configure_px4io && make clean' to reconfigure).") - if self.fw_maxsize < fw.property('image_size'): - raise RuntimeError("Firmware image is too large for this board") - - print("erase...") - self.__erase() - - print("program...") - self.__program(fw) - - print("verify...") - if self.bl_rev == 2: - self.__verify_v2(fw) - else: - self.__verify_v3(fw) - - print("done, rebooting.") - self.__reboot() - self.port.close() - + '''Uploads a firmware file to the PX FMU bootloader''' + + # protocol bytes + INSYNC = chr(0x12) + EOC = chr(0x20) + + # reply bytes + OK = chr(0x10) + FAILED = chr(0x11) + INVALID = chr(0x13) # rev3+ + + # command bytes + NOP = chr(0x00) # guaranteed to be discarded by the bootloader + GET_SYNC = chr(0x21) + GET_DEVICE = chr(0x22) + CHIP_ERASE = chr(0x23) + CHIP_VERIFY = chr(0x24) # rev2 only + PROG_MULTI = chr(0x27) + READ_MULTI = chr(0x28) # rev2 only + GET_CRC = chr(0x29) # rev3+ + REBOOT = chr(0x30) + + INFO_BL_REV = chr(1) # bootloader protocol revision + BL_REV_MIN = 2 # minimum supported bootloader protocol + BL_REV_MAX = 3 # maximum supported bootloader protocol + INFO_BOARD_ID = chr(2) # board type + INFO_BOARD_REV = chr(3) # board revision + INFO_FLASH_SIZE = chr(4) # max firmware size in bytes + + PROG_MULTI_MAX = 60 # protocol max is 255, must be multiple of 4 + READ_MULTI_MAX = 60 # protocol max is 255, something overflows with >= 64 + + def __init__(self, portname, baudrate): + # open the port, keep the default timeout short so we can poll quickly + self.port = serial.Serial(portname, baudrate, timeout=0.5) + + def close(self): + if self.port is not None: + self.port.close() + + def __send(self, c): +# print("send " + binascii.hexlify(c)) + self.port.write(str(c)) + + def __recv(self, count=1): + c = self.port.read(count) + if len(c) < 1: + raise RuntimeError("timeout waiting for data") +# print("recv " + binascii.hexlify(c)) + return c + + def __recv_int(self): + raw = self.__recv(4) + val = struct.unpack("<I", raw) + return val[0] + + def __getSync(self): + self.port.flush() + c = self.__recv() + if c is not self.INSYNC: + raise RuntimeError("unexpected 0x%x instead of INSYNC" % ord(c)) + c = self.__recv() + if c == self.INVALID: + raise RuntimeError("bootloader reports INVALID OPERATION") + if c == self.FAILED: + raise RuntimeError("bootloader reports OPERATION FAILED") + if c != self.OK: + raise RuntimeError("unexpected response 0x%x instead of OK" % ord(c)) + + # attempt to get back into sync with the bootloader + def __sync(self): + # send a stream of ignored bytes longer than the longest possible conversation + # that we might still have in progress +# self.__send(uploader.NOP * (uploader.PROG_MULTI_MAX + 2)) + self.port.flushInput() + self.__send(uploader.GET_SYNC + + uploader.EOC) + self.__getSync() + +# def __trySync(self): +# c = self.__recv() +# if (c != self.INSYNC): +# #print("unexpected 0x%x instead of INSYNC" % ord(c)) +# return False; +# c = self.__recv() +# if (c != self.OK): +# #print("unexpected 0x%x instead of OK" % ord(c)) +# return False +# return True + + # send the GET_DEVICE command and wait for an info parameter + def __getInfo(self, param): + self.__send(uploader.GET_DEVICE + param + uploader.EOC) + value = self.__recv_int() + self.__getSync() + return value + + # send the CHIP_ERASE command and wait for the bootloader to become ready + def __erase(self): + self.__send(uploader.CHIP_ERASE + + uploader.EOC) + # erase is very slow, give it 20s + deadline = time.time() + 20 + while time.time() < deadline: + try: + self.__getSync() + return + except RuntimeError: + # we timed out, that's OK + continue + + raise RuntimeError("timed out waiting for erase") + + # send a PROG_MULTI command to write a collection of bytes + def __program_multi(self, data): + self.__send(uploader.PROG_MULTI + + chr(len(data))) + self.__send(data) + self.__send(uploader.EOC) + self.__getSync() + + # verify multiple bytes in flash + def __verify_multi(self, data): + self.__send(uploader.READ_MULTI + + chr(len(data)) + + uploader.EOC) + self.port.flush() + programmed = self.__recv(len(data)) + if programmed != data: + print("got " + binascii.hexlify(programmed)) + print("expect " + binascii.hexlify(data)) + return False + self.__getSync() + return True + + # send the reboot command + def __reboot(self): + self.__send(uploader.REBOOT + + uploader.EOC) + self.port.flush() + + # v3+ can report failure if the first word flash fails + if self.bl_rev >= 3: + self.__getSync() + + # split a sequence into a list of size-constrained pieces + def __split_len(self, seq, length): + return [seq[i:i+length] for i in range(0, len(seq), length)] + + # upload code + def __program(self, fw): + code = fw.image + groups = self.__split_len(code, uploader.PROG_MULTI_MAX) + for bytes in groups: + self.__program_multi(bytes) + + # verify code + def __verify_v2(self, fw): + self.__send(uploader.CHIP_VERIFY + + uploader.EOC) + self.__getSync() + code = fw.image + groups = self.__split_len(code, uploader.READ_MULTI_MAX) + for bytes in groups: + if (not self.__verify_multi(bytes)): + raise RuntimeError("Verification failed") + + def __verify_v3(self, fw): + expect_crc = fw.crc(self.fw_maxsize) + self.__send(uploader.GET_CRC + + uploader.EOC) + report_crc = self.__recv_int() + self.__getSync() + if report_crc != expect_crc: + print("Expected 0x%x" % expect_crc) + print("Got 0x%x" % report_crc) + raise RuntimeError("Program CRC failed") + + # get basic data about the board + def identify(self): + # make sure we are in sync before starting + self.__sync() + + # get the bootloader protocol ID first + self.bl_rev = self.__getInfo(uploader.INFO_BL_REV) + if (self.bl_rev < uploader.BL_REV_MIN) or (self.bl_rev > uploader.BL_REV_MAX): + print("Unsupported bootloader protocol %d" % uploader.INFO_BL_REV) + raise RuntimeError("Bootloader protocol mismatch") + + self.board_type = self.__getInfo(uploader.INFO_BOARD_ID) + self.board_rev = self.__getInfo(uploader.INFO_BOARD_REV) + self.fw_maxsize = self.__getInfo(uploader.INFO_FLASH_SIZE) + + # upload the firmware + def upload(self, fw): + # Make sure we are doing the right thing + if self.board_type != fw.property('board_id'): + raise RuntimeError("Firmware not suitable for this board") + if self.fw_maxsize < fw.property('image_size'): + raise RuntimeError("Firmware image is too large for this board") + + print("erase...") + self.__erase() + + print("program...") + self.__program(fw) + + print("verify...") + if self.bl_rev == 2: + self.__verify_v2(fw) + else: + self.__verify_v3(fw) + + print("done, rebooting.") + self.__reboot() + self.port.close() + # Parse commandline arguments parser = argparse.ArgumentParser(description="Firmware uploader for the PX autopilot system.") @@ -360,57 +361,57 @@ args = parser.parse_args() # Load the firmware file fw = firmware(args.firmware) -print(("Loaded firmware for %x,%x, waiting for the bootloader..." % (fw.property('board_id'), fw.property('board_revision')))) +print("Loaded firmware for %x,%x, waiting for the bootloader..." % (fw.property('board_id'), fw.property('board_revision'))) # Spin waiting for a device to show up while True: - for port in args.port.split(","): - - #print("Trying %s" % port) - - # create an uploader attached to the port - try: - if "linux" in _platform: - # Linux, don't open Mac OS and Win ports - if not "COM" in port and not "tty.usb" in port: - up = uploader(port, args.baud) - elif "darwin" in _platform: - # OS X, don't open Windows and Linux ports - if not "COM" in port and not "ACM" in port: - up = uploader(port, args.baud) - elif "win" in _platform: - # Windows, don't open POSIX ports - if not "/" in port: - up = uploader(port, args.baud) - except: - # open failed, rate-limit our attempts - time.sleep(0.05) - - # and loop to the next port - continue - - # port is open, try talking to it - try: - # identify the bootloader - up.identify() - print(("Found board %x,%x bootloader rev %x on %s" % (up.board_type, up.board_rev, up.bl_rev, port))) - - except: - # most probably a timeout talking to the port, no bootloader - continue - - try: - # ok, we have a bootloader, try flashing it - up.upload(fw) - - except RuntimeError as ex: - - # print the error - print(("ERROR: %s" % ex.args)) - - finally: - # always close the port - up.close() - - # we could loop here if we wanted to wait for more boards... - sys.exit(0) + for port in args.port.split(","): + + #print("Trying %s" % port) + + # create an uploader attached to the port + try: + if "linux" in _platform: + # Linux, don't open Mac OS and Win ports + if not "COM" in port and not "tty.usb" in port: + up = uploader(port, args.baud) + elif "darwin" in _platform: + # OS X, don't open Windows and Linux ports + if not "COM" in port and not "ACM" in port: + up = uploader(port, args.baud) + elif "win" in _platform: + # Windows, don't open POSIX ports + if not "/" in port: + up = uploader(port, args.baud) + except: + # open failed, rate-limit our attempts + time.sleep(0.05) + + # and loop to the next port + continue + + # port is open, try talking to it + try: + # identify the bootloader + up.identify() + print("Found board %x,%x bootloader rev %x on %s" % (up.board_type, up.board_rev, up.bl_rev, port)) + + except: + # most probably a timeout talking to the port, no bootloader + continue + + try: + # ok, we have a bootloader, try flashing it + up.upload(fw) + + except RuntimeError as ex: + + # print the error + print("ERROR: %s" % ex.args) + + finally: + # always close the port + up.close() + + # we could loop here if we wanted to wait for more boards... + sys.exit(0) diff --git a/apps/drivers/boards/px4fmu/Makefile b/apps/drivers/boards/px4fmu/Makefile deleted file mode 100644 index 6b183d8d2..000000000 --- a/apps/drivers/boards/px4fmu/Makefile +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Board-specific startup code for the PX4FMU -# - -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common -LIBNAME = brd_px4fmu - -include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/l3gd20/Makefile b/apps/drivers/l3gd20/Makefile deleted file mode 100644 index 98e2d57c5..000000000 --- a/apps/drivers/l3gd20/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the L3GD20 driver. -# - -APPNAME = l3gd20 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk diff --git a/apps/drivers/mpu6000/Makefile b/apps/drivers/mpu6000/Makefile deleted file mode 100644 index 32df1bdae..000000000 --- a/apps/drivers/mpu6000/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the BMA180 driver. -# - -APPNAME = mpu6000 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk diff --git a/apps/mavlink/.context b/apps/mavlink/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/mavlink/.context +++ /dev/null diff --git a/apps/mavlink/Makefile b/apps/mavlink/Makefile deleted file mode 100644 index 8ddb69b71..000000000 --- a/apps/mavlink/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Mavlink Application -# - -APPNAME = mavlink -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk diff --git a/apps/mavlink_onboard/Makefile b/apps/mavlink_onboard/Makefile deleted file mode 100644 index 8b1cb9b2c..000000000 --- a/apps/mavlink_onboard/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Mavlink Application -# - -APPNAME = mavlink_onboard -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk diff --git a/apps/px4/tests/.context b/apps/px4/tests/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/px4/tests/.context +++ /dev/null diff --git a/apps/sensors/.context b/apps/sensors/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/sensors/.context +++ /dev/null diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index c98e2c0e2..7f0e6005b 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -66,7 +66,7 @@ PRIORITY = SCHED_PRIORITY_DEFAULT STACKSIZE = 2048 MAXOPTIMIZATION = -Os -# Build targets +# Build Targets all: .built .PHONY: context .depend depend clean distclean diff --git a/apps/systemcmds/boardinfo/.context b/apps/systemcmds/boardinfo/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/systemcmds/boardinfo/.context +++ /dev/null diff --git a/apps/systemcmds/calibration/Makefile b/apps/systemcmds/calibration/Makefile deleted file mode 100644 index a1735962e..000000000 --- a/apps/systemcmds/calibration/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Makefile to build the calibration tool -# - -APPNAME = calibration -PRIORITY = SCHED_PRIORITY_MAX - 1 -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/calibration/calibration.c b/apps/systemcmds/calibration/calibration.c deleted file mode 100755 index 7f8b9240f..000000000 --- a/apps/systemcmds/calibration/calibration.c +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** - * calibration.c - * - * Copyright (C) 2012 Ivan Ovinnikov. All rights reserved. - * Authors: Nils Wenzler <wenzlern@ethz.ch> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "calibration.h" - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static int calibrate_help(int argc, char *argv[]); -static int calibrate_all(int argc, char *argv[]); - -__EXPORT int calibration_main(int argc, char *argv[]); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -struct { - const char *name; - int (* fn)(int argc, char *argv[]); - unsigned options; -#define OPT_NOHELP (1<<0) -#define OPT_NOALLTEST (1<<1) -} calibrates[] = { - {"range", range_cal, 0}, - {"servo", servo_cal, 0}, - {"all", calibrate_all, OPT_NOALLTEST}, - {"help", calibrate_help, OPT_NOALLTEST | OPT_NOHELP}, - {NULL, NULL} -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int -calibrate_help(int argc, char *argv[]) -{ - unsigned i; - - printf("Available calibration routines:\n"); - - for (i = 0; calibrates[i].name; i++) - printf(" %s\n", calibrates[i].name); - - return 0; -} - -static int -calibrate_all(int argc, char *argv[]) -{ - unsigned i; - char *args[2] = {"all", NULL}; - - printf("Running all calibration routines...\n\n"); - - for (i = 0; calibrates[i].name; i++) { - printf(" %s:\n", calibrates[i].name); - - if (calibrates[i].fn(1, args)) { - printf(" FAIL\n"); - - } else { - printf(" DONE\n"); - } - } - - return 0; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void press_enter(void) -{ - int c; - printf("Press CTRL+ENTER to continue... \n"); - fflush(stdout); - - do c = getchar(); while ((c != '\n') && (c != EOF)); -} - -/**************************************************************************** - * Name: calibrate_main - ****************************************************************************/ - -int calibration_main(int argc, char *argv[]) -{ - unsigned i; - - if (argc < 2) { - printf("calibration: missing name - 'calibration help' for a list of routines\n"); - return 1; - } - - for (i = 0; calibrates[i].name; i++) { - if (!strcmp(calibrates[i].name, argv[1])) - return calibrates[i].fn(argc - 1, argv + 1); - } - - printf("calibrate: no routines called '%s' - 'calibration help' for a list of routines\n", argv[1]); - return 1; -} diff --git a/apps/systemcmds/calibration/channels_cal.c b/apps/systemcmds/calibration/channels_cal.c deleted file mode 100755 index 575138b12..000000000 --- a/apps/systemcmds/calibration/channels_cal.c +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * channels_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler <wenzlern@ethz.ch> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ -#define ABS(a) (((a) < 0) ? -(a) : (a)) -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t old_values[NR_CHANNELS]; -uint16_t cur_values[NR_CHANNELS]; -uint8_t function_map[NR_CHANNELS]; -char names[12][9]; - - - -/**************************************************************************** - * Private Functions - ****************************************************************************/ -void press_enter_2(void) -{ - int c; - printf("Press CTRL+ENTER to continue... \n"); - fflush(stdout); - - do c = getchar(); while ((c != '\n') && (c != EOF)); -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_val(uint16_t *buffer) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel: %i\t RAW Value: %i: \n", i, global_data_rc_channels->chan[i].raw); - buffer[i] = global_data_rc_channels->chan[i].raw; - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -void set_channel(void) -{ - static uint8_t j = 0; - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - if (ABS(old_values - cur_values) > 50) { - function_map[j] = i; - strcpy(names[i], global_data_rc_channels->function_names[j]); - j++; - } - } -} - -void write_dat(void) -{ - global_data_lock(&global_data_rc_channels->access_conf); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - global_data_rc_channels->function[i] = function_map[i]; - strcpy(global_data_rc_channels->chan[i].name, names[i]); - - printf("Channel %i\t Function %s\n", i, - global_data_rc_channels->chan[i].name); - } - - global_data_unlock(&global_data_rc_channels->access_conf); -} - - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int channels_cal(int argc, char *argv[]) -{ - - printf("This routine maps the input functions on the remote control\n"); - printf("to the corresponding function (Throttle, Roll,..)\n"); - printf("Always move the stick all the way\n"); - press_enter_2(); - - printf("Pull the THROTTLE stick down\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Move the THROTTLE stick up\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Pull the PITCH stick down\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Move the PITCH stick up\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Put the ROLL stick to the left\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Put the ROLL stick to the right\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - printf("Put the YAW stick to the left\n"); - press_enter_2(); - - while (get_val(old_values)); - - printf("Put the YAW stick to the right\n "); - press_enter_2(); - - while (get_val(cur_values)); - - set_channel(); - - uint8_t k; - - for (k = 5; k < NR_CHANNELS; k++) { - function_map[k] = k; - strcpy(names[k], global_data_rc_channels->function_names[k]); - } - -//write the values to global_data_rc_channels - write_dat(); - - return 0; - -} - diff --git a/apps/systemcmds/calibration/range_cal.c b/apps/systemcmds/calibration/range_cal.c deleted file mode 100755 index 159a0d06b..000000000 --- a/apps/systemcmds/calibration/range_cal.c +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** - * range_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler <wenzlern@ethz.ch> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t max_values[NR_CHANNELS]; -uint16_t min_values[NR_CHANNELS]; -uint16_t mid_values[NR_CHANNELS]; - - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**This sets the middle values - */ -uint8_t set_mid(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - if (i == global_data_rc_channels->function[ROLL] || - i == global_data_rc_channels->function[YAW] || - i == global_data_rc_channels->function[PITCH]) { - - mid_values[i] = global_data_rc_channels->chan[i].raw; - - } else { - mid_values[i] = (max_values[i] + min_values[i]) / 2; - } - - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_value(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - //see if the value is bigger or smaller than 1500 (roughly neutral) - //and write to the appropriate array - if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw < 1500) { - min_values[i] = global_data_rc_channels->chan[i].raw; - - } else if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw > 1500) { - max_values[i] = global_data_rc_channels->chan[i].raw; - - } else { - max_values[i] = 0; - min_values[i] = 0; - } - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - - -void write_data(void) -{ - // global_data_lock(&global_data_rc_channels->access_conf); - // uint8_t i; - // for(i=0; i < NR_CHANNELS; i++){ - // //Write the data to global_data_rc_channels (if not 0) - // if(mid_values[i]!=0 && min_values[i]!=0 && max_values[i]!=0){ - // global_data_rc_channels->chan[i].scaling_factor = - // 10000/((max_values[i] - min_values[i])/2); - // - // global_data_rc_channels->chan[i].mid = mid_values[i]; - // } - // - // printf("Channel %i\t Function %s \t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - // i, - // global_data_rc_channels->function_name[global_data_rc_channels->function[i]], - // min_values[i], max_values[i], - // global_data_rc_channels->chan[i].scaling_factor, - // global_data_rc_channels->chan[i].mid); - // } - // global_data_unlock(&global_data_rc_channels->access_conf); - - //Write to the Parameter storage - - global_data_parameter_storage->pm.param_values[PARAM_RC1_MIN] = min_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_MIN] = min_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_MIN] = min_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_MIN] = min_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_MIN] = min_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_MIN] = min_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_MIN] = min_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_MIN] = min_values[7]; - - - global_data_parameter_storage->pm.param_values[PARAM_RC1_MAX] = max_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_MAX] = max_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_MAX] = max_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_MAX] = max_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_MAX] = max_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_MAX] = max_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_MAX] = max_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_MAX] = max_values[7]; - - - global_data_parameter_storage->pm.param_values[PARAM_RC1_TRIM] = mid_values[0]; - global_data_parameter_storage->pm.param_values[PARAM_RC2_TRIM] = mid_values[1]; - global_data_parameter_storage->pm.param_values[PARAM_RC3_TRIM] = mid_values[2]; - global_data_parameter_storage->pm.param_values[PARAM_RC4_TRIM] = mid_values[3]; - global_data_parameter_storage->pm.param_values[PARAM_RC5_TRIM] = mid_values[4]; - global_data_parameter_storage->pm.param_values[PARAM_RC6_TRIM] = mid_values[5]; - global_data_parameter_storage->pm.param_values[PARAM_RC7_TRIM] = mid_values[6]; - global_data_parameter_storage->pm.param_values[PARAM_RC8_TRIM] = mid_values[7]; - - usleep(3e6); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel %i:\t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - i, - min_values[i], max_values[i], - global_data_rc_channels->chan[i].scaling_factor, - global_data_rc_channels->chan[i].mid); - } - - -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int range_cal(int argc, char *argv[]) -{ - - printf("The range calibration routine assumes you already did the channel\n"); - printf("assignment\n"); - printf("This routine chooses the minimum, maximum and middle\n"); - printf("value for each channel separatly. The ROLL, PITCH and YAW function\n"); - printf("get their middle value from the RC direct, for the rest it is\n"); - printf("calculated out of the min and max values.\n"); - press_enter(); - - printf("Hold both sticks in lower left corner and continue\n "); - press_enter(); - usleep(500000); - - while (get_value()); - - printf("Hold both sticks in upper right corner and continue\n"); - press_enter(); - usleep(500000); - - while (get_value()); - - printf("Set the trim to 0 and leave the sticks in the neutral position\n"); - press_enter(); - - //Loop until successfull - while (set_mid()); - - //write the values to global_data_rc_channels - write_data(); - - return 0; - -} - diff --git a/apps/systemcmds/calibration/servo_cal.c b/apps/systemcmds/calibration/servo_cal.c deleted file mode 100644 index 96b3045a9..000000000 --- a/apps/systemcmds/calibration/servo_cal.c +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** - * servo_cal.c - * - * Copyright (C) 2012 Nils Wenzler. All rights reserved. - * Authors: Nils Wenzler <wenzlern@ethz.ch> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ -#include <stdio.h> -#include <stdlib.h> -#include <arch/board/drv_pwm_servo.h> -#include <fcntl.h> -#include "calibration.h" - -/**************************************************************************** - * Defines - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ -//Store the values here before writing them to global_data_rc_channels -uint16_t max_values_servo[PWM_SERVO_MAX_CHANNELS]; -uint16_t min_values_servo[PWM_SERVO_MAX_CHANNELS]; -uint16_t mid_values_servo[PWM_SERVO_MAX_CHANNELS]; - -// Servo loop thread - -pthread_t servo_calib_thread; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**This sets the middle values - */ -uint8_t set_mid_s(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < PWM_SERVO_MAX_CHANNELS; i++) { - if (i == global_data_rc_channels->function[ROLL] || - i == global_data_rc_channels->function[YAW] || - i == global_data_rc_channels->function[PITCH]) { - - mid_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else { - mid_values_servo[i] = (max_values_servo[i] + min_values_servo[i]) / 2; - } - - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - -/**This gets all current values and writes them to min or max - */ -uint8_t get_value_s(void) -{ - if (0 == global_data_trylock(&global_data_rc_channels->access_conf)) { - uint8_t i; - - for (i = 0; i < PWM_SERVO_MAX_CHANNELS; i++) { - //see if the value is bigger or smaller than 1500 (roughly neutral) - //and write to the appropriate array - if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw < 1500) { - min_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else if (global_data_rc_channels->chan[i].raw != 0 && - global_data_rc_channels->chan[i].raw > 1500) { - max_values_servo[i] = global_data_rc_channels->chan[i].raw; - - } else { - max_values_servo[i] = 0; - min_values_servo[i] = 0; - } - } - - global_data_unlock(&global_data_rc_channels->access_conf); - return 0; - - } else - return -1; -} - - -void write_data_s(void) -{ - // global_data_lock(&global_data_rc_channels->access_conf); - // uint8_t i; - // for(i=0; i < NR_CHANNELS; i++){ - // //Write the data to global_data_rc_channels (if not 0) - // if(mid_values_servo[i]!=0 && min_values_servo[i]!=0 && max_values_servo[i]!=0){ - // global_data_rc_channels->chan[i].scaling_factor = - // 10000/((max_values_servo[i] - min_values_servo[i])/2); - // - // global_data_rc_channels->chan[i].mid = mid_values_servo[i]; - // } - // - // printf("Channel %i\t Function %s \t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - // i, - // global_data_rc_channels->function_name[global_data_rc_channels->function[i]], - // min_values_servo[i], max_values_servo[i], - // global_data_rc_channels->chan[i].scaling_factor, - // global_data_rc_channels->chan[i].mid); - // } - // global_data_unlock(&global_data_rc_channels->access_conf); - - //Write to the Parameter storage - - - - global_data_lock(&global_data_parameter_storage->access_conf); - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_MIN] = min_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_MIN] = min_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_MIN] = min_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_MIN] = min_values_servo[3]; - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_MAX] = max_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_MAX] = max_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_MAX] = max_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_MAX] = max_values_servo[3]; - - global_data_parameter_storage->pm.param_values[PARAM_SERVO1_TRIM] = mid_values_servo[0]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO2_TRIM] = mid_values_servo[1]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO3_TRIM] = mid_values_servo[2]; - global_data_parameter_storage->pm.param_values[PARAM_SERVO4_TRIM] = mid_values_servo[3]; - - global_data_unlock(&global_data_parameter_storage->access_conf); - - usleep(3e6); - uint8_t i; - - for (i = 0; i < NR_CHANNELS; i++) { - printf("Channel %i:\t\t Min %i\t\t Max %i\t\t Scaling Factor: %i\t Middle Value %i\n", - i, - min_values_servo[i], max_values_servo[i], - global_data_rc_channels->chan[i].scaling_factor, - global_data_rc_channels->chan[i].mid); - } - -} - -static void *servo_loop(void *arg) -{ - - // Set thread name - prctl(1, "calibration servo", getpid()); - - // initialize servos - int fd; - servo_position_t data[PWM_SERVO_MAX_CHANNELS]; - - fd = open("/dev/pwm_servo", O_RDWR); - - if (fd < 0) { - printf("failed opening /dev/pwm_servo\n"); - } - - ioctl(fd, PWM_SERVO_ARM, 0); - - while (1) { - int i; - - for (i = 0; i < 4; i++) { - data[i] = global_data_rc_channels->chan[global_data_rc_channels->function[THROTTLE]].raw; - } - - int result = write(fd, &data, sizeof(data)); - - if (result != sizeof(data)) { - printf("failed bulk-reading channel values\n"); - } - - // 5Hz loop - usleep(200000); - } - - return NULL; -} - - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -int servo_cal(int argc, char *argv[]) -{ - // pthread_attr_t servo_loop_attr; - // pthread_attr_init(&servo_loop_attr); - // pthread_attr_setstacksize(&servo_loop_attr, 1024); - pthread_create(&servo_calib_thread, NULL, servo_loop, NULL); - pthread_join(servo_calib_thread, NULL); - - printf("The servo calibration routine assumes you already did the channel\n"); - printf("assignment with 'calibration channels'\n"); - printf("This routine chooses the minimum, maximum and middle\n"); - printf("value for each channel separately. The ROLL, PITCH and YAW function\n"); - printf("get their middle value from the RC direct, for the rest it is\n"); - printf("calculated out of the min and max values.\n"); - press_enter(); - - printf("Hold both sticks in lower left corner and continue\n "); - press_enter(); - usleep(500000); - - while (get_value_s()); - - printf("Hold both sticks in upper right corner and continue\n"); - press_enter(); - usleep(500000); - - while (get_value_s()); - - printf("Set the trim to 0 and leave the sticks in the neutral position\n"); - press_enter(); - - //Loop until successfull - while (set_mid_s()); - - //write the values to global_data_rc_channels - write_data_s(); - - return 0; - -} - diff --git a/apps/systemcmds/delay_test/delay_test.c b/apps/systemcmds/delay_test/delay_test.c deleted file mode 100644 index 51cce38fc..000000000 --- a/apps/systemcmds/delay_test/delay_test.c +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: Lorenz Meier <lm@inf.ethz.ch> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file delay_test.c - * - * Simple but effective delay test using leds and a scope to measure - * communication delays end-to-end accurately. - * - * @author Lorenz Meier <lm@inf.ethz.ch> - */ - -#include <nuttx/config.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <fcntl.h> -#include <errno.h> -#include <poll.h> -#include <string.h> - -#include <systemlib/err.h> - -#include <drivers/drv_led.h> -#include <drivers/drv_hrt.h> -#include <drivers/drv_tone_alarm.h> - -#include <uORB/topics/vehicle_vicon_position.h> -#include <uORB/topics/vehicle_command.h> - -__EXPORT int delay_test_main(int argc, char *argv[]); -static int led_on(int leds, int led); -static int led_off(int leds, int led); - -int delay_test_main(int argc, char *argv[]) -{ - bool vicon_msg = false; - bool command_msg = false; - - if (argc > 1 && !strcmp(argv[1], "--help")) { - warnx("usage: delay_test [vicon] [command]\n"); - exit(1); - } - - if (argc > 1 && !strcmp(argv[1], "vicon")) { - vicon_msg = true; - } - - if (argc > 1 && !strcmp(argv[1], "command")) { - command_msg = true; - } - - int buzzer = open("/dev/tone_alarm", O_WRONLY); - int leds = open(LED_DEVICE_PATH, 0); - - /* prepare use of amber led */ - led_off(leds, LED_AMBER); - - int topic; - - /* subscribe to topic */ - if (vicon_msg) { - topic = orb_subscribe(ORB_ID(vehicle_vicon_position)); - } else if (command_msg) { - topic = orb_subscribe(ORB_ID(vehicle_command)); - } else { - errx(1, "No topic selected for delay test, use --help for a list of topics."); - } - - const int testcount = 20; - - warnx("running %d iterations..\n", testcount); - - struct pollfd fds[1]; - fds[0].fd = topic; - fds[0].events = POLLIN; - - /* display and sound error */ - for (int i = 0; i < testcount; i++) - { - /* wait for topic */ - int ret = poll(&fds[0], 1, 2000); - - /* this would be bad... */ - if (ret < 0) { - warnx("poll error %d", errno); - usleep(1000000); - continue; - } - - /* do we have a topic update? */ - if (fds[0].revents & POLLIN) { - - /* copy object to disable poll ready state */ - if (vicon_msg) { - struct vehicle_vicon_position_s vicon_position; - orb_copy(ORB_ID(vehicle_vicon_position), topic, &vicon_position); - } else if (command_msg) { - struct vehicle_command_s vehicle_command; - orb_copy(ORB_ID(vehicle_command), topic, &vehicle_command); - } - - led_on(leds, LED_AMBER); - ioctl(buzzer, TONE_SET_ALARM, 4); - /* keep led on for 50 ms to make it barely visible */ - usleep(50000); - led_off(leds, LED_AMBER); - } - } - - /* stop alarm */ - ioctl(buzzer, TONE_SET_ALARM, 0); - - /* switch on leds */ - led_on(leds, LED_BLUE); - led_on(leds, LED_AMBER); - - exit(0); -} - -static int led_off(int leds, int led) -{ - return ioctl(leds, LED_OFF, led); -} - -static int led_on(int leds, int led) -{ - return ioctl(leds, LED_ON, led); -}
\ No newline at end of file diff --git a/apps/systemcmds/eeprom/Makefile b/apps/systemcmds/eeprom/Makefile deleted file mode 100644 index 79a05550e..000000000 --- a/apps/systemcmds/eeprom/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Build the eeprom tool. -# - -APPNAME = eeprom -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/perf/.context b/apps/systemcmds/perf/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/systemcmds/perf/.context +++ /dev/null diff --git a/apps/systemcmds/preflight_check/Makefile b/apps/systemcmds/preflight_check/Makefile deleted file mode 100644 index 98aadaa86..000000000 --- a/apps/systemcmds/preflight_check/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# Reboot command. -# - -APPNAME = preflight_check -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/reboot/.context b/apps/systemcmds/reboot/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/systemcmds/reboot/.context +++ /dev/null diff --git a/apps/systemcmds/top/.context b/apps/systemcmds/top/.context deleted file mode 100644 index e69de29bb..000000000 --- a/apps/systemcmds/top/.context +++ /dev/null diff --git a/apps/systemcmds/top/Makefile b/apps/systemcmds/top/Makefile deleted file mode 100644 index f58f9212e..000000000 --- a/apps/systemcmds/top/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################ -# -# Copyright (C) 2012 PX4 Development Team. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name PX4 nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -# -# realtime system performance display -# - -APPNAME = top -PRIORITY = SCHED_PRIORITY_DEFAULT - 10 -STACKSIZE = 3000 - -include $(APPDIR)/mk/app.mk - -MAXOPTIMIZATION = -Os diff --git a/apps/systemlib/Makefile b/apps/systemlib/Makefile index 8240dbe43..b2e233a92 100644 --- a/apps/systemlib/Makefile +++ b/apps/systemlib/Makefile @@ -44,17 +44,9 @@ CSRCS = err.c \ cpuload.c \ getopt_long.c \ up_cxxinitialize.c \ - airspeed.c - -# ppm_decode.c \ - -# -# XXX this really should be a CONFIG_* test -# -ifeq ($(TARGET),px4fmu) -CSRCS += systemlib.c \ pid/pid.c \ - geo/geo.c -endif + geo/geo.c \ + systemlib.c \ + airspeed.c include $(APPDIR)/mk/app.mk diff --git a/makefiles/board_px4fmu.mk b/makefiles/board_px4fmu.mk new file mode 100644 index 000000000..837069644 --- /dev/null +++ b/makefiles/board_px4fmu.mk @@ -0,0 +1,10 @@ +# +# Board-specific definitions for the PX4FMU +# + +# +# Configure the toolchain +# +CONFIG_ARCH = CORTEXM4F + +include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/board_px4io.mk b/makefiles/board_px4io.mk new file mode 100644 index 000000000..b0eb2dae7 --- /dev/null +++ b/makefiles/board_px4io.mk @@ -0,0 +1,10 @@ +# +# Board-specific definitions for the PX4IO +# + +# +# Configure the toolchain +# +CONFIG_ARCH = CORTEXM3 + +include $(PX4_MK_DIR)/toolchain_gnu-arm-eabi.mk diff --git a/makefiles/config_px4fmu_default.mk b/makefiles/config_px4fmu_default.mk new file mode 100644 index 000000000..0767f7144 --- /dev/null +++ b/makefiles/config_px4fmu_default.mk @@ -0,0 +1,88 @@ +# +# Makefile for the px4fmu_default configuration +# + +# +# Use the configuration's ROMFS. +# +ROMFS_ROOT = $(PX4_BASE)/ROMFS/px4fmu_common + +# +# Board support modules +# +MODULES += drivers/px4io +MODULES += drivers/px4fmu +MODULES += drivers/boards/px4fmu +MODULES += drivers/ardrone_interface +MODULES += drivers/l3gd20 +MODULES += drivers/bma180 +MODULES += drivers/mpu6000 +MODULES += drivers/hmc5883 +MODULES += drivers/ms5611 +MODULES += drivers/mb12xx +MODULES += drivers/gps +MODULES += drivers/hil +MODULES += drivers/hott_telemetry +MODULES += drivers/blinkm +MODULES += modules/sensors + +# +# System commands +# +MODULES += systemcmds/eeprom +MODULES += systemcmds/bl_update +MODULES += systemcmds/boardinfo +MODULES += systemcmds/i2c +MODULES += systemcmds/mixer +MODULES += systemcmds/param +MODULES += systemcmds/perf +MODULES += systemcmds/preflight_check +MODULES += systemcmds/pwm +MODULES += systemcmds/reboot +MODULES += systemcmds/top +MODULES += systemcmds/tests + +# +# General system control +# +MODULES += modules/commander +MODULES += modules/mavlink +MODULES += modules/mavlink_onboard + +# +# Estimation modules (EKF / other filters) +# +MODULES += modules/attitude_estimator_ekf +MODULES += modules/position_estimator_mc +MODULES += modules/att_pos_estimator_ekf + +# +# Logging +# +MODULES += modules/sdlog + +# +# Transitional support - add commands from the NuttX export archive. +# +# In general, these should move to modules over time. +# +# Each entry here is <command>.<priority>.<stacksize>.<entrypoint> but we use a helper macro +# to make the table a bit more readable. +# +define _B + $(strip $1).$(or $(strip $2),SCHED_PRIORITY_DEFAULT).$(or $(strip $3),CONFIG_PTHREAD_STACK_DEFAULT).$(strip $4) +endef + +# command priority stack entrypoint +BUILTIN_COMMANDS := \ + $(call _B, adc, , 2048, adc_main ) \ + $(call _B, control_demo, , 2048, control_demo_main ) \ + $(call _B, fixedwing_att_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_att_control_main ) \ + $(call _B, fixedwing_pos_control, SCHED_PRIORITY_MAX-30, 2048, fixedwing_pos_control_main ) \ + $(call _B, math_demo, , 8192, math_demo_main ) \ + $(call _B, multirotor_att_control, SCHED_PRIORITY_MAX-15, 2048, multirotor_att_control_main) \ + $(call _B, multirotor_pos_control, SCHED_PRIORITY_MAX-25, 2048, multirotor_pos_control_main) \ + $(call _B, sercon, , 2048, sercon_main ) \ + $(call _B, serdis, , 2048, serdis_main ) \ + $(call _B, tone_alarm, , 2048, tone_alarm_main ) \ + $(call _B, uorb, , 4096, uorb_main ) diff --git a/makefiles/config_px4io_default.mk b/makefiles/config_px4io_default.mk new file mode 100644 index 000000000..dc774fe63 --- /dev/null +++ b/makefiles/config_px4io_default.mk @@ -0,0 +1,5 @@ +# +# Makefile for the px4io_default configuration +# + +# ... nothing here yet diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk new file mode 100644 index 000000000..fff0e1c65 --- /dev/null +++ b/makefiles/firmware.mk @@ -0,0 +1,443 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Generic Makefile for PX4 firmware images. +# +# Requires: +# +# BOARD +# Must be set to a board name known to the PX4 distribution (as +# we need a corresponding NuttX export archive to link with). +# +# Optional: +# +# MODULES +# Contains a list of module paths or path fragments used +# to find modules. The names listed here are searched in +# the following directories: +# <absolute path> +# $(MODULE_SEARCH_DIRS) +# WORK_DIR +# MODULE_SRC +# PX4_MODULE_SRC +# +# Application directories are expected to contain a module.mk +# file which provides build configuration for the module. See +# makefiles/module.mk for more details. +# +# BUILTIN_COMMANDS +# Contains a list of built-in commands not explicitly provided +# by modules / libraries. Each entry in this list is formatted +# as <command>.<priority>.<stacksize>.<entrypoint> +# +# PX4_BASE: +# Points to a PX4 distribution. Normally determined based on the +# path to this file. +# +# CONFIG: +# Used when searching for the configuration file, and available +# to module Makefiles to select optional features. +# If not set, CONFIG_FILE must be set and CONFIG will be derived +# automatically from it. +# +# CONFIG_FILE: +# If set, overrides the configuration file search logic. Sets +# CONFIG to the name of the configuration file, strips any +# leading config_ prefix and any suffix. e.g. config_board_foo.mk +# results in CONFIG being set to 'board_foo'. +# +# WORK_DIR: +# Sets the directory in which the firmware will be built. Defaults +# to the directory 'build' under the directory containing the +# parent Makefile. +# +# ROMFS_ROOT: +# If set to the path to a directory, a ROMFS image will be generated +# containing the files under the directory and linked into the final +# image. +# +# MODULE_SEARCH_DIRS: +# Extra directories to search first for MODULES before looking in the +# usual places. +# + +################################################################################ +# Paths and configuration +################################################################################ + +# +# Work out where this file is, so we can find other makefiles in the +# same directory. +# +# If PX4_BASE wasn't set previously, work out what it should be +# and set it here now. +# +MK_DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) +ifeq ($(PX4_BASE),) +export PX4_BASE := $(abspath $(MK_DIR)/..) +endif +$(info % PX4_BASE = $(PX4_BASE)) +ifneq ($(words $(PX4_BASE)),1) +$(error Cannot build when the PX4_BASE path contains one or more space characters.) +endif + +# +# Set a default target so that included makefiles or errors here don't +# cause confusion. +# +# XXX We could do something cute here with $(DEFAULT_GOAL) if it's not one +# of the maintenance targets and set CONFIG based on it. +# +all: firmware + +# +# Get path and tool config +# +include $(MK_DIR)/setup.mk + +# +# Locate the configuration file +# +ifneq ($(CONFIG_FILE),) +CONFIG := $(subst config_,,$(basename $(notdir $(CONFIG_FILE)))) +else +CONFIG_FILE := $(wildcard $(PX4_MK_DIR)/config_$(CONFIG).mk) +endif +ifeq ($(CONFIG),) +$(error Missing configuration name or file (specify with CONFIG=<config>)) +endif +export CONFIG +include $(CONFIG_FILE) +$(info % CONFIG = $(CONFIG)) + +# +# Sanity-check the BOARD variable and then get the board config. +# If BOARD was not set by the configuration, extract it automatically. +# +# The board config in turn will fetch the toolchain configuration. +# +ifeq ($(BOARD),) +BOARD := $(firstword $(subst _, ,$(CONFIG))) +endif +BOARD_FILE := $(wildcard $(PX4_MK_DIR)/board_$(BOARD).mk) +ifeq ($(BOARD_FILE),) +$(error Config $(CONFIG) references board $(BOARD), but no board definition file found) +endif +export BOARD +include $(BOARD_FILE) +$(info % BOARD = $(BOARD)) + +# +# If WORK_DIR is not set, create a 'build' directory next to the +# parent Makefile. +# +PARENT_MAKEFILE := $(lastword $(filter-out $(lastword $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) +ifeq ($(WORK_DIR),) +export WORK_DIR := $(dir $(PARENT_MAKEFILE))build/ +endif +$(info % WORK_DIR = $(WORK_DIR)) + +# +# Things that, if they change, might affect everything +# +GLOBAL_DEPS += $(MAKEFILE_LIST) + +# +# Extra things we should clean +# +EXTRA_CLEANS = + +################################################################################ +# Modules +################################################################################ + +# +# We don't actually know what a module is called; all we have is a path fragment +# that we can search for, and where we expect to find a module.mk file. +# +# As such, we replicate the successfully-found path inside WORK_DIR for the +# module's build products in order to keep modules separated from each other. +# +# XXX If this becomes unwieldy or breaks for other reasons, we will need to +# move to allocating directory names and keeping tabs on makefiles via +# the directory name. That will involve arithmetic (it'd probably be time +# for GMSL). + +# where to look for modules +MODULE_SEARCH_DIRS += $(WORK_DIR) $(MODULE_SRC) $(PX4_MODULE_SRC) + +# sort and unique the modules list +MODULES := $(sort $(MODULES)) + +# locate the first instance of a module by full path or by looking on the +# module search path +define MODULE_SEARCH + $(abspath $(firstword $(wildcard $(1)/module.mk) \ + $(foreach search_dir,$(MODULE_SEARCH_DIRS),$(wildcard $(search_dir)/$(1)/module.mk)) \ + MISSING_$1)) +endef + +# make a list of module makefiles and check that we found them all +MODULE_MKFILES := $(foreach module,$(MODULES),$(call MODULE_SEARCH,$(module))) +MISSING_MODULES := $(subst MISSING_,,$(filter MISSING_%,$(MODULE_MKFILES))) +ifneq ($(MISSING_MODULES),) +$(error Can't find module(s): $(MISSING_MODULES)) +endif + +# Make a list of the object files we expect to build from modules +# Note that this path will typically contain a double-slash at the WORK_DIR boundary; this must be +# preserved as it is used below to get the absolute path for the module.mk file correct. +# +MODULE_OBJS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)module.pre.o) + +# rules to build module objects +.PHONY: $(MODULE_OBJS) +$(MODULE_OBJS): relpath = $(patsubst $(WORK_DIR)%,%,$@) +$(MODULE_OBJS): mkfile = $(patsubst %module.pre.o,%module.mk,$(relpath)) +$(MODULE_OBJS): $(GLOBAL_DEPS) $(NUTTX_CONFIG_HEADER) + $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ + MODULE_WORK_DIR=$(dir $@) \ + MODULE_OBJ=$@ \ + MODULE_MK=$(mkfile) \ + MODULE_NAME=$(lastword $(subst /, ,$(@D))) \ + module + +# make a list of phony clean targets for modules +MODULE_CLEANS := $(foreach path,$(dir $(MODULE_MKFILES)),$(WORK_DIR)$(path)/clean) + +# rules to clean modules +.PHONY: $(MODULE_CLEANS) +$(MODULE_CLEANS): relpath = $(patsubst $(WORK_DIR)%,%,$@) +$(MODULE_CLEANS): mkfile = $(patsubst %clean,%module.mk,$(relpath)) +$(MODULE_CLEANS): + @$(ECHO) %% cleaning using $(mkfile) + $(Q) $(MAKE) -r -f $(PX4_MK_DIR)module.mk \ + MODULE_WORK_DIR=$(dir $@) \ + MODULE_MK=$(mkfile) \ + clean + +################################################################################ +# NuttX libraries and paths +################################################################################ + +include $(PX4_MK_DIR)/nuttx.mk + +################################################################################ +# ROMFS generation +################################################################################ + +ifneq ($(ROMFS_ROOT),) +ifeq ($(wildcard $(ROMFS_ROOT)),) +$(error ROMFS_ROOT specifies a directory that does not exist) +endif + +# +# Note that there is no support for more than one root directory or constructing +# a root from several templates. That would be a nice feature. +# + +# Add dependencies on anything in the ROMFS root +ROMFS_DEPS += $(wildcard \ + (ROMFS_ROOT)/* \ + (ROMFS_ROOT)/*/* \ + (ROMFS_ROOT)/*/*/* \ + (ROMFS_ROOT)/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/* \ + (ROMFS_ROOT)/*/*/*/*/*/*) +ROMFS_IMG = $(WORK_DIR)romfs.img +ROMFS_CSRC = $(ROMFS_IMG:.img=.c) +ROMFS_OBJ = $(ROMFS_CSRC:.c=.o) +LIBS += $(ROMFS_OBJ) +LINK_DEPS += $(ROMFS_OBJ) + +# Turn the ROMFS image into an object file +$(ROMFS_OBJ): $(ROMFS_IMG) $(GLOBAL_DEPS) + $(call BIN_TO_OBJ,$<,$@,romfs_img) + +# Generate the ROMFS image from the root +$(ROMFS_IMG): $(ROMFS_DEPS) $(GLOBAL_DEPS) + @$(ECHO) "ROMFS: $@" + $(Q) $(GENROMFS) -f $@ -d $(ROMFS_ROOT) -V "NSHInitVol" + +EXTRA_CLEANS += $(ROMGS_OBJ) $(ROMFS_IMG) + +endif + +################################################################################ +# Builtin command list generation +################################################################################ + +# +# Builtin commands can be generated by the configuration, in which case they +# must refer to commands that already exist, or indirectly generated by modules +# when they are built. +# +# The configuration supplies builtin command information in the BUILTIN_COMMANDS +# variable. Applications make empty files in $(WORK_DIR)/builtin_commands whose +# filename contains the same information. +# +# In each case, the command information consists of four fields separated with a +# period. These fields are the command's name, its thread priority, its stack size +# and the name of the function to call when starting the thread. +# +BUILTIN_CSRC = $(WORK_DIR)builtin_commands.c + +# command definitions from modules (may be empty at Makefile parsing time...) +MODULE_COMMANDS = $(subst COMMAND.,,$(notdir $(wildcard $(WORK_DIR)builtin_commands/COMMAND.*))) + +# We must have at least one pre-defined builtin command in order to generate +# any of this. +# +ifneq ($(BUILTIN_COMMANDS),) + +# (BUILTIN_PROTO,<cmdspec>,<outputfile>) +define BUILTIN_PROTO + $(ECHO) 'extern int $(word 4,$1)(int argc, char *argv[]);' >> $2; +endef + +# (BUILTIN_DEF,<cmdspec>,<outputfile>) +define BUILTIN_DEF + $(ECHO) ' {"$(word 1,$1)", $(word 2,$1), $(word 3,$1), $(word 4,$1)},' >> $2; +endef + +# Don't generate until modules have updated their command files +$(BUILTIN_CSRC): $(GLOBAL_DEPS) $(MODULE_OBJS) $(BUILTIN_COMMAND_FILES) + @$(ECHO) "CMDS: $@" + $(Q) $(ECHO) '/* builtin command list - automatically generated, do not edit */' > $@ + $(Q) $(ECHO) '#include <nuttx/config.h>' >> $@ + $(Q) $(ECHO) '#include <nuttx/binfmt/builtin.h>' >> $@ + $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) + $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_PROTO,$(subst ., ,$(spec)),$@)) + $(Q) $(ECHO) 'const struct builtin_s g_builtins[] = {' >> $@ + $(Q) $(foreach spec,$(BUILTIN_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) + $(Q) $(foreach spec,$(MODULE_COMMANDS),$(call BUILTIN_DEF,$(subst ., ,$(spec)),$@)) + $(Q) $(ECHO) ' {NULL, 0, 0, NULL}' >> $@ + $(Q) $(ECHO) '};' >> $@ + $(Q) $(ECHO) 'const int g_builtin_count = $(words $(BUILTIN_COMMANDS) $(MODULE_COMMANDS));' >> $@ + +SRCS += $(BUILTIN_CSRC) + +EXTRA_CLEANS += $(BUILTIN_CSRC) + +endif + +################################################################################ +# Default SRCS generation +################################################################################ + +# +# If there are no SRCS, the build will fail; in that case, generate an empty +# source file. +# +ifeq ($(SRCS),) +EMPTY_SRC = $(WORK_DIR)empty.c +$(EMPTY_SRC): + $(Q) $(ECHO) '/* this is an empty file */' > $@ + +SRCS += $(EMPTY_SRC) +endif + +################################################################################ +# Build rules +################################################################################ + +# +# What we're going to build. +# +PRODUCT_BUNDLE = $(WORK_DIR)firmware.px4 +PRODUCT_BIN = $(WORK_DIR)firmware.bin +PRODUCT_ELF = $(WORK_DIR)firmware.elf + +.PHONY: firmware +firmware: $(PRODUCT_BUNDLE) + +# +# Object files we will generate from sources +# +OBJS := $(foreach src,$(SRCS),$(WORK_DIR)$(src).o) + +# +# SRCS -> OBJS rules +# + +$(OBJS): $(GLOBAL_DEPS) + +$(filter %.c.o,$(OBJS)): $(WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) + $(call COMPILE,$<,$@) + +$(filter %.cpp.o,$(OBJS)): $(WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) + $(call COMPILEXX,$<,$@) + +$(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) + $(call ASSEMBLE,$<,$@) + +# +# Built product rules +# + +$(PRODUCT_BUNDLE): $(PRODUCT_BIN) + @$(ECHO) %% Generating $@ + $(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \ + --git_identity $(PX4_BASE) \ + --image $< > $@ + +$(PRODUCT_BIN): $(PRODUCT_ELF) + $(call SYM_TO_BIN,$<,$@) + +$(PRODUCT_ELF): $(OBJS) $(MODULE_OBJS) $(GLOBAL_DEPS) $(LINK_DEPS) $(MODULE_MKFILES) + $(call LINK,$@,$(OBJS) $(MODULE_OBJS)) + +# +# Utility rules +# + +.PHONY: upload +upload: $(PRODUCT_BUNDLE) $(PRODUCT_BIN) + $(Q) $(MAKE) -f $(PX4_MK_DIR)/upload.mk \ + METHOD=serial \ + CONFIG=$(CONFIG) \ + BOARD=$(BOARD) \ + BUNDLE=$(PRODUCT_BUNDLE) \ + BIN=$(PRODUCT_BIN) + +.PHONY: clean +clean: $(MODULE_CLEANS) + @$(ECHO) %% cleaning + $(Q) $(REMOVE) $(PRODUCT_BUNDLE) $(PRODUCT_BIN) $(PRODUCT_ELF) + $(Q) $(REMOVE) $(OBJS) $(DEP_INCLUDES) $(EXTRA_CLEANS) + $(Q) $(RMDIR) $(NUTTX_EXPORT_DIR) + + +# +# DEP_INCLUDES is defined by the toolchain include in terms of $(OBJS) +# +-include $(DEP_INCLUDES) diff --git a/makefiles/module.mk b/makefiles/module.mk new file mode 100644 index 000000000..538f6d318 --- /dev/null +++ b/makefiles/module.mk @@ -0,0 +1,230 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Framework makefile for PX4 modules +# +# This makefile is invoked by firmware.mk to build each of the modules +# that will subsequently be linked into the firmware image. +# +# Applications are built as prelinked objects with a limited set of exported +# symbols, as the global namespace is shared between all modules. Normally an +# module will just export one or more <command>_main functions. +# + +# +# Variables that can be set by the module's module.mk: +# +# +# SRCS (required) +# +# Lists the .c, cpp and .S files that should be compiled/assembled to +# produce the module. +# +# MODULE_COMMAND (optional) +# MODULE_ENTRYPOINT (optional if MODULE_COMMAND is set) +# MODULE_STACKSIZE (optional if MODULE_COMMAND is set) +# MODULE_PRIORITY (optional if MODULE_COMMAND is set) +# +# Defines a single builtin command exported by the module. +# MODULE_COMMAND must be unique for any configuration, but need not be the +# same as the module directory name. +# +# If MODULE_ENTRYPOINT is set, it names the function (which must be exported) +# that will be the entrypoint for the builtin command. It defaults to +# $(MODULE_COMMAND)_main. +# +# If MODULE_STACKSIZE is set, it is the size in bytes of the stack to be +# allocated for the builtin command. If it is not set, it defaults +# to CONFIG_PTHREAD_STACK_DEFAULT. +# +# If MODULE_PRIORITY is set, it is the thread priority for the builtin +# command. If it is not set, it defaults to SCHED_PRIORITY_DEFAULT. +# +# MODULE_COMMANDS (optional if MODULE_COMMAND is not set) +# +# Defines builtin commands exported by the module. Each word in +# the list should be formatted as: +# <command>.<priority>.<stacksize>.<entrypoint> +# +# INCLUDE_DIRS (optional, must be appended) +# +# The list of directories searched for include files. If non-standard +# includes (e.g. those from another module) are required, paths to search +# can be added here. +# +# DEFAULT_VISIBILITY (optional) +# +# If not set, global symbols defined in a module will not be visible +# outside the module. Symbols that should be globally visible must be +# marked __EXPORT. +# If set, global symbols defined in a module will be globally visible. +# + +# +# Variables visible to the module's module.mk: +# +# CONFIG +# BOARD +# MODULE_WORK_DIR +# MODULE_OBJ +# MODULE_MK +# Anything set in setup.mk, board_$(BOARD).mk and the toolchain file. +# Anything exported from config_$(CONFIG).mk +# + +################################################################################ +# No user-serviceable parts below. +################################################################################ + +ifeq ($(MODULE_MK),) +$(error No module makefile specified) +endif +$(info %% MODULE_MK = $(MODULE_MK)) + +# +# Get the board/toolchain config +# +include $(PX4_MK_DIR)/board_$(BOARD).mk + +# +# Get the module's config +# +include $(MODULE_MK) +MODULE_SRC := $(dir $(MODULE_MK)) +$(info % MODULE_NAME = $(MODULE_NAME)) +$(info % MODULE_SRC = $(MODULE_SRC)) +$(info % MODULE_OBJ = $(MODULE_OBJ)) +$(info % MODULE_WORK_DIR = $(MODULE_WORK_DIR)) + +# +# Things that, if they change, might affect everything +# +GLOBAL_DEPS += $(MAKEFILE_LIST) + +################################################################################ +# Builtin command definitions +################################################################################ + +ifneq ($(MODULE_COMMAND),) +MODULE_ENTRYPOINT ?= $(MODULE_COMMAND)_main +MODULE_STACKSIZE ?= CONFIG_PTHREAD_STACK_DEFAULT +MODULE_PRIORITY ?= SCHED_PRIORITY_DEFAULT +MODULE_COMMANDS += $(MODULE_COMMAND).$(MODULE_PRIORITY).$(MODULE_STACKSIZE).$(MODULE_ENTRYPOINT) +endif + +ifneq ($(MODULE_COMMANDS),) +MODULE_COMMAND_FILES := $(addprefix $(WORK_DIR)/builtin_commands/COMMAND.,$(MODULE_COMMANDS)) + +# Create the command files +# Ensure that there is only one entry for each command +# +.PHONY: $(MODULE_COMMAND_FILES) +$(MODULE_COMMAND_FILES): command = $(word 2,$(subst ., ,$(notdir $(@)))) +$(MODULE_COMMAND_FILES): exclude = $(dir $@)COMMAND.$(command).* +$(MODULE_COMMAND_FILES): $(GLOBAL_DEPS) + @$(REMOVE) -f $(exclude) + @$(MKDIR) -p $(dir $@) + @echo "CMD: $(command)" + $(Q) $(TOUCH) $@ +endif + +################################################################################ +# Adjust compilation flags to implement EXPORT +################################################################################ + +ifeq ($(DEFAULT_VISIBILITY),) +DEFAULT_VISIBILITY = hidden +else +DEFAULT_VISIBILITY = default +endif + +CFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h +CXXFLAGS += -fvisibility=$(DEFAULT_VISIBILITY) -include $(PX4_INCLUDE_DIR)visibility.h + +################################################################################ +# Build rules +################################################################################ + +# +# What we're going to build +# +module: $(MODULE_OBJ) $(MODULE_COMMAND_FILES) + +# +# Locate sources (allows relative source paths in module.mk) +# +define SRC_SEARCH + $(abspath $(firstword $(wildcard $(MODULE_SRC)/$1) MISSING_$1)) +endef + +ABS_SRCS := $(foreach src,$(SRCS),$(call SRC_SEARCH,$(src))) +MISSING_SRCS := $(subst MISSING_,,$(filter MISSING_%,$(ABS_SRCS))) +ifneq ($(MISSING_SRCS),) +$(error $(MODULE_MK): missing in SRCS: $(MISSING_SRCS)) +endif +ifeq ($(ABS_SRCS),) +$(error $(MODULE_MK): nothing to compile in SRCS) +endif + +# +# Object files we will generate from sources +# +OBJS := $(foreach src,$(ABS_SRCS),$(MODULE_WORK_DIR)$(src).o) + +# +# SRCS -> OBJS rules +# + +$(OBJS): $(GLOBAL_DEPS) + +$(filter %.c.o,$(OBJS)): $(MODULE_WORK_DIR)%.c.o: %.c $(GLOBAL_DEPS) + $(call COMPILE,$<,$@) + +$(filter %.cpp.o,$(OBJS)): $(MODULE_WORK_DIR)%.cpp.o: %.cpp $(GLOBAL_DEPS) + $(call COMPILEXX,$<,$@) + +$(filter %.S.o,$(OBJS)): $(MODULE_WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS) + $(call ASSEMBLE,$<,$@) + +# +# Built product rules +# + +$(MODULE_OBJ): $(OBJS) $(GLOBAL_DEPS) + $(call PRELINK,$@,$(OBJS)) + +# +# Utility rules +# + +clean: + $(Q) $(REMOVE) $(MODULE_PRELINK) $(OBJS) diff --git a/apps/hott_telemetry/Makefile b/makefiles/nuttx.mk index 8d5faa3b7..346735a02 100644 --- a/apps/hott_telemetry/Makefile +++ b/makefiles/nuttx.mk @@ -1,4 +1,3 @@ -############################################################################ # # Copyright (C) 2012 PX4 Development Team. All rights reserved. # @@ -29,17 +28,51 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -############################################################################ # -# Graupner HoTT Telemetry application. +# Rules and definitions related to handling the NuttX export archives when +# building firmware. # -# The following line is required for accessing UARTs directly. -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common +# +# Check that the NuttX archive for the selected board is available. +# +NUTTX_ARCHIVE := $(wildcard $(ARCHIVE_DIR)$(BOARD).export) +ifeq ($(NUTTX_ARCHIVE),) +$(error The NuttX export archive for $(BOARD) is missing from $(ARCHIVE_DIR) - try 'make archives' in $(PX4_BASE)) +endif + +# +# The NuttX config header should always be present in the NuttX archive, and +# if it changes, everything should be rebuilt. So, use it as the trigger to +# unpack the NuttX archive. +# +NUTTX_EXPORT_DIR = $(WORK_DIR)nuttx-export/ +NUTTX_CONFIG_HEADER = $(NUTTX_EXPORT_DIR)include/nuttx/config.h +$(info % NUTTX_EXPORT_DIR = $(NUTTX_EXPORT_DIR)) +$(info % NUTTX_CONFIG_HEADER = $(NUTTX_CONFIG_HEADER)) + + +GLOBAL_DEPS += $(NUTTX_CONFIG_HEADER) + +# +# Use the linker script from the NuttX export +# +LDSCRIPT += $(NUTTX_EXPORT_DIR)build/ld.script + +# +# Add directories from the NuttX export to the relevant search paths +# +INCLUDE_DIRS += $(NUTTX_EXPORT_DIR)include \ + $(NUTTX_EXPORT_DIR)arch/chip \ + $(NUTTX_EXPORT_DIR)arch/common -APPNAME = hott_telemetry -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +LIB_DIRS += $(NUTTX_EXPORT_DIR)libs +LIBS += -lapps -lnuttx +LINK_DEPS += $(NUTTX_EXPORT_DIR)libs/libapps.a \ + $(NUTTX_EXPORT_DIR)libs/libnuttx.a -include $(APPDIR)/mk/app.mk +$(NUTTX_CONFIG_HEADER): $(NUTTX_ARCHIVE) + @$(ECHO) %% Unpacking $(NUTTX_ARCHIVE) + $(Q) $(UNZIP_CMD) -q -o -d $(WORK_DIR) $(NUTTX_ARCHIVE) + $(Q) $(TOUCH) $@ diff --git a/makefiles/setup.mk b/makefiles/setup.mk new file mode 100644 index 000000000..b798f7cab --- /dev/null +++ b/makefiles/setup.mk @@ -0,0 +1,91 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Path and tool setup +# + +# +# Some useful paths. +# +# Note that in general we always keep directory paths with the separator +# at the end, and join paths without explicit separators. This reduces +# the number of duplicate slashes we have lying around in paths, +# and is consistent with joining the results of $(dir) and $(notdir). +# +export PX4_INCLUDE_DIR = $(abspath $(PX4_BASE)/src/include)/ +export PX4_MODULE_SRC = $(abspath $(PX4_BASE)/src)/ +export PX4_MK_DIR = $(abspath $(PX4_BASE)/makefiles)/ +export NUTTX_SRC = $(abspath $(PX4_BASE)/nuttx)/ +export NUTTX_APP_SRC = $(abspath $(PX4_BASE)/apps)/ +export MAVLINK_SRC = $(abspath $(PX4_BASE)/mavlink)/ +export ROMFS_SRC = $(abspath $(PX4_BASE)/ROMFS)/ +export IMAGE_DIR = $(abspath $(PX4_BASE)/Images)/ +export BUILD_DIR = $(abspath $(PX4_BASE)/Build)/ +export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/ + +# +# Default include paths +# +export INCLUDE_DIRS := $(PX4_MODULE_SRC) \ + $(PX4_INCLUDE_DIR) + +# Include from legacy app/library path +export INCLUDE_DIRS += $(NUTTX_APP_SRC) + +# +# Tools +# +export MKFW = $(PX4_BASE)/Tools/px_mkfw.py +export UPLOADER = $(PX4_BASE)/Tools/px_uploader.py +export COPY = cp +export REMOVE = rm -f +export RMDIR = rm -rf +export GENROMFS = genromfs +export TOUCH = touch +export MKDIR = mkdir +export ECHO = echo +export UNZIP_CMD = unzip + +# +# Host-specific paths, hacks and fixups +# +export SYSTYPE := $(shell uname -s) + +ifeq ($(SYSTYPE),Darwin) +# Eclipse may not have the toolchain on its path. +export PATH := $(PATH):/usr/local/bin +endif + +# +# Makefile debugging. +# +export Q := $(if $(V),,@) diff --git a/makefiles/toolchain_gnu-arm-eabi.mk b/makefiles/toolchain_gnu-arm-eabi.mk new file mode 100644 index 000000000..5e6a5bf04 --- /dev/null +++ b/makefiles/toolchain_gnu-arm-eabi.mk @@ -0,0 +1,265 @@ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# +# Definitions for a generic GNU ARM-EABI toolchain +# + +#$(info TOOLCHAIN gnu-arm-eabi) + +# Toolchain commands. Normally only used inside this file. +# +CROSSDEV = arm-none-eabi- + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +# XXX this is pulled pretty directly from the fmu Make.defs - needs cleanup + +MAXOPTIMIZATION = -O3 + +# Base CPU flags for each of the supported architectures. +# +ARCHCPUFLAGS_CORTEXM4F = -mcpu=cortex-m4 \ + -mthumb \ + -march=armv7e-m \ + -mfpu=fpv4-sp-d16 \ + -mfloat-abi=hard + +ARCHCPUFLAGS_CORTEXM4 = -mcpu=cortex-m4 \ + -mthumb \ + -march=armv7e-m \ + -mfloat-abi=soft + +ARCHCPUFLAGS_CORTEXM3 = -mcpu=cortex-m3 \ + -mthumb \ + -march=armv7-m \ + -mfloat-abi=soft + +# Pick the right set of flags for the architecture. +# +ARCHCPUFLAGS = $(ARCHCPUFLAGS_$(CONFIG_ARCH)) +ifeq ($(ARCHCPUFLAGS),) +$(error Must set CONFIG_ARCH to one of CORTEXM4F, CORTEXM4 or CORTEXM3) +endif + +# optimisation flags +# +ARCHOPTIMIZATION = $(MAXOPTIMIZATION) \ + -g \ + -fno-strict-aliasing \ + -fno-strength-reduce \ + -fomit-frame-pointer \ + -funsafe-math-optimizations \ + -fno-builtin-printf \ + -ffunction-sections \ + -fdata-sections + +# enable precise stack overflow tracking +# note - requires corresponding support in NuttX +INSTRUMENTATIONDEFINES = -finstrument-functions \ + -ffixed-r10 +# Language-specific flags +# +ARCHCFLAGS = -std=gnu99 +ARCHCXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++0x + +# Generic warnings +# +ARCHWARNINGS = -Wall \ + -Wextra \ + -Wdouble-promotion \ + -Wshadow \ + -Wfloat-equal \ + -Wframe-larger-than=1024 \ + -Wpointer-arith \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wpacked \ + -Wno-unused-parameter +# -Wcast-qual - generates spurious noreturn attribute warnings, try again later +# -Wconversion - would be nice, but too many "risky-but-safe" conversions in the code +# -Wcast-align - would help catch bad casts in some cases, but generates too many false positives + +# C-specific warnings +# +ARCHCWARNINGS = $(ARCHWARNINGS) \ + -Wbad-function-cast \ + -Wstrict-prototypes \ + -Wold-style-declaration \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wunsuffixed-float-constants + +# C++-specific warnings +# +ARCHWARNINGSXX = $(ARCHWARNINGS) + +# pull in *just* libm from the toolchain ... this is grody +LIBM := $(shell $(CC) $(ARCHCPUFLAGS) -print-file-name=libm.a) +EXTRA_LIBS += $(LIBM) + +# Flags we pass to the C compiler +# +CFLAGS = $(ARCHCFLAGS) \ + $(ARCHCWARNINGS) \ + $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) \ + $(ARCHINCLUDES) \ + $(INSTRUMENTATIONDEFINES) \ + $(ARCHDEFINES) \ + $(EXTRADEFINES) \ + -fno-common \ + $(addprefix -I,$(INCLUDE_DIRS)) + +# Flags we pass to the C++ compiler +# +CXXFLAGS = $(ARCHCXXFLAGS) \ + $(ARCHWARNINGSXX) \ + $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) \ + $(ARCHXXINCLUDES) \ + $(INSTRUMENTATIONDEFINES) \ + $(ARCHDEFINES) \ + $(EXTRADEFINES) \ + -DCONFIG_WCHAR_BUILTIN \ + $(addprefix -I,$(INCLUDE_DIRS)) + +# Flags we pass to the assembler +# +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +# Flags we pass to the linker +# +LDFLAGS += --warn-common \ + --gc-sections \ + $(addprefix -T,$(LDSCRIPT)) \ + $(addprefix -L,$(LIB_DIRS)) + +# Compiler support library +# +LIBGCC := $(shell $(CC) $(ARCHCPUFLAGS) -print-libgcc-file-name) + +# Files that the final link depends on +# +LINK_DEPS += $(LDSCRIPT) + +# Files to include to get automated dependencies +# +DEP_INCLUDES = $(subst .o,.d,$(OBJS)) + +# Compile C source $1 to object $2 +# as a side-effect, generate a dependency file +# +define COMPILE + @$(ECHO) "CC: $1" + @$(MKDIR) -p $(dir $2) + $(Q) $(CC) -MD -c $(CFLAGS) $(abspath $1) -o $2 +endef + +# Compile C++ source $1 to $2 +# as a side-effect, generate a dependency file +# +define COMPILEXX + @$(ECHO) "CXX: $1" + @$(MKDIR) -p $(dir $2) + $(Q) $(CXX) -MD -c $(CXXFLAGS) $(abspath $1) -o $2 +endef + +# Assemble $1 into $2 +# +define ASSEMBLE + @$(ECHO) "AS: $1" + @$(MKDIR) -p $(dir $2) + $(Q) $(CC) -c $(AFLAGS) $(abspath $1) -o $2 +endef + +# Produce partially-linked $1 from files in $2 +# +define PRELINK + @$(ECHO) "PRELINK: $1" + @$(MKDIR) -p $(dir $1) + $(Q) $(LD) -Ur -o $1 $2 && $(OBJCOPY) --localize-hidden $1 +endef + +# Update the archive $1 with the files in $2 +# +define ARCHIVE + @$(ECHO) "AR: $2" + @$(MKDIR) -p $(dir $1) + $(Q) $(AR) $1 $2 +endef + +# Link the objects in $2 into the binary $1 +# +define LINK + @$(ECHO) "LINK: $1" + @$(MKDIR) -p $(dir $1) + $(Q) $(LD) $(LDFLAGS) -o $1 --start-group $2 $(LIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group +endef + +# Convert $1 from a linked object to a raw binary in $2 +# +define SYM_TO_BIN + @$(ECHO) "BIN: $2" + @$(MKDIR) -p $(dir $2) + $(Q) $(OBJCOPY) -O binary $1 $2 +endef + +# Take the raw binary $1 and make it into an object file $2. +# The symbol $3 points to the beginning of the file, and $3_len +# gives its length. +# +# - compile an empty file to generate a suitable object file +# - relink the object and insert the binary file +# - edit symbol names to suit +# +define BIN_SYM_PREFIX + _binary_$(subst /,_,$(subst .,_,$1)) +endef +define BIN_TO_OBJ + @$(ECHO) "OBJ: $2" + @$(MKDIR) -p $(dir $2) + $(Q) $(ECHO) > $2.c + $(call COMPILE,$2.c,$2.c.o) + $(Q) $(LD) -r -o $2 $2.c.o -b binary $1 + $(Q) $(OBJCOPY) $2 \ + --redefine-sym $(call BIN_SYM_PREFIX,$1)_start=$3 \ + --redefine-sym $(call BIN_SYM_PREFIX,$1)_size=$3_len \ + --strip-symbol $(call BIN_SYM_PREFIX,$1)_end +endef diff --git a/makefiles/upload.mk b/makefiles/upload.mk new file mode 100644 index 000000000..f23d6ae41 --- /dev/null +++ b/makefiles/upload.mk @@ -0,0 +1,41 @@ +# +# Rules and tools for uploading firmware to various PX4 boards. +# + +UPLOADER = $(PX4_BASE)/Tools/px_uploader.py + +SYSTYPE := $(shell uname -s) + +# +# Serial port defaults. +# +# XXX The uploader should be smarter than this. +# +ifeq ($(SYSTYPE),Darwin) +SERIAL_PORTS ?= "/dev/tty.usbmodemPX1,/dev/tty.usbmodemPX2,/dev/tty.usbmodemPX3,/dev/tty.usbmodemPX4,/dev/tty.usbmodem1,/dev/tty.usbmodem2,/dev/tty.usbmodem3,/dev/tty.usbmodem4" +endif +ifeq ($(SYSTYPE),Linux) +SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" +endif +ifeq ($(SERIAL_PORTS),) +SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +endif + +.PHONY: all upload-$(METHOD)-$(BOARD) +all: upload-$(METHOD)-$(BOARD) + +upload-serial-px4fmu: $(BUNDLE) $(UPLOADER) + @python -u $(UPLOADER) --port $(SERIAL_PORTS) $(BUNDLE) + +# +# JTAG firmware uploading with OpenOCD +# +JTAGCONFIG ?= interface/olimex-jtag-tiny.cfg + +upload-jtag-px4fmu: all + @echo Attempting to flash PX4FMU board via JTAG + @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4fmu_bl.elf" -c "reset run" -c shutdown + +upload-jtag-px4io: all + @echo Attempting to flash PX4IO board via JTAG + @openocd -f $(JTAGCONFIG) -f ../Bootloader/stm32f1x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx/nuttx" -c "flash write_image erase ../Bootloader/px4io_bl.elf" -c "reset run" -c shutdown diff --git a/nuttx/configs/px4fmu/include/board.h b/nuttx/configs/px4fmu/include/board.h index 0bc0b3021..294b6c398 100755 --- a/nuttx/configs/px4fmu/include/board.h +++ b/nuttx/configs/px4fmu/include/board.h @@ -308,6 +308,10 @@ #define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1 #define GPIO_SPI1_SCK GPIO_SPI1_SCK_1 +#define GPIO_SPI2_MISO GPIO_SPI2_MISO_2 +#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_2 +#define GPIO_SPI2_SCK GPIO_SPI2_SCK_2 + #define GPIO_SPI3_MISO GPIO_SPI3_MISO_2 #define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_1 #define GPIO_SPI3_SCK GPIO_SPI3_SCK_2 @@ -321,6 +325,8 @@ #define PX4_SPIDEV_ACCEL 2 #define PX4_SPIDEV_MPU 3 +#define PX4_SPIDEV_ACCEL_MAG 2 // external for anti vibration test + /* * Tone alarm output */ diff --git a/nuttx/configs/px4fmu/include/nsh_romfsimg.h b/nuttx/configs/px4fmu/include/nsh_romfsimg.h new file mode 100644 index 000000000..15e4e7a8d --- /dev/null +++ b/nuttx/configs/px4fmu/include/nsh_romfsimg.h @@ -0,0 +1,42 @@ +/**************************************************************************** + * + * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/** + * nsh_romfsetc.h + * + * This file is a stub for 'make export' purposes; the actual ROMFS + * must be supplied by the library client. + */ + +extern unsigned char romfs_img[]; +extern unsigned int romfs_img_len; diff --git a/nuttx/configs/px4fmu/nsh/appconfig b/nuttx/configs/px4fmu/nsh/appconfig index 9e28ff485..6e91f3d1a 100644 --- a/nuttx/configs/px4fmu/nsh/appconfig +++ b/nuttx/configs/px4fmu/nsh/appconfig @@ -65,7 +65,6 @@ CONFIGURED_APPS += systemcmds/perf CONFIGURED_APPS += systemcmds/top CONFIGURED_APPS += systemcmds/boardinfo CONFIGURED_APPS += systemcmds/mixer -CONFIGURED_APPS += systemcmds/eeprom CONFIGURED_APPS += systemcmds/param CONFIGURED_APPS += systemcmds/pwm CONFIGURED_APPS += systemcmds/bl_update @@ -110,27 +109,24 @@ endif CONFIGURED_APPS += systemcmds/i2c # Communication and Drivers -CONFIGURED_APPS += drivers/boards/px4fmu +#CONFIGURED_APPS += drivers/boards/px4fmu CONFIGURED_APPS += drivers/device CONFIGURED_APPS += drivers/ms5611 CONFIGURED_APPS += drivers/hmc5883 CONFIGURED_APPS += drivers/mpu6000 CONFIGURED_APPS += drivers/bma180 -CONFIGURED_APPS += drivers/l3gd20 CONFIGURED_APPS += drivers/px4io CONFIGURED_APPS += drivers/stm32 -CONFIGURED_APPS += drivers/led +#CONFIGURED_APPS += drivers/led CONFIGURED_APPS += drivers/blinkm CONFIGURED_APPS += drivers/stm32/tone_alarm CONFIGURED_APPS += drivers/stm32/adc -CONFIGURED_APPS += drivers/px4fmu CONFIGURED_APPS += drivers/hil CONFIGURED_APPS += drivers/gps CONFIGURED_APPS += drivers/mb12xx # Testing stuff CONFIGURED_APPS += px4/sensors_bringup -CONFIGURED_APPS += px4/tests ifeq ($(CONFIG_CAN),y) #CONFIGURED_APPS += examples/can diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 130886aac..cf30b835f 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -85,7 +85,7 @@ CONFIG_ARCH_FPU=y CONFIG_ARCH_INTERRUPTSTACK=n CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y +CONFIG_ARCH_LEDS=n CONFIG_ARCH_BUTTONS=n CONFIG_ARCH_CALIBRATION=n CONFIG_ARCH_DMA=y diff --git a/platforms/empty.c b/platforms/empty.c new file mode 100644 index 000000000..139531354 --- /dev/null +++ b/platforms/empty.c @@ -0,0 +1,3 @@ +/* + * This is an empty C source file, used when building default firmware configurations. + */ diff --git a/apps/ardrone_interface/ardrone_interface.c b/src/drivers/ardrone_interface/ardrone_interface.c index aeaf830de..aeaf830de 100644 --- a/apps/ardrone_interface/ardrone_interface.c +++ b/src/drivers/ardrone_interface/ardrone_interface.c diff --git a/apps/ardrone_interface/ardrone_motor_control.c b/src/drivers/ardrone_interface/ardrone_motor_control.c index f15c74a22..f15c74a22 100644 --- a/apps/ardrone_interface/ardrone_motor_control.c +++ b/src/drivers/ardrone_interface/ardrone_motor_control.c diff --git a/apps/ardrone_interface/ardrone_motor_control.h b/src/drivers/ardrone_interface/ardrone_motor_control.h index 78b603b63..78b603b63 100644 --- a/apps/ardrone_interface/ardrone_motor_control.h +++ b/src/drivers/ardrone_interface/ardrone_motor_control.h diff --git a/src/drivers/ardrone_interface/module.mk b/src/drivers/ardrone_interface/module.mk new file mode 100644 index 000000000..058bd1397 --- /dev/null +++ b/src/drivers/ardrone_interface/module.mk @@ -0,0 +1,40 @@ +############################################################################ +# +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# AR.Drone motor driver +# + +MODULE_COMMAND = ardrone_interface +SRCS = ardrone_interface.c \ + ardrone_motor_control.c diff --git a/apps/drivers/blinkm/blinkm.cpp b/src/drivers/blinkm/blinkm.cpp index 3fabfd9a5..3fabfd9a5 100644 --- a/apps/drivers/blinkm/blinkm.cpp +++ b/src/drivers/blinkm/blinkm.cpp diff --git a/apps/examples/kalman_demo/Makefile b/src/drivers/blinkm/module.mk index 6c592d645..b48b90f3f 100644 --- a/apps/examples/kalman_demo/Makefile +++ b/src/drivers/blinkm/module.mk @@ -32,11 +32,9 @@ ############################################################################ # -# Full attitude / position Extended Kalman Filter +# BlinkM I2C LED driver # -APPNAME = kalman_demo -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 +MODULE_COMMAND = blinkm -include $(APPDIR)/mk/app.mk +SRCS = blinkm.cpp diff --git a/apps/drivers/bma180/bma180.cpp b/src/drivers/bma180/bma180.cpp index 4409a8a9c..4409a8a9c 100644 --- a/apps/drivers/bma180/bma180.cpp +++ b/src/drivers/bma180/bma180.cpp diff --git a/apps/drivers/bma180/Makefile b/src/drivers/bma180/module.mk index cc01b629e..4c60ee082 100644 --- a/apps/drivers/bma180/Makefile +++ b/src/drivers/bma180/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Makefile to build the BMA180 driver. # -APPNAME = bma180 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = bma180 -include $(APPDIR)/mk/app.mk +SRCS = bma180.cpp diff --git a/src/drivers/boards/px4fmu/module.mk b/src/drivers/boards/px4fmu/module.mk new file mode 100644 index 000000000..2cb261d30 --- /dev/null +++ b/src/drivers/boards/px4fmu/module.mk @@ -0,0 +1,9 @@ +# +# Board-specific startup code for the PX4FMU +# + +SRCS = px4fmu_can.c \ + px4fmu_init.c \ + px4fmu_pwm_servo.c \ + px4fmu_spi.c \ + px4fmu_usb.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_can.c b/src/drivers/boards/px4fmu/px4fmu_can.c index 0d0b5fcd3..187689ff9 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_can.c +++ b/src/drivers/boards/px4fmu/px4fmu_can.c @@ -37,7 +37,6 @@ * Board-specific CAN functions. */ - /************************************************************************************ * Included Files ************************************************************************************/ @@ -57,6 +56,8 @@ #include "stm32_can.h" #include "px4fmu_internal.h" +#ifdef CONFIG_CAN + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ @@ -139,3 +140,5 @@ int can_devinit(void) return OK; } + +#endif diff --git a/apps/drivers/boards/px4fmu/px4fmu_init.c b/src/drivers/boards/px4fmu/px4fmu_init.c index 9960c6bbd..5dd70c3f9 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_init.c +++ b/src/drivers/boards/px4fmu/px4fmu_init.c @@ -127,6 +127,7 @@ __EXPORT void stm32_boardinitialize(void) ****************************************************************************/ static struct spi_dev_s *spi1; +static struct spi_dev_s *spi2; static struct spi_dev_s *spi3; #include <math.h> @@ -147,6 +148,11 @@ __EXPORT int nsh_archinitialize(void) { int result; + /* configure always-on ADC pins */ + stm32_configgpio(GPIO_ADC1_IN10); + stm32_configgpio(GPIO_ADC1_IN11); + /* IN12 and IN13 further below */ + /* configure the high-resolution time/callout interface */ hrt_init(); @@ -173,7 +179,7 @@ __EXPORT int nsh_archinitialize(void) NULL); // initial LED state - drv_led_start(); +// drv_led_start(); up_ledoff(LED_BLUE); up_ledoff(LED_AMBER); up_ledon(LED_BLUE); @@ -188,7 +194,7 @@ __EXPORT int nsh_archinitialize(void) return -ENODEV; } - // Default SPI1 to 1MHz and de-assert the known chip selects. + /* Default SPI1 to 1MHz and de-assert the known chip selects. */ SPI_SETFREQUENCY(spi1, 10000000); SPI_SETBITS(spi1, 8); SPI_SETMODE(spi1, SPIDEV_MODE3); @@ -199,6 +205,28 @@ __EXPORT int nsh_archinitialize(void) message("[boot] Successfully initialized SPI port 1\r\n"); + /* + * If SPI2 is enabled in the defconfig, we loose some ADC pins as chip selects. + * Keep the SPI2 init optional and conditionally initialize the ADC pins + */ + spi2 = up_spiinitialize(2); + + if (!spi2) { + message("[boot] Enabling IN12/13 instead of SPI2\n"); + /* no SPI2, use pins for ADC */ + stm32_configgpio(GPIO_ADC1_IN12); + stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards + } else { + /* Default SPI2 to 1MHz and de-assert the known chip selects. */ + SPI_SETFREQUENCY(spi2, 10000000); + SPI_SETBITS(spi2, 8); + SPI_SETMODE(spi2, SPIDEV_MODE3); + SPI_SELECT(spi2, PX4_SPIDEV_GYRO, false); + SPI_SELECT(spi2, PX4_SPIDEV_ACCEL_MAG, false); + + message("[boot] Initialized SPI port2 (ADC IN12/13 blocked)\n"); + } + /* Get the SPI port for the microSD slot */ message("[boot] Initializing SPI port 3\n"); @@ -223,10 +251,5 @@ __EXPORT int nsh_archinitialize(void) message("[boot] Successfully bound SPI port 3 to the MMCSD driver\n"); - stm32_configgpio(GPIO_ADC1_IN10); - stm32_configgpio(GPIO_ADC1_IN11); - stm32_configgpio(GPIO_ADC1_IN12); - stm32_configgpio(GPIO_ADC1_IN13); // jumperable to MPU6000 DRDY on some boards - return OK; } diff --git a/apps/drivers/boards/px4fmu/px4fmu_internal.h b/src/drivers/boards/px4fmu/px4fmu_internal.h index 6550fdf3d..671a58f8f 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_internal.h +++ b/src/drivers/boards/px4fmu/px4fmu_internal.h @@ -58,9 +58,9 @@ __BEGIN_DECLS ****************************************************************************************************/ /* Configuration ************************************************************************************/ -#ifdef CONFIG_STM32_SPI2 -# error "SPI2 is not supported on this board" -#endif +//#ifdef CONFIG_STM32_SPI2 +//# error "SPI2 is not supported on this board" +//#endif #if defined(CONFIG_STM32_CAN1) # warning "CAN1 is not supported on this board" @@ -77,6 +77,7 @@ __BEGIN_DECLS // XXX MPU6000 DRDY? /* SPI chip selects */ + #define GPIO_SPI_CS_GYRO (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN14) #define GPIO_SPI_CS_ACCEL (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15) #define GPIO_SPI_CS_MPU (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN0) diff --git a/apps/drivers/boards/px4fmu/px4fmu_led.c b/src/drivers/boards/px4fmu/px4fmu_led.c index fd1e159aa..fd1e159aa 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_led.c +++ b/src/drivers/boards/px4fmu/px4fmu_led.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_pwm_servo.c b/src/drivers/boards/px4fmu/px4fmu_pwm_servo.c index cb8918306..cb8918306 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_pwm_servo.c +++ b/src/drivers/boards/px4fmu/px4fmu_pwm_servo.c diff --git a/apps/drivers/boards/px4fmu/px4fmu_spi.c b/src/drivers/boards/px4fmu/px4fmu_spi.c index 7a02eaeb7..b5d00eac0 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_spi.c +++ b/src/drivers/boards/px4fmu/px4fmu_spi.c @@ -121,6 +121,24 @@ __EXPORT uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devi return SPI_STATUS_PRESENT; } +__EXPORT void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +{ + /* SPI select is active low, so write !selected to select the device */ + + switch (devid) { + break; + + default: + break; + + } +} + +__EXPORT uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +{ + return SPI_STATUS_PRESENT; +} + __EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { diff --git a/apps/drivers/boards/px4fmu/px4fmu_usb.c b/src/drivers/boards/px4fmu/px4fmu_usb.c index b0b669fbe..b0b669fbe 100644 --- a/apps/drivers/boards/px4fmu/px4fmu_usb.c +++ b/src/drivers/boards/px4fmu/px4fmu_usb.c diff --git a/apps/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index e35bdb944..e35bdb944 100644 --- a/apps/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp diff --git a/apps/drivers/gps/gps_helper.cpp b/src/drivers/gps/gps_helper.cpp index 9c1fad569..9c1fad569 100644 --- a/apps/drivers/gps/gps_helper.cpp +++ b/src/drivers/gps/gps_helper.cpp diff --git a/apps/drivers/gps/gps_helper.h b/src/drivers/gps/gps_helper.h index f3d3bc40b..f3d3bc40b 100644 --- a/apps/drivers/gps/gps_helper.h +++ b/src/drivers/gps/gps_helper.h diff --git a/apps/drivers/gps/Makefile b/src/drivers/gps/module.mk index 3859a88a5..097db2abf 100644 --- a/apps/drivers/gps/Makefile +++ b/src/drivers/gps/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,9 @@ # GPS driver # -APPNAME = gps -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = gps -include $(APPDIR)/mk/app.mk +SRCS = gps.cpp \ + gps_helper.cpp \ + mtk.cpp \ + ubx.cpp diff --git a/apps/drivers/gps/mtk.cpp b/src/drivers/gps/mtk.cpp index 4762bd503..4762bd503 100644 --- a/apps/drivers/gps/mtk.cpp +++ b/src/drivers/gps/mtk.cpp diff --git a/apps/drivers/gps/mtk.h b/src/drivers/gps/mtk.h index d4e390b01..d4e390b01 100644 --- a/apps/drivers/gps/mtk.h +++ b/src/drivers/gps/mtk.h diff --git a/apps/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp index c150f5271..c150f5271 100644 --- a/apps/drivers/gps/ubx.cpp +++ b/src/drivers/gps/ubx.cpp diff --git a/apps/drivers/gps/ubx.h b/src/drivers/gps/ubx.h index e3dd1c7ea..e3dd1c7ea 100644 --- a/apps/drivers/gps/ubx.h +++ b/src/drivers/gps/ubx.h diff --git a/apps/drivers/hil/hil.cpp b/src/drivers/hil/hil.cpp index d9aa772d4..d9aa772d4 100644 --- a/apps/drivers/hil/hil.cpp +++ b/src/drivers/hil/hil.cpp diff --git a/apps/drivers/hmc5883/Makefile b/src/drivers/hil/module.mk index 4d7cb4e7b..f8895f5d5 100644 --- a/apps/drivers/hmc5883/Makefile +++ b/src/drivers/hil/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,9 @@ ############################################################################ # -# HMC5883 driver +# Hardware in the Loop (HIL) simulation actuator output bank # -APPNAME = hmc5883 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = hil -include $(APPDIR)/mk/app.mk +SRCS = hil.cpp diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index 8ab568282..8ab568282 100644 --- a/apps/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp diff --git a/src/drivers/hmc5883/module.mk b/src/drivers/hmc5883/module.mk new file mode 100644 index 000000000..07377556d --- /dev/null +++ b/src/drivers/hmc5883/module.mk @@ -0,0 +1,43 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# HMC5883 driver +# + +MODULE_COMMAND = hmc5883 + +# XXX seems excessive, check if 2048 is sufficient +MODULE_STACKSIZE = 4096 + +SRCS = hmc5883.cpp diff --git a/apps/hott_telemetry/hott_telemetry_main.c b/src/drivers/hott_telemetry/hott_telemetry_main.c index 31c9247aa..a13a6ef58 100644 --- a/apps/hott_telemetry/hott_telemetry_main.c +++ b/src/drivers/hott_telemetry/hott_telemetry_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks <sjwilks@gmail.com> + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks <sjwilks@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ /** * @file hott_telemetry_main.c + * @author Simon Wilks <sjwilks@gmail.com> * * Graupner HoTT Telemetry implementation. * @@ -41,7 +42,6 @@ * a data packet can be returned if necessary. * * TODO: Add support for at least the vario and GPS sensor data. - * */ #include <fcntl.h> @@ -57,12 +57,6 @@ #include "messages.h" -/* The following are equired for UART direct manipulation. */ -#include <arch/board/board.h> -#include "up_arch.h" -#include "chip.h" -#include "stm32_internal.h" - static int thread_should_exit = false; /**< Deamon exit flag */ static int thread_running = false; /**< Deamon status flag */ static int deamon_task; /**< Handle of deamon task / thread */ diff --git a/apps/hott_telemetry/messages.c b/src/drivers/hott_telemetry/messages.c index 8bfb99773..5fbee16ce 100644 --- a/apps/hott_telemetry/messages.c +++ b/src/drivers/hott_telemetry/messages.c @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks <sjwilks@gmail.com> + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks <sjwilks@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ /** * @file messages.c - * + * @author Simon Wilks <sjwilks@gmail.com> */ #include "messages.h" diff --git a/apps/hott_telemetry/messages.h b/src/drivers/hott_telemetry/messages.h index 44001e04f..dd38075fa 100644 --- a/apps/hott_telemetry/messages.h +++ b/src/drivers/hott_telemetry/messages.h @@ -1,7 +1,7 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. - * Author: @author Simon Wilks <sjwilks@gmail.com> + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. + * Author: Simon Wilks <sjwilks@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,7 @@ /** * @file messages.h + * @author Simon Wilks <sjwilks@gmail.com> * * Graupner HoTT Telemetry message generation. * diff --git a/apps/drivers/blinkm/Makefile b/src/drivers/hott_telemetry/module.mk index 5a623693d..def1d59e9 100644 --- a/apps/drivers/blinkm/Makefile +++ b/src/drivers/hott_telemetry/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,10 @@ ############################################################################ # -# BlinkM I2C LED driver +# Graupner HoTT Telemetry application. # -APPNAME = blinkm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = hott_telemetry -include $(APPDIR)/mk/app.mk +SRCS = hott_telemetry_main.c \ + messages.c diff --git a/apps/drivers/l3gd20/l3gd20.cpp b/src/drivers/l3gd20/l3gd20.cpp index c7f433dd4..98098c83b 100644 --- a/apps/drivers/l3gd20/l3gd20.cpp +++ b/src/drivers/l3gd20/l3gd20.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Driver for the ST L3GD20 MEMS gyro connected via SPI. + * @file l3gd20.cpp + * Driver for the ST L3GD20 MEMS gyro connected via SPI. */ #include <nuttx/config.h> diff --git a/src/drivers/l3gd20/module.mk b/src/drivers/l3gd20/module.mk new file mode 100644 index 000000000..23e77e871 --- /dev/null +++ b/src/drivers/l3gd20/module.mk @@ -0,0 +1,6 @@ +# +# LSM303D accel/mag driver +# + +MODULE_COMMAND = l3gd20 +SRCS = l3gd20.cpp diff --git a/apps/drivers/mb12xx/mb12xx.cpp b/src/drivers/mb12xx/mb12xx.cpp index 9d0f6bddc..397686e8b 100644 --- a/apps/drivers/mb12xx/mb12xx.cpp +++ b/src/drivers/mb12xx/mb12xx.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/mb12xx/Makefile b/src/drivers/mb12xx/module.mk index 0d2405787..4e00ada02 100644 --- a/apps/drivers/mb12xx/Makefile +++ b/src/drivers/mb12xx/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2013 PX4 Development Team. All rights reserved. +# Copyright (c) 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # Makefile to build the Maxbotix Sonar driver. # -APPNAME = mb12xx -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mb12xx -include $(APPDIR)/mk/app.mk +SRCS = mb12xx.cpp diff --git a/apps/systemcmds/boardinfo/Makefile b/src/drivers/mpu6000/module.mk index 6f1be149c..c7d9cd3ef 100644 --- a/apps/systemcmds/boardinfo/Makefile +++ b/src/drivers/mpu6000/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,12 @@ ############################################################################ # -# Build the boardinfo tool. +# Makefile to build the MPU6000 driver. # -APPNAME = boardinfo -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = mpu6000 -include $(APPDIR)/mk/app.mk +# XXX seems excessive, check if 2048 is not sufficient +MODULE_STACKSIZE = 4096 -MAXOPTIMIZATION = -Os +SRCS = mpu6000.cpp diff --git a/apps/drivers/mpu6000/mpu6000.cpp b/src/drivers/mpu6000/mpu6000.cpp index ce7062046..df1958186 100644 --- a/apps/drivers/mpu6000/mpu6000.cpp +++ b/src/drivers/mpu6000/mpu6000.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/ms5611/Makefile b/src/drivers/ms5611/module.mk index d8e67cba2..3c4b0f093 100644 --- a/apps/drivers/ms5611/Makefile +++ b/src/drivers/ms5611/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,6 @@ # MS5611 driver # -APPNAME = ms5611 -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = ms5611 -include $(APPDIR)/mk/app.mk +SRCS = ms5611.cpp diff --git a/apps/drivers/ms5611/ms5611.cpp b/src/drivers/ms5611/ms5611.cpp index 59ab5936e..59ab5936e 100644 --- a/apps/drivers/ms5611/ms5611.cpp +++ b/src/drivers/ms5611/ms5611.cpp diff --git a/apps/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index e54724536..e54724536 100644 --- a/apps/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp diff --git a/src/drivers/px4fmu/module.mk b/src/drivers/px4fmu/module.mk new file mode 100644 index 000000000..05bc7a5b3 --- /dev/null +++ b/src/drivers/px4fmu/module.mk @@ -0,0 +1,6 @@ +# +# Interface driver for the PX4FMU board +# + +MODULE_COMMAND = fmu +SRCS = fmu.cpp diff --git a/apps/drivers/px4io/Makefile b/src/drivers/px4io/module.mk index cbd942546..328e5a684 100644 --- a/apps/drivers/px4io/Makefile +++ b/src/drivers/px4io/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Interface driver for the PX4IO board. # -APPNAME = px4io -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = px4io -include $(APPDIR)/mk/app.mk +SRCS = px4io.cpp \ + uploader.cpp diff --git a/apps/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 4f6938a14..b21f83e44 100644 --- a/apps/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012,2013 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/drivers/px4io/uploader.cpp b/src/drivers/px4io/uploader.cpp index abf59216a..9a67875e8 100644 --- a/apps/drivers/px4io/uploader.cpp +++ b/src/drivers/px4io/uploader.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Firmware uploader for PX4IO + * @file uploader.cpp + * Firmware uploader for PX4IO */ #include <nuttx/config.h> diff --git a/apps/drivers/px4io/uploader.h b/src/drivers/px4io/uploader.h index f983d1981..135202dd1 100644 --- a/apps/drivers/px4io/uploader.h +++ b/src/drivers/px4io/uploader.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,7 +32,8 @@ ****************************************************************************/ /** - * @file Firmware uploader for PX4IO + * @file uploader.h + * Firmware uploader definitions for PX4IO. */ #ifndef _PX4IO_UPLOADER_H diff --git a/apps/mavlink/mavlink_log.h b/src/include/mavlink/mavlink_log.h index 233a76cb3..233a76cb3 100644 --- a/apps/mavlink/mavlink_log.h +++ b/src/include/mavlink/mavlink_log.h diff --git a/apps/systemcmds/calibration/calibration.h b/src/include/visibility.h index 028853ec8..2c6adc062 100644 --- a/apps/systemcmds/calibration/calibration.h +++ b/src/include/visibility.h @@ -31,30 +31,32 @@ * ****************************************************************************/ -#ifndef _CALIBRATION_H -#define _CALIBRATION_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ +/** + * @file visibility.h + * + * Definitions controlling symbol naming and visibility. + * + * This file is normally included automatically by the build system. + */ -/**************************************************************************** - * Public Variables - ****************************************************************************/ +#ifndef __SYSTEMLIB_VISIBILITY_H +#define __SYSTEMLIB_VISIBILITY_H -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -extern int range_cal(int argc, char *argv[]); -extern int servo_cal(int argc, char *argv[]); +#ifdef __EXPORT +# undef __EXPORT +#endif +#define __EXPORT __attribute__ ((visibility ("default"))) +#ifdef __PRIVATE +# undef __PRIVATE +#endif +#define __PRIVATE __attribute__ ((visibility ("hidden"))) + +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS #endif +#endif
\ No newline at end of file diff --git a/apps/examples/kalman_demo/KalmanNav.cpp b/src/modules/att_pos_estimator_ekf/KalmanNav.cpp index 4ef150da1..4ef150da1 100644 --- a/apps/examples/kalman_demo/KalmanNav.cpp +++ b/src/modules/att_pos_estimator_ekf/KalmanNav.cpp diff --git a/apps/examples/kalman_demo/KalmanNav.hpp b/src/modules/att_pos_estimator_ekf/KalmanNav.hpp index c2bf18115..c2bf18115 100644 --- a/apps/examples/kalman_demo/KalmanNav.hpp +++ b/src/modules/att_pos_estimator_ekf/KalmanNav.hpp diff --git a/apps/examples/kalman_demo/kalman_demo.cpp b/src/modules/att_pos_estimator_ekf/kalman_main.cpp index 581b68b01..aebe3d1fe 100644 --- a/apps/examples/kalman_demo/kalman_demo.cpp +++ b/src/modules/att_pos_estimator_ekf/kalman_main.cpp @@ -55,7 +55,7 @@ static int deamon_task; /**< Handle of deamon task / thread */ /** * Deamon management function. */ -extern "C" __EXPORT int kalman_demo_main(int argc, char *argv[]); +extern "C" __EXPORT int att_pos_estimator_ekf_main(int argc, char *argv[]); /** * Mainloop of deamon. @@ -85,7 +85,7 @@ usage(const char *reason) * The actual stack size should be set in the call * to task_create(). */ -int kalman_demo_main(int argc, char *argv[]) +int att_pos_estimator_ekf_main(int argc, char *argv[]) { if (argc < 1) diff --git a/apps/drivers/px4fmu/Makefile b/src/modules/att_pos_estimator_ekf/module.mk index 7f7c2a732..21b7c9166 100644 --- a/apps/drivers/px4fmu/Makefile +++ b/src/modules/att_pos_estimator_ekf/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,14 @@ ############################################################################ # -# Interface driver for the PX4FMU board +# Full attitude / position Extended Kalman Filter # -APPNAME = fmu -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = att_pos_estimator_ekf -INCLUDES = $(TOPDIR)/arch/arm/src/stm32 $(TOPDIR)/arch/arm/src/common +# XXX this might be intended for the spawned deamon, validate +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-30" -include $(APPDIR)/mk/app.mk +SRCS = kalman_main.cpp \ + KalmanNav.cpp \ + params.c diff --git a/apps/examples/kalman_demo/params.c b/src/modules/att_pos_estimator_ekf/params.c index 50642f067..50642f067 100644 --- a/apps/examples/kalman_demo/params.c +++ b/src/modules/att_pos_estimator_ekf/params.c diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp index 1a50dde0f..8e18c3c9a 100755 --- a/apps/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_main.cpp @@ -46,7 +46,6 @@ #include <stdbool.h> #include <poll.h> #include <fcntl.h> -#include <v1.0/common/mavlink.h> #include <float.h> #include <nuttx/sched.h> #include <sys/prctl.h> diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.c b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c index 7d3812abd..7d3812abd 100755 --- a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.c +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.c diff --git a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.h b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.h index 09817d58e..09817d58e 100755 --- a/apps/attitude_estimator_ekf/attitude_estimator_ekf_params.h +++ b/src/modules/attitude_estimator_ekf/attitude_estimator_ekf_params.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c index 9e97ad11a..9e97ad11a 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h index afa63c1a9..afa63c1a9 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c index 7d620d7fa..7d620d7fa 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h index 8b599be66..8b599be66 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_initialize.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c index 7f9727419..7f9727419 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.c diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h index da84a5024..da84a5024 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_terminate.h diff --git a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h index 30fd1e75e..30fd1e75e 100755 --- a/apps/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h +++ b/src/modules/attitude_estimator_ekf/codegen/attitudeKalmanfilter_types.h diff --git a/apps/attitude_estimator_ekf/codegen/cross.c b/src/modules/attitude_estimator_ekf/codegen/cross.c index 84ada9002..84ada9002 100755 --- a/apps/attitude_estimator_ekf/codegen/cross.c +++ b/src/modules/attitude_estimator_ekf/codegen/cross.c diff --git a/apps/attitude_estimator_ekf/codegen/cross.h b/src/modules/attitude_estimator_ekf/codegen/cross.h index e727f0684..e727f0684 100755 --- a/apps/attitude_estimator_ekf/codegen/cross.h +++ b/src/modules/attitude_estimator_ekf/codegen/cross.h diff --git a/apps/attitude_estimator_ekf/codegen/eye.c b/src/modules/attitude_estimator_ekf/codegen/eye.c index b89ab58ef..b89ab58ef 100755 --- a/apps/attitude_estimator_ekf/codegen/eye.c +++ b/src/modules/attitude_estimator_ekf/codegen/eye.c diff --git a/apps/attitude_estimator_ekf/codegen/eye.h b/src/modules/attitude_estimator_ekf/codegen/eye.h index 94fbe7671..94fbe7671 100755 --- a/apps/attitude_estimator_ekf/codegen/eye.h +++ b/src/modules/attitude_estimator_ekf/codegen/eye.h diff --git a/apps/attitude_estimator_ekf/codegen/mrdivide.c b/src/modules/attitude_estimator_ekf/codegen/mrdivide.c index a810f22e4..a810f22e4 100755 --- a/apps/attitude_estimator_ekf/codegen/mrdivide.c +++ b/src/modules/attitude_estimator_ekf/codegen/mrdivide.c diff --git a/apps/attitude_estimator_ekf/codegen/mrdivide.h b/src/modules/attitude_estimator_ekf/codegen/mrdivide.h index 2d3b0d51f..2d3b0d51f 100755 --- a/apps/attitude_estimator_ekf/codegen/mrdivide.h +++ b/src/modules/attitude_estimator_ekf/codegen/mrdivide.h diff --git a/apps/attitude_estimator_ekf/codegen/norm.c b/src/modules/attitude_estimator_ekf/codegen/norm.c index 0c418cc7b..0c418cc7b 100755 --- a/apps/attitude_estimator_ekf/codegen/norm.c +++ b/src/modules/attitude_estimator_ekf/codegen/norm.c diff --git a/apps/attitude_estimator_ekf/codegen/norm.h b/src/modules/attitude_estimator_ekf/codegen/norm.h index 60cf77b57..60cf77b57 100755 --- a/apps/attitude_estimator_ekf/codegen/norm.h +++ b/src/modules/attitude_estimator_ekf/codegen/norm.h diff --git a/apps/attitude_estimator_ekf/codegen/rdivide.c b/src/modules/attitude_estimator_ekf/codegen/rdivide.c index d035dae5e..d035dae5e 100755 --- a/apps/attitude_estimator_ekf/codegen/rdivide.c +++ b/src/modules/attitude_estimator_ekf/codegen/rdivide.c diff --git a/apps/attitude_estimator_ekf/codegen/rdivide.h b/src/modules/attitude_estimator_ekf/codegen/rdivide.h index 4bbebebe2..4bbebebe2 100755 --- a/apps/attitude_estimator_ekf/codegen/rdivide.h +++ b/src/modules/attitude_estimator_ekf/codegen/rdivide.h diff --git a/apps/attitude_estimator_ekf/codegen/rtGetInf.c b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.c index 34164d104..34164d104 100755 --- a/apps/attitude_estimator_ekf/codegen/rtGetInf.c +++ b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.c diff --git a/apps/attitude_estimator_ekf/codegen/rtGetInf.h b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.h index 145373cd0..145373cd0 100755 --- a/apps/attitude_estimator_ekf/codegen/rtGetInf.h +++ b/src/modules/attitude_estimator_ekf/codegen/rtGetInf.h diff --git a/apps/attitude_estimator_ekf/codegen/rtGetNaN.c b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.c index d84ca9573..d84ca9573 100755 --- a/apps/attitude_estimator_ekf/codegen/rtGetNaN.c +++ b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.c diff --git a/apps/attitude_estimator_ekf/codegen/rtGetNaN.h b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.h index 65fdaa96f..65fdaa96f 100755 --- a/apps/attitude_estimator_ekf/codegen/rtGetNaN.h +++ b/src/modules/attitude_estimator_ekf/codegen/rtGetNaN.h diff --git a/apps/attitude_estimator_ekf/codegen/rt_defines.h b/src/modules/attitude_estimator_ekf/codegen/rt_defines.h index 356498363..356498363 100755 --- a/apps/attitude_estimator_ekf/codegen/rt_defines.h +++ b/src/modules/attitude_estimator_ekf/codegen/rt_defines.h diff --git a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.c b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.c index 303d1d9d2..303d1d9d2 100755 --- a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.c +++ b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.c diff --git a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.h b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.h index bd56b30d9..bd56b30d9 100755 --- a/apps/attitude_estimator_ekf/codegen/rt_nonfinite.h +++ b/src/modules/attitude_estimator_ekf/codegen/rt_nonfinite.h diff --git a/apps/attitude_estimator_ekf/codegen/rtwtypes.h b/src/modules/attitude_estimator_ekf/codegen/rtwtypes.h index 9a5c96267..9a5c96267 100755 --- a/apps/attitude_estimator_ekf/codegen/rtwtypes.h +++ b/src/modules/attitude_estimator_ekf/codegen/rtwtypes.h diff --git a/apps/attitude_estimator_ekf/Makefile b/src/modules/attitude_estimator_ekf/module.mk index 46a54c660..d98647f99 100755..100644 --- a/apps/attitude_estimator_ekf/Makefile +++ b/src/modules/attitude_estimator_ekf/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -31,13 +31,14 @@ # ############################################################################ -APPNAME = attitude_estimator_ekf -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +# +# Attitude estimator (Extended Kalman Filter) +# -CXXSRCS = attitude_estimator_ekf_main.cpp +MODULE_COMMAND = attitude_estimator_ekf -CSRCS = attitude_estimator_ekf_params.c \ +SRCS = attitude_estimator_ekf_main.cpp \ + attitude_estimator_ekf_params.c \ codegen/eye.c \ codegen/attitudeKalmanfilter.c \ codegen/mrdivide.c \ @@ -48,10 +49,4 @@ CSRCS = attitude_estimator_ekf_params.c \ codegen/rtGetInf.c \ codegen/rtGetNaN.c \ codegen/norm.c \ - codegen/cross.c - - -# XXX this is *horribly* broken -INCLUDES += $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk + codegen/cross.c diff --git a/apps/commander/calibration_routines.c b/src/modules/commander/calibration_routines.c index a26938637..a26938637 100644 --- a/apps/commander/calibration_routines.c +++ b/src/modules/commander/calibration_routines.c diff --git a/apps/commander/calibration_routines.h b/src/modules/commander/calibration_routines.h index e3e7fbafd..e3e7fbafd 100644 --- a/apps/commander/calibration_routines.h +++ b/src/modules/commander/calibration_routines.h diff --git a/apps/commander/commander.c b/src/modules/commander/commander.c index 7c0a25f86..7c0a25f86 100644 --- a/apps/commander/commander.c +++ b/src/modules/commander/commander.c diff --git a/apps/commander/commander.h b/src/modules/commander/commander.h index 04b4e72ab..04b4e72ab 100644 --- a/apps/commander/commander.h +++ b/src/modules/commander/commander.h diff --git a/apps/drivers/hil/Makefile b/src/modules/commander/module.mk index 1fb6e37bc..556d5c2df 100644 --- a/apps/drivers/hil/Makefile +++ b/src/modules/commander/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,10 @@ ############################################################################ # -# Interface driver for the PX4FMU board +# Main system state machine # -APPNAME = hil -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = commander +SRCS = commander.c \ + state_machine_helper.c \ + calibration_routines.c diff --git a/apps/commander/state_machine_helper.c b/src/modules/commander/state_machine_helper.c index bea388a10..bea388a10 100644 --- a/apps/commander/state_machine_helper.c +++ b/src/modules/commander/state_machine_helper.c diff --git a/apps/commander/state_machine_helper.h b/src/modules/commander/state_machine_helper.h index 2f2ccc729..2f2ccc729 100644 --- a/apps/commander/state_machine_helper.h +++ b/src/modules/commander/state_machine_helper.h diff --git a/apps/mavlink/.gitignore b/src/modules/mavlink/.gitignore index a02827195..a02827195 100644 --- a/apps/mavlink/.gitignore +++ b/src/modules/mavlink/.gitignore diff --git a/apps/mavlink/mavlink.c b/src/modules/mavlink/mavlink.c index 644b779af..de78cd139 100644 --- a/apps/mavlink/mavlink.c +++ b/src/modules/mavlink/mavlink.c @@ -64,9 +64,9 @@ #include <systemlib/param/param.h> #include <systemlib/systemlib.h> #include <systemlib/err.h> +#include <mavlink/mavlink_log.h> #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/mavlink_bridge_header.h b/src/modules/mavlink/mavlink_bridge_header.h index 270ec1727..0010bb341 100644 --- a/apps/mavlink/mavlink_bridge_header.h +++ b/src/modules/mavlink/mavlink_bridge_header.h @@ -51,7 +51,7 @@ #define MAVLINK_GET_CHANNEL_BUFFER mavlink_get_channel_buffer #define MAVLINK_GET_CHANNEL_STATUS mavlink_get_channel_status -#include "v1.0/mavlink_types.h" +#include <v1.0/mavlink_types.h> #include <unistd.h> diff --git a/apps/mavlink/mavlink_hil.h b/src/modules/mavlink/mavlink_hil.h index 8c7a5b514..8c7a5b514 100644 --- a/apps/mavlink/mavlink_hil.h +++ b/src/modules/mavlink/mavlink_hil.h diff --git a/apps/mavlink/mavlink_log.c b/src/modules/mavlink/mavlink_log.c index ed65fb883..fa974dc0b 100644 --- a/apps/mavlink/mavlink_log.c +++ b/src/modules/mavlink/mavlink_log.c @@ -42,7 +42,7 @@ #include <string.h> #include <stdlib.h> -#include "mavlink_log.h" +#include <mavlink/mavlink_log.h> void mavlink_logbuffer_init(struct mavlink_logbuffer *lb, int size) { diff --git a/apps/mavlink/mavlink_parameters.c b/src/modules/mavlink/mavlink_parameters.c index 819f3441b..819f3441b 100644 --- a/apps/mavlink/mavlink_parameters.c +++ b/src/modules/mavlink/mavlink_parameters.c diff --git a/apps/mavlink/mavlink_parameters.h b/src/modules/mavlink/mavlink_parameters.h index b1e38bcc8..b1e38bcc8 100644 --- a/apps/mavlink/mavlink_parameters.h +++ b/src/modules/mavlink/mavlink_parameters.h diff --git a/apps/mavlink/mavlink_receiver.c b/src/modules/mavlink/mavlink_receiver.c index 22c2fcdad..e62e4dcc4 100644 --- a/apps/mavlink/mavlink_receiver.c +++ b/src/modules/mavlink/mavlink_receiver.c @@ -64,9 +64,9 @@ #include <systemlib/param/param.h> #include <systemlib/systemlib.h> +#include <mavlink/mavlink_log.h> #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" @@ -312,7 +312,7 @@ handle_message(mavlink_message_t *msg) static const float ground_press = 1013.25f; // mbar static const float ground_tempC = 21.0f; static const float ground_alt = 0.0f; - static const float T0 = 273.15; + static const float T0 = 273.15f; static const float R = 287.05f; static const float g = 9.806f; diff --git a/apps/mavlink/missionlib.c b/src/modules/mavlink/missionlib.c index 8064febc4..d369e05ff 100644 --- a/apps/mavlink/missionlib.c +++ b/src/modules/mavlink/missionlib.c @@ -62,9 +62,9 @@ #include <systemlib/param/param.h> #include <systemlib/systemlib.h> +#include <mavlink/mavlink_log.h> #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/missionlib.h b/src/modules/mavlink/missionlib.h index c2ca735b3..c2ca735b3 100644 --- a/apps/mavlink/missionlib.h +++ b/src/modules/mavlink/missionlib.h diff --git a/apps/ardrone_interface/Makefile b/src/modules/mavlink/module.mk index fea96082f..cbf08aeb2 100644 --- a/apps/ardrone_interface/Makefile +++ b/src/modules/mavlink/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,11 +32,16 @@ ############################################################################ # -# Makefile to build ardrone interface +# MAVLink protocol to uORB interface process # -APPNAME = ardrone_interface -PRIORITY = SCHED_PRIORITY_MAX - 15 -STACKSIZE = 2048 +MODULE_COMMAND = mavlink +SRCS += mavlink.c \ + missionlib.c \ + mavlink_parameters.c \ + mavlink_log.c \ + mavlink_receiver.c \ + orb_listener.c \ + waypoints.c -include $(APPDIR)/mk/app.mk +INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink diff --git a/apps/mavlink/orb_listener.c b/src/modules/mavlink/orb_listener.c index 5f15facf8..295cd5e28 100644 --- a/apps/mavlink/orb_listener.c +++ b/src/modules/mavlink/orb_listener.c @@ -56,8 +56,9 @@ #include <stdlib.h> #include <poll.h> +#include <mavlink/mavlink_log.h> + #include "waypoints.h" -#include "mavlink_log.h" #include "orb_topics.h" #include "missionlib.h" #include "mavlink_hil.h" diff --git a/apps/mavlink/orb_topics.h b/src/modules/mavlink/orb_topics.h index d61cd43dc..d61cd43dc 100644 --- a/apps/mavlink/orb_topics.h +++ b/src/modules/mavlink/orb_topics.h diff --git a/apps/mavlink/util.h b/src/modules/mavlink/util.h index a4ff06a88..a4ff06a88 100644 --- a/apps/mavlink/util.h +++ b/src/modules/mavlink/util.h diff --git a/apps/mavlink/waypoints.c b/src/modules/mavlink/waypoints.c index a131b143b..a131b143b 100644 --- a/apps/mavlink/waypoints.c +++ b/src/modules/mavlink/waypoints.c diff --git a/apps/mavlink/waypoints.h b/src/modules/mavlink/waypoints.h index c32ab32e5..c32ab32e5 100644 --- a/apps/mavlink/waypoints.h +++ b/src/modules/mavlink/waypoints.h diff --git a/apps/mavlink_onboard/mavlink.c b/src/modules/mavlink_onboard/mavlink.c index 5a2685560..5a2685560 100644 --- a/apps/mavlink_onboard/mavlink.c +++ b/src/modules/mavlink_onboard/mavlink.c diff --git a/apps/mavlink_onboard/mavlink_bridge_header.h b/src/modules/mavlink_onboard/mavlink_bridge_header.h index bf7c5354c..3ad3bb617 100644 --- a/apps/mavlink_onboard/mavlink_bridge_header.h +++ b/src/modules/mavlink_onboard/mavlink_bridge_header.h @@ -51,7 +51,7 @@ #define MAVLINK_GET_CHANNEL_BUFFER mavlink_get_channel_buffer #define MAVLINK_GET_CHANNEL_STATUS mavlink_get_channel_status -#include "v1.0/mavlink_types.h" +#include <v1.0/mavlink_types.h> #include <unistd.h> diff --git a/apps/mavlink_onboard/mavlink_receiver.c b/src/modules/mavlink_onboard/mavlink_receiver.c index 0acbea675..0acbea675 100644 --- a/apps/mavlink_onboard/mavlink_receiver.c +++ b/src/modules/mavlink_onboard/mavlink_receiver.c diff --git a/apps/commander/Makefile b/src/modules/mavlink_onboard/module.mk index d12697274..a7a4980fa 100644 --- a/apps/commander/Makefile +++ b/src/modules/mavlink_onboard/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (C) 2012-2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,14 +32,11 @@ ############################################################################ # -# Commander application +# MAVLink protocol to uORB interface process (XXX hack for onboard use) # -APPNAME = commander -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 - -INCLUDES = $(TOPDIR)/../mavlink/include/mavlink - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = mavlink_onboard +SRCS = mavlink.c \ + mavlink_receiver.c +INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink diff --git a/apps/mavlink_onboard/orb_topics.h b/src/modules/mavlink_onboard/orb_topics.h index f18f56243..f18f56243 100644 --- a/apps/mavlink_onboard/orb_topics.h +++ b/src/modules/mavlink_onboard/orb_topics.h diff --git a/apps/mavlink_onboard/util.h b/src/modules/mavlink_onboard/util.h index 38a4db372..38a4db372 100644 --- a/apps/mavlink_onboard/util.h +++ b/src/modules/mavlink_onboard/util.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.c index 977565b8e..977565b8e 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.h index 2f5330563..2f5330563 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.c index 6627f76e9..6627f76e9 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.h index a77eb5712..a77eb5712 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1_initialize.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.c index a65536f79..a65536f79 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.h index 100c7f76c..100c7f76c 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1_terminate.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe1_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_types.h index d4b2c2d61..d4b2c2d61 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe1_types.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe1_types.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.c index 11b999064..11b999064 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.h index 30170ae22..30170ae22 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.c index de5a1d8aa..de5a1d8aa 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.h index 3d507ff31..3d507ff31 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2_initialize.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.c index 0757c878c..0757c878c 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.h index 23995020b..23995020b 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2_terminate.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe2_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_types.h index f7a04d908..f7a04d908 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe2_types.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe2_types.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.c index 9efe2ea7a..9efe2ea7a 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.h index 9bbffbbb3..9bbffbbb3 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.c index 8f2275c13..8f2275c13 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.h index 952eb7b89..952eb7b89 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_data.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_data.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.c index b87d604c4..b87d604c4 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.h index 9dee90f9e..9dee90f9e 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_initialize.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_initialize.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.c b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.c index b00858205..b00858205 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.c +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.c diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.h index 69cc85c76..69cc85c76 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_terminate.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_terminate.h diff --git a/apps/position_estimator_mc/codegen/kalman_dlqe3_types.h b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_types.h index f36ea4557..f36ea4557 100755 --- a/apps/position_estimator_mc/codegen/kalman_dlqe3_types.h +++ b/src/modules/position_estimator_mc/codegen/kalman_dlqe3_types.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.c index 5139848bc..5139848bc 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.h index 205c8eb4e..205c8eb4e 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c index 4c535618a..4c535618a 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h index 94cbe2ce6..94cbe2ce6 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c index aa89f8a9d..aa89f8a9d 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h index 8d358a9a3..8d358a9a3 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_initialize.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c index 20ed2edbb..20ed2edbb 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h index 5eb5807a0..5eb5807a0 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_terminate.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h index 43e5f016c..43e5f016c 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_dT_types.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c index 5bd87c390..5bd87c390 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h index 44bce472f..44bce472f 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_initialize.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c index 41e11936f..41e11936f 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.c diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h index e84ea01bc..e84ea01bc 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_terminate.h diff --git a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_types.h b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_types.h index 4b473f56f..4b473f56f 100755 --- a/apps/position_estimator_mc/codegen/positionKalmanFilter1D_types.h +++ b/src/modules/position_estimator_mc/codegen/positionKalmanFilter1D_types.h diff --git a/apps/position_estimator_mc/codegen/randn.c b/src/modules/position_estimator_mc/codegen/randn.c index 51aef7b76..51aef7b76 100755 --- a/apps/position_estimator_mc/codegen/randn.c +++ b/src/modules/position_estimator_mc/codegen/randn.c diff --git a/apps/position_estimator_mc/codegen/randn.h b/src/modules/position_estimator_mc/codegen/randn.h index 8a2aa9277..8a2aa9277 100755 --- a/apps/position_estimator_mc/codegen/randn.h +++ b/src/modules/position_estimator_mc/codegen/randn.h diff --git a/apps/position_estimator_mc/codegen/rtGetInf.c b/src/modules/position_estimator_mc/codegen/rtGetInf.c index c6fa7884e..c6fa7884e 100755 --- a/apps/position_estimator_mc/codegen/rtGetInf.c +++ b/src/modules/position_estimator_mc/codegen/rtGetInf.c diff --git a/apps/position_estimator_mc/codegen/rtGetInf.h b/src/modules/position_estimator_mc/codegen/rtGetInf.h index e7b2a2d1c..e7b2a2d1c 100755 --- a/apps/position_estimator_mc/codegen/rtGetInf.h +++ b/src/modules/position_estimator_mc/codegen/rtGetInf.h diff --git a/apps/position_estimator_mc/codegen/rtGetNaN.c b/src/modules/position_estimator_mc/codegen/rtGetNaN.c index 552770149..552770149 100755 --- a/apps/position_estimator_mc/codegen/rtGetNaN.c +++ b/src/modules/position_estimator_mc/codegen/rtGetNaN.c diff --git a/apps/position_estimator_mc/codegen/rtGetNaN.h b/src/modules/position_estimator_mc/codegen/rtGetNaN.h index 5acdd9790..5acdd9790 100755 --- a/apps/position_estimator_mc/codegen/rtGetNaN.h +++ b/src/modules/position_estimator_mc/codegen/rtGetNaN.h diff --git a/apps/position_estimator_mc/codegen/rt_nonfinite.c b/src/modules/position_estimator_mc/codegen/rt_nonfinite.c index de121c4a0..de121c4a0 100755 --- a/apps/position_estimator_mc/codegen/rt_nonfinite.c +++ b/src/modules/position_estimator_mc/codegen/rt_nonfinite.c diff --git a/apps/position_estimator_mc/codegen/rt_nonfinite.h b/src/modules/position_estimator_mc/codegen/rt_nonfinite.h index 3bbcfd087..3bbcfd087 100755 --- a/apps/position_estimator_mc/codegen/rt_nonfinite.h +++ b/src/modules/position_estimator_mc/codegen/rt_nonfinite.h diff --git a/apps/position_estimator_mc/codegen/rtwtypes.h b/src/modules/position_estimator_mc/codegen/rtwtypes.h index 8916e8572..8916e8572 100755 --- a/apps/position_estimator_mc/codegen/rtwtypes.h +++ b/src/modules/position_estimator_mc/codegen/rtwtypes.h diff --git a/apps/position_estimator_mc/kalman_dlqe1.m b/src/modules/position_estimator_mc/kalman_dlqe1.m index ff939d029..ff939d029 100755 --- a/apps/position_estimator_mc/kalman_dlqe1.m +++ b/src/modules/position_estimator_mc/kalman_dlqe1.m diff --git a/apps/position_estimator_mc/kalman_dlqe2.m b/src/modules/position_estimator_mc/kalman_dlqe2.m index 2a50164ef..2a50164ef 100755 --- a/apps/position_estimator_mc/kalman_dlqe2.m +++ b/src/modules/position_estimator_mc/kalman_dlqe2.m diff --git a/apps/position_estimator_mc/kalman_dlqe3.m b/src/modules/position_estimator_mc/kalman_dlqe3.m index 4c6421b7f..4c6421b7f 100755 --- a/apps/position_estimator_mc/kalman_dlqe3.m +++ b/src/modules/position_estimator_mc/kalman_dlqe3.m diff --git a/apps/position_estimator_mc/Makefile b/src/modules/position_estimator_mc/module.mk index 8f1100158..40b135ea4 100644 --- a/apps/position_estimator_mc/Makefile +++ b/src/modules/position_estimator_mc/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,11 +35,9 @@ # Makefile to build the position estimator # -APPNAME = position_estimator_mc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = position_estimator_mc -CSRCS = position_estimator_mc_main.c \ +SRCS = position_estimator_mc_main.c \ position_estimator_mc_params.c \ codegen/positionKalmanFilter1D_initialize.c \ codegen/positionKalmanFilter1D_terminate.c \ @@ -60,5 +58,3 @@ CSRCS = position_estimator_mc_main.c \ codegen/kalman_dlqe3_terminate.c \ codegen/kalman_dlqe3_data.c \ codegen/randn.c - -include $(APPDIR)/mk/app.mk diff --git a/apps/position_estimator_mc/positionKalmanFilter1D.m b/src/modules/position_estimator_mc/positionKalmanFilter1D.m index 144ff8c7c..144ff8c7c 100755 --- a/apps/position_estimator_mc/positionKalmanFilter1D.m +++ b/src/modules/position_estimator_mc/positionKalmanFilter1D.m diff --git a/apps/position_estimator_mc/positionKalmanFilter1D_dT.m b/src/modules/position_estimator_mc/positionKalmanFilter1D_dT.m index f94cce1fb..f94cce1fb 100755 --- a/apps/position_estimator_mc/positionKalmanFilter1D_dT.m +++ b/src/modules/position_estimator_mc/positionKalmanFilter1D_dT.m diff --git a/apps/position_estimator_mc/position_estimator_mc_main.c b/src/modules/position_estimator_mc/position_estimator_mc_main.c index 10dee3f22..10dee3f22 100755 --- a/apps/position_estimator_mc/position_estimator_mc_main.c +++ b/src/modules/position_estimator_mc/position_estimator_mc_main.c diff --git a/apps/position_estimator_mc/position_estimator_mc_params.c b/src/modules/position_estimator_mc/position_estimator_mc_params.c index 72e5bc73b..72e5bc73b 100755 --- a/apps/position_estimator_mc/position_estimator_mc_params.c +++ b/src/modules/position_estimator_mc/position_estimator_mc_params.c diff --git a/apps/position_estimator_mc/position_estimator_mc_params.h b/src/modules/position_estimator_mc/position_estimator_mc_params.h index c4c95f7b4..c4c95f7b4 100755 --- a/apps/position_estimator_mc/position_estimator_mc_params.h +++ b/src/modules/position_estimator_mc/position_estimator_mc_params.h diff --git a/apps/sdlog/Makefile b/src/modules/sdlog/module.mk index 225b14a32..89da2d827 100644 --- a/apps/sdlog/Makefile +++ b/src/modules/sdlog/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,9 +35,9 @@ # sdlog Application # -APPNAME = sdlog +MODULE_COMMAND = sdlog # The main thread only buffers to RAM, needs a high priority -PRIORITY = SCHED_PRIORITY_MAX - 30 -STACKSIZE = 2048 +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-30" -include $(APPDIR)/mk/app.mk +SRCS = sdlog.c \ + sdlog_ringbuffer.c diff --git a/apps/sdlog/sdlog.c b/src/modules/sdlog/sdlog.c index df8745d9f..df8745d9f 100644 --- a/apps/sdlog/sdlog.c +++ b/src/modules/sdlog/sdlog.c diff --git a/apps/sdlog/sdlog_ringbuffer.c b/src/modules/sdlog/sdlog_ringbuffer.c index d7c8a4759..d7c8a4759 100644 --- a/apps/sdlog/sdlog_ringbuffer.c +++ b/src/modules/sdlog/sdlog_ringbuffer.c diff --git a/apps/sdlog/sdlog_ringbuffer.h b/src/modules/sdlog/sdlog_ringbuffer.h index b65916459..b65916459 100644 --- a/apps/sdlog/sdlog_ringbuffer.h +++ b/src/modules/sdlog/sdlog_ringbuffer.h diff --git a/apps/commander/.context b/src/modules/sensors/.context index e69de29bb..e69de29bb 100644 --- a/apps/commander/.context +++ b/src/modules/sensors/.context diff --git a/apps/sensors/Makefile b/src/modules/sensors/module.mk index 526fb0164..ebbc580e1 100644 --- a/apps/sensors/Makefile +++ b/src/modules/sensors/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,11 +35,8 @@ # Makefile to build the sensor data collector # -APPNAME = sensors -PRIORITY = SCHED_PRIORITY_MAX-5 -STACKSIZE = 4096 +MODULE_COMMAND = sensors +MODULE_PRIORITY = "SCHED_PRIORITY_MAX-5" -CXXSRCS = sensors.cpp -CSRCS = sensor_params.c - -include $(APPDIR)/mk/app.mk +SRCS = sensors.cpp \ + sensor_params.c diff --git a/apps/sensors/sensor_params.c b/src/modules/sensors/sensor_params.c index c850e3a1e..c850e3a1e 100644 --- a/apps/sensors/sensor_params.c +++ b/src/modules/sensors/sensor_params.c diff --git a/apps/sensors/sensors.cpp b/src/modules/sensors/sensors.cpp index 1f3f7707e..123bbb120 100644 --- a/apps/sensors/sensors.cpp +++ b/src/modules/sensors/sensors.cpp @@ -372,7 +372,9 @@ Sensors *g_sensors; } Sensors::Sensors() : +#ifdef CONFIG_HRT_PPM _ppm_last_valid(0), +#endif _fd_adc(-1), _last_adc(0), diff --git a/src/modules/test/foo.c b/src/modules/test/foo.c new file mode 100644 index 000000000..ff6af031f --- /dev/null +++ b/src/modules/test/foo.c @@ -0,0 +1,4 @@ +int test_main(void) +{ + return 0; +}
\ No newline at end of file diff --git a/src/modules/test/module.mk b/src/modules/test/module.mk new file mode 100644 index 000000000..abf80eedf --- /dev/null +++ b/src/modules/test/module.mk @@ -0,0 +1,4 @@ + +MODULE_NAME = test +SRCS = foo.c + diff --git a/apps/systemcmds/bl_update/bl_update.c b/src/systemcmds/bl_update/bl_update.c index 45715b791..0569d89f5 100644 --- a/apps/systemcmds/bl_update/bl_update.c +++ b/src/systemcmds/bl_update/bl_update.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/px4/tests/Makefile b/src/systemcmds/bl_update/module.mk index 34f058be4..e8eea045e 100644 --- a/apps/px4/tests/Makefile +++ b/src/systemcmds/bl_update/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,12 @@ ############################################################################ # -# Makefile to build assorted test cases +# Bootloader updater (flashes the FMU USB bootloader software) # -APPNAME = tests -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 12000 +MODULE_COMMAND = bl_update +SRCS = bl_update.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/boardinfo/boardinfo.c b/src/systemcmds/boardinfo/boardinfo.c index fb8b07ef4..3ff5a066c 100644 --- a/apps/systemcmds/boardinfo/boardinfo.c +++ b/src/systemcmds/boardinfo/boardinfo.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/systemcmds/reboot/Makefile b/src/systemcmds/boardinfo/module.mk index 15dd19982..6851d229b 100644 --- a/apps/systemcmds/reboot/Makefile +++ b/src/systemcmds/boardinfo/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,10 @@ ############################################################################ # -# Reboot command. +# Information about FMU and IO boards connected # -APPNAME = reboot -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = boardinfo +SRCS = boardinfo.c MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/eeprom/24xxxx_mtd.c b/src/systemcmds/eeprom/24xxxx_mtd.c index e34be44e3..e34be44e3 100644 --- a/apps/systemcmds/eeprom/24xxxx_mtd.c +++ b/src/systemcmds/eeprom/24xxxx_mtd.c diff --git a/apps/systemcmds/eeprom/eeprom.c b/src/systemcmds/eeprom/eeprom.c index 49da51358..49da51358 100644 --- a/apps/systemcmds/eeprom/eeprom.c +++ b/src/systemcmds/eeprom/eeprom.c diff --git a/src/systemcmds/eeprom/module.mk b/src/systemcmds/eeprom/module.mk new file mode 100644 index 000000000..07f3945be --- /dev/null +++ b/src/systemcmds/eeprom/module.mk @@ -0,0 +1,39 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# EEPROM file system driver +# + +MODULE_COMMAND = eeprom +SRCS = 24xxxx_mtd.c eeprom.c diff --git a/apps/systemcmds/i2c/i2c.c b/src/systemcmds/i2c/i2c.c index e1babdc12..4da238039 100644 --- a/apps/systemcmds/i2c/i2c.c +++ b/src/systemcmds/i2c/i2c.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: Lorenz Meier <lm@inf.ethz.ch> * * Redistribution and use in source and binary forms, with or without diff --git a/apps/systemcmds/i2c/Makefile b/src/systemcmds/i2c/module.mk index 046e74757..ab2357c7d 100644 --- a/apps/systemcmds/i2c/Makefile +++ b/src/systemcmds/i2c/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Build the i2c test tool. # -APPNAME = i2c -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = i2c +SRCS = i2c.c -include $(APPDIR)/mk/app.mk +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/mixer/mixer.c b/src/systemcmds/mixer/mixer.c index 55c4f0836..55c4f0836 100644 --- a/apps/systemcmds/mixer/mixer.c +++ b/src/systemcmds/mixer/mixer.c diff --git a/apps/systemcmds/mixer/Makefile b/src/systemcmds/mixer/module.mk index 3d8ac38cb..d5a3f9f77 100644 --- a/apps/systemcmds/mixer/Makefile +++ b/src/systemcmds/mixer/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,9 @@ # Build the mixer tool. # -APPNAME = mixer -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = mixer +SRCS = mixer.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/param/Makefile b/src/systemcmds/param/module.mk index f19cadbb6..63f15ad28 100644 --- a/apps/systemcmds/param/Makefile +++ b/src/systemcmds/param/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,10 @@ # Build the parameters tool. # -APPNAME = param -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = param +SRCS = param.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 MAXOPTIMIZATION = -Os + diff --git a/apps/systemcmds/param/param.c b/src/systemcmds/param/param.c index 56f5317e3..56f5317e3 100644 --- a/apps/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c diff --git a/apps/systemcmds/perf/Makefile b/src/systemcmds/perf/module.mk index f8bab41b6..77952842b 100644 --- a/apps/systemcmds/perf/Makefile +++ b/src/systemcmds/perf/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,10 +35,7 @@ # perf_counter reporting tool # -APPNAME = perf -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = perf +SRCS = perf.c MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/perf/perf.c b/src/systemcmds/perf/perf.c index 64443d019..b69ea597b 100644 --- a/apps/systemcmds/perf/perf.c +++ b/src/systemcmds/perf/perf.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/apps/systemcmds/bl_update/Makefile b/src/systemcmds/preflight_check/module.mk index d05493577..7c3c88783 100644 --- a/apps/systemcmds/bl_update/Makefile +++ b/src/systemcmds/preflight_check/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,11 @@ ############################################################################ # -# Build the eeprom tool. +# Pre-flight check. Locks down system for a few systems with blinking leds +# and buzzer if the sensors do not report an OK status. # -APPNAME = bl_update -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -include $(APPDIR)/mk/app.mk +MODULE_COMMAND = preflight_check +SRCS = preflight_check.c MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/preflight_check/preflight_check.c b/src/systemcmds/preflight_check/preflight_check.c index 9ac6f0b5e..42256be61 100644 --- a/apps/systemcmds/preflight_check/preflight_check.c +++ b/src/systemcmds/preflight_check/preflight_check.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Author: @author Lorenz Meier <lm@inf.ethz.ch> * * Redistribution and use in source and binary forms, with or without diff --git a/apps/systemcmds/pwm/Makefile b/src/systemcmds/pwm/module.mk index 5ab105ed1..4a23bba90 100644 --- a/apps/systemcmds/pwm/Makefile +++ b/src/systemcmds/pwm/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -35,8 +35,7 @@ # Build the pwm tool. # -APPNAME = pwm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 +MODULE_COMMAND = pwm +SRCS = pwm.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 4096 diff --git a/apps/systemcmds/pwm/pwm.c b/src/systemcmds/pwm/pwm.c index de7a53199..de7a53199 100644 --- a/apps/systemcmds/pwm/pwm.c +++ b/src/systemcmds/pwm/pwm.c diff --git a/src/systemcmds/reboot/module.mk b/src/systemcmds/reboot/module.mk new file mode 100644 index 000000000..19f64af54 --- /dev/null +++ b/src/systemcmds/reboot/module.mk @@ -0,0 +1,41 @@ +############################################################################ +# +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name PX4 nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# +# reboot command. +# + +MODULE_COMMAND = reboot +SRCS = reboot.c + +MAXOPTIMIZATION = -Os diff --git a/apps/systemcmds/reboot/reboot.c b/src/systemcmds/reboot/reboot.c index 47d3cd948..47d3cd948 100644 --- a/apps/systemcmds/reboot/reboot.c +++ b/src/systemcmds/reboot/reboot.c diff --git a/apps/examples/cdcacm/.context b/src/systemcmds/tests/.context index e69de29bb..e69de29bb 100644 --- a/apps/examples/cdcacm/.context +++ b/src/systemcmds/tests/.context diff --git a/src/systemcmds/tests/module.mk b/src/systemcmds/tests/module.mk new file mode 100644 index 000000000..754d3a0da --- /dev/null +++ b/src/systemcmds/tests/module.mk @@ -0,0 +1,28 @@ +# +# Assorted tests and the like +# + +MODULE_COMMAND = tests +MODULE_STACKSIZE = 12000 +MAXOPTIMIZATION = -Os + +SRCS = test_adc.c \ + test_bson.c \ + test_float.c \ + test_gpio.c \ + test_hott_telemetry.c \ + test_hrt.c \ + test_int.c \ + test_jig_voltages.c \ + test_led.c \ + test_sensors.c \ + test_servo.c \ + test_sleep.c \ + test_time.c \ + test_uart_baudchange.c \ + test_uart_console.c \ + test_uart_loopback.c \ + test_uart_send.c \ + tests_file.c \ + tests_main.c \ + tests_param.c diff --git a/apps/px4/tests/test_adc.c b/src/systemcmds/tests/test_adc.c index 030ac6e23..030ac6e23 100644 --- a/apps/px4/tests/test_adc.c +++ b/src/systemcmds/tests/test_adc.c diff --git a/apps/px4/tests/test_bson.c b/src/systemcmds/tests/test_bson.c index 6130fe763..6130fe763 100644 --- a/apps/px4/tests/test_bson.c +++ b/src/systemcmds/tests/test_bson.c diff --git a/apps/px4/tests/test_float.c b/src/systemcmds/tests/test_float.c index 4921c9bbb..4921c9bbb 100644 --- a/apps/px4/tests/test_float.c +++ b/src/systemcmds/tests/test_float.c diff --git a/apps/px4/tests/test_gpio.c b/src/systemcmds/tests/test_gpio.c index ab536d956..ab536d956 100644 --- a/apps/px4/tests/test_gpio.c +++ b/src/systemcmds/tests/test_gpio.c diff --git a/apps/px4/tests/test_hott_telemetry.c b/src/systemcmds/tests/test_hott_telemetry.c index 270dc3857..270dc3857 100644 --- a/apps/px4/tests/test_hott_telemetry.c +++ b/src/systemcmds/tests/test_hott_telemetry.c diff --git a/apps/px4/tests/test_hrt.c b/src/systemcmds/tests/test_hrt.c index f21dd115b..f21dd115b 100644 --- a/apps/px4/tests/test_hrt.c +++ b/src/systemcmds/tests/test_hrt.c diff --git a/apps/px4/tests/test_int.c b/src/systemcmds/tests/test_int.c index c59cee7b7..c59cee7b7 100644 --- a/apps/px4/tests/test_int.c +++ b/src/systemcmds/tests/test_int.c diff --git a/apps/px4/tests/test_jig_voltages.c b/src/systemcmds/tests/test_jig_voltages.c index 10c93b264..10c93b264 100644 --- a/apps/px4/tests/test_jig_voltages.c +++ b/src/systemcmds/tests/test_jig_voltages.c diff --git a/apps/px4/tests/test_led.c b/src/systemcmds/tests/test_led.c index 6e3efc668..6e3efc668 100644 --- a/apps/px4/tests/test_led.c +++ b/src/systemcmds/tests/test_led.c diff --git a/apps/px4/tests/test_sensors.c b/src/systemcmds/tests/test_sensors.c index 14503276c..14503276c 100644 --- a/apps/px4/tests/test_sensors.c +++ b/src/systemcmds/tests/test_sensors.c diff --git a/apps/px4/tests/test_servo.c b/src/systemcmds/tests/test_servo.c index f95760ca8..f95760ca8 100644 --- a/apps/px4/tests/test_servo.c +++ b/src/systemcmds/tests/test_servo.c diff --git a/apps/px4/tests/test_sleep.c b/src/systemcmds/tests/test_sleep.c index ae682b542..ae682b542 100644 --- a/apps/px4/tests/test_sleep.c +++ b/src/systemcmds/tests/test_sleep.c diff --git a/apps/px4/tests/test_time.c b/src/systemcmds/tests/test_time.c index 8a164f3fc..8a164f3fc 100644 --- a/apps/px4/tests/test_time.c +++ b/src/systemcmds/tests/test_time.c diff --git a/apps/px4/tests/test_uart_baudchange.c b/src/systemcmds/tests/test_uart_baudchange.c index 609a65c62..609a65c62 100644 --- a/apps/px4/tests/test_uart_baudchange.c +++ b/src/systemcmds/tests/test_uart_baudchange.c diff --git a/apps/px4/tests/test_uart_console.c b/src/systemcmds/tests/test_uart_console.c index f8582b52f..f8582b52f 100644 --- a/apps/px4/tests/test_uart_console.c +++ b/src/systemcmds/tests/test_uart_console.c diff --git a/apps/px4/tests/test_uart_loopback.c b/src/systemcmds/tests/test_uart_loopback.c index 3be152004..3be152004 100644 --- a/apps/px4/tests/test_uart_loopback.c +++ b/src/systemcmds/tests/test_uart_loopback.c diff --git a/apps/px4/tests/test_uart_send.c b/src/systemcmds/tests/test_uart_send.c index 7e1e8d307..7e1e8d307 100644 --- a/apps/px4/tests/test_uart_send.c +++ b/src/systemcmds/tests/test_uart_send.c diff --git a/apps/px4/tests/tests.h b/src/systemcmds/tests/tests.h index c02ea6808..c02ea6808 100644 --- a/apps/px4/tests/tests.h +++ b/src/systemcmds/tests/tests.h diff --git a/apps/px4/tests/tests_file.c b/src/systemcmds/tests/tests_file.c index 6f75b9812..6f75b9812 100644 --- a/apps/px4/tests/tests_file.c +++ b/src/systemcmds/tests/tests_file.c diff --git a/apps/px4/tests/tests_main.c b/src/systemcmds/tests/tests_main.c index 9f8c5c9ea..9f8c5c9ea 100644 --- a/apps/px4/tests/tests_main.c +++ b/src/systemcmds/tests/tests_main.c diff --git a/apps/px4/tests/tests_param.c b/src/systemcmds/tests/tests_param.c index 13f17bc43..13f17bc43 100644 --- a/apps/px4/tests/tests_param.c +++ b/src/systemcmds/tests/tests_param.c diff --git a/apps/systemcmds/delay_test/Makefile b/src/systemcmds/top/module.mk index e54cf2f4e..9239aafc3 100644 --- a/apps/systemcmds/delay_test/Makefile +++ b/src/systemcmds/top/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -32,13 +32,13 @@ ############################################################################ # -# Delay test +# Build top memory / cpu status tool. # -APPNAME = delay_test -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +MODULE_COMMAND = top +SRCS = top.c -include $(APPDIR)/mk/app.mk +MODULE_STACKSIZE = 3000 MAXOPTIMIZATION = -Os + diff --git a/apps/systemcmds/top/top.c b/src/systemcmds/top/top.c index 59d2bc8f1..59d2bc8f1 100644 --- a/apps/systemcmds/top/top.c +++ b/src/systemcmds/top/top.c |