PX4: only put one IO firmware in ROMFS

saves a bit of space. This also fixes makefile based upload
This commit is contained in:
Andrew Tridgell 2013-07-31 18:58:04 +10:00
parent 272057ff6d
commit 16a3f0d47b
2 changed files with 25 additions and 19 deletions

View File

@ -57,33 +57,31 @@ then
then then
echo "Detected FMUv1 board" echo "Detected FMUv1 board"
set BOARD FMUv1 set BOARD FMUv1
set PX4IOBIN /etc/px4io/px4io-v1.bin
else else
l3gd20 start l3gd20 start
echo "Detected FMUv2 board" echo "Detected FMUv2 board"
set BOARD FMUv2 set BOARD FMUv2
set PX4IOBIN /etc/px4io/px4io-v2.bin
fi fi
echo checking for $PX4IOBIN echo checking for /etc/px4io/px4io.bin
if [ -f $PX4IOBIN ] if [ -f /etc/px4io/px4io.bin ]
then then
echo "Checking for new px4io firmware" echo "Checking for new px4io firmware"
if cmp $PX4IOBIN /fs/microsd/px4io.loaded if cmp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded
then then
echo "No new px4io firmware" echo "No new px4io firmware"
else else
echo Loading $PX4IOBIN echo Loading /etc/px4io/px4io.bin
tone_alarm MBABGP tone_alarm MBABGP
if px4io update $PX4IOBIN > /fs/microsd/APM/px4io_update.log if px4io update /etc/px4io/px4io.bin > /fs/microsd/APM/px4io_update.log
then then
cp $PX4IOBIN /fs/microsd/px4io.loaded cp /etc/px4io/px4io.bin /fs/microsd/px4io.loaded
echo Loaded $PX4IOBIN OK >> /fs/microsd/APM/px4io_update.log echo Loaded /etc/px4io/px4io.bin OK >> /fs/microsd/APM/px4io_update.log
tone_alarm MSPAA tone_alarm MSPAA
else else
echo Failed loading $PX4IOBIN >> /fs/microsd/APM/px4io_update.log echo Failed loading /etc/px4io/px4io.bin >> /fs/microsd/APM/px4io_update.log
echo "check Safety Button" >> /fs/microsd/APM/px4io_update.log echo "check Safety Button" >> /fs/microsd/APM/px4io_update.log
echo "Failed to upgrade PX4IO firmware - check PX4IO is in bootloader mode" echo "Failed to upgrade PX4IO firmware"
tone_alarm MNGGG tone_alarm MNGGG
fi fi
fi fi

View File

@ -54,14 +54,17 @@ px4: px4-v1 px4-v2
px4-clean: clean px4-archives-clean px4-clean: clean px4-archives-clean
$(v) /bin/rm -rf $(PX4_ROOT)/makefiles/build $(PX4_ROOT)/Build $(v) /bin/rm -rf $(PX4_ROOT)/makefiles/build $(PX4_ROOT)/Build
px4-upload-v1: px4-v1-upload:
$(RULEHDR) $(RULEHDR)
$(PX4_ROOT)/Tools/px_uploader.py --port /dev/serial/by-id/usb-3D_Robotics_PX4* $(SKETCH)-v1.px4 $(v) ln -sf $(PWD)/$(PX4_V1_CONFIG_FILE) $(PX4_ROOT)/makefiles/
$(v) $(PX4_MAKE) px4fmu-v1_APM upload
px4-upload-v2: px4-v2-upload:
$(PX4_ROOT)/Tools/px_uploader.py --port /dev/serial/by-id/usb-3D_Robotics_PX4* $(SKETCH)-v2.px4 $(RULEHDR)
$(v) ln -sf $(PWD)/$(PX4_V2_CONFIG_FILE) $(PX4_ROOT)/makefiles/
$(v) $(PX4_MAKE) px4fmu-v2_APM upload
px4-upload: px4-upload-v1 px4-upload: px4-v1-upload
px4-archives-clean: px4-archives-clean:
$(v) /bin/rm -rf $(PX4_ROOT)/Archives $(v) /bin/rm -rf $(PX4_ROOT)/Archives
@ -69,8 +72,10 @@ px4-archives-clean:
px4-io-v1: $(PX4_ROOT)/Archives/px4io-v1.export px4-io-v1: $(PX4_ROOT)/Archives/px4io-v1.export
$(v) make -C $(PX4_ROOT) px4io-v1_default $(v) make -C $(PX4_ROOT) px4io-v1_default
$(v) /bin/rm -f px4io-v1.bin $(v) /bin/rm -f px4io-v1.bin
$(v) cp $(PX4_ROOT)/Build/px4io-v1_default.build/firmware.bin px4io-v1.bin $(v) cp $(PX4_ROOT)/Images/px4io-v1_default.bin px4io-v1.bin
$(v) cp px4io-v1.bin $(MK_DIR)/PX4/ROMFS/px4io/ $(v) mkdir -p $(MK_DIR)/PX4/ROMFS/px4io/
$(v) rm -f $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) cp px4io-v1.bin $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) echo "PX4IOv1 Firmware is in px4io-v1.bin" $(v) echo "PX4IOv1 Firmware is in px4io-v1.bin"
@ -78,7 +83,10 @@ px4-io-v2: $(PX4_ROOT)/Archives/px4io-v2.export
$(v) make -C $(PX4_ROOT) px4io-v2_default $(v) make -C $(PX4_ROOT) px4io-v2_default
$(v) /bin/rm -f px4io-v1.bin $(v) /bin/rm -f px4io-v1.bin
$(v) cp $(PX4_ROOT)/Build/px4io-v2_default.build/firmware.bin px4io-v2.bin $(v) cp $(PX4_ROOT)/Build/px4io-v2_default.build/firmware.bin px4io-v2.bin
$(v) cp px4io-v2.bin $(MK_DIR)/PX4/ROMFS/px4io/ $(v) cp $(PX4_ROOT)/Images/px4io-v2_default.bin px4io-v2.bin
$(v) mkdir -p $(MK_DIR)/PX4/ROMFS/px4io/
$(v) rm -f $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) cp px4io-v2.bin $(MK_DIR)/PX4/ROMFS/px4io/px4io.bin
$(v) echo "PX4IOv2 Firmware is in px4io-v2.bin" $(v) echo "PX4IOv2 Firmware is in px4io-v2.bin"
px4-io: px4-io-v1 px4-io-v2 px4-io: px4-io-v1 px4-io-v2