Move uavcan bin files to ROMFS based on naming convention

This commit is contained in:
David Sidrane 2015-11-21 04:01:55 -10:00
parent 73e26804da
commit c0ef1a9dcb
2 changed files with 34 additions and 2 deletions

View File

@ -102,9 +102,8 @@ script:
- echo 'Building UAVCAN node firmware..' && git clone https://github.com/thiemar/vectorcontrol
- cd vectorcontrol
- BOARD=s2740vc_1_0 make && BOARD=px4esc_1_6 make
- ../Tools/uavcan_copy.sh
- cd ..
- mkdir -p ROMFS/px4fmu_common/uavcan/fw/com.thiemar.s2740vc-v1/1.0/
- mkdir -p ROMFS/px4fmu_common/uavcan/fw/org.pixhawk.px4esc-v1/1.0/
- echo 'Building NuttX px4fmu-v1 Firmware..' && make px4fmu-v1_default
- echo 'Building NuttX px4fmu-v2 Firmware..' && make px4fmu-v2_default
- echo 'Building NuttX px4fmu-v4 Firmware..' && make px4fmu-v4_default

33
Tools/uavcan_copy.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
UAVCANFW=../ROMFS/px4fmu_common/uavcan/fw
echo Removing : $UAVCANFW
rm -fr $UAVCANFW
for f in $(find firmware -type f -name "*.*.bin")
do
UAVCAN_NAME=$(echo $f | cut -d"/" -f2 | cut -d. -f1-4 | cut -d- -f1-2)
UAVCAN_HW=$(echo $f cut -d/ -f2 | cut -d. -f1-4 | cut -d- -f3)
DST=$(echo $f | cut -d. -f3-7 | cut -d- -f1,2,3).$(echo $f | cut -d. -f6,7)
# deal with legacy non conforming naming
if [[ ${DST:(-7)} == bin.bin ]]
then
echo " WARNING: Improper name format!!!!!!!!! $f see should be <uavcan_name>-<HW_MAJOR>.<HW_MINOR)-<HW_MAJOR>.<HW_MINOR).<git hash[8]>.bin"
DST=${DST%???}
fi
if [ ${#DST} -le 28 ]
echo Processing file: $f
then
if [ -d "${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}" ]
then
echo " ERROR: name colision directory ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW} exits!"
exit 2
fi
echo " Creating Directory ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}"
mkdir -p ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}
echo " Copying $f to ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}/${DST}"
cp $f ${UAVCANFW}/${UAVCAN_NAME}/${UAVCAN_HW}/${DST}
else
echo " ERROR: $DST is ${#DST} charaters and needs to be less than or equal to 28"
exit 1
fi
done
exit 0