+#Currently supporting only mega (ie. Arduino ATMega2560) and arduino_due_x/arduino_due_x_dbg (i.e. Arduino Due) builds
+def __upload(env, binary):
+ if target_arch == 'avr':
+ protocol = __get_board_info(board, '.upload.protocol')
+ speed = __get_board_info(board, '.upload.speed')
+ port = '/dev/ttyACM0'
+ upload_cmd = arduino_home + '/hardware/tools/avr/bin/avrdude -C' + arduino_home +'/hardware/tools/avr/etc/avrdude.conf -p' \
+ + mcu + ' -c' + protocol + ' -P' + port + ' -b' + speed + ' -D -Uflash:w:' + binary + ':i'
+ print "Upload command: %s" %upload_cmd
+ install_cmd = env.Command('install_cmd', None, upload_cmd)
+ env.Default('install_cmd')
+ elif target_arch == 'arm':
+ protocol = __get_board_info(board, '.upload.protocol')
+ speed = __get_board_info(board, '.upload.speed')
+ port = 'ttyACM0'
+ uu = __get_board_info(board, '.upload.native_usb')
+ os.system('stty -F /dev/' + port + ' speed 1200 cs8 -cstopb -parenb')
+ os.system(arduino_home + '/hardware/tools/bossac -i --port=' + port + ' -U false -e -w -b ' + binary + ' -R')
+