Skip to content
Snippets Groups Projects
  • Matthias Grob's avatar
    58dd7be1
    Cygwin: enable arm nuttx upload within cygwin · 58dd7be1
    Matthias Grob authored
    In the Cygwin environment the native Windows serial COM# ports get mapped
    to /dev/ttyS# for POSIX compatibility. While # is one number lower inside
    the environment than the COM port number because it's 0 indexed instead
    of 1.
    
    I added the necessary handling to all the dependent parts I found which
    allows uploading to /dev/ttyS# when the cygwin platform is detected.
    Now the usual "make px4fmu-v4 upload" and
    "./Tools/upload.sh build/px4fmu-v4_default/px4fmu-v4_default.px4" work.
    58dd7be1
    History
    Cygwin: enable arm nuttx upload within cygwin
    Matthias Grob authored
    In the Cygwin environment the native Windows serial COM# ports get mapped
    to /dev/ttyS# for POSIX compatibility. While # is one number lower inside
    the environment than the COM port number because it's 0 indexed instead
    of 1.
    
    I added the necessary handling to all the dependent parts I found which
    allows uploading to /dev/ttyS# when the cygwin platform is detected.
    Now the usual "make px4fmu-v4 upload" and
    "./Tools/upload.sh build/px4fmu-v4_default/px4fmu-v4_default.px4" work.
upload.sh 848 B
#!/usr/bin/env bash

EXEDIR=`pwd`
BASEDIR=$(dirname $0)

SYSTYPE=`uname -s`

#
# Serial port defaults.
#
# XXX The uploader should be smarter than this.
#
if [ $SYSTYPE = "Darwin" ];
then
SERIAL_PORTS="/dev/tty.usbmodemPX*,/dev/tty.usbmodem*"
fi

if [ $SYSTYPE = "Linux" ];
then
SERIAL_PORTS="/dev/serial/by-id/*_PX4_*,/dev/serial/by-id/usb-3D_Robotics*,/dev/serial/by-id/usb-The_Autopilot*,/dev/serial/by-id/usb-Bitcraze*,/dev/serial/by-id/pci-Bitcraze*,/dev/serial/by-id/usb-Gumstix*,"
fi

if [[ $SYSTYPE = *"CYGWIN"* ]];
then
SERIAL_PORTS="/dev/ttyS*"
fi

if [ $SYSTYPE = "" ];
then
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"
fi

python $BASEDIR/px_uploader.py --port $SERIAL_PORTS $1