def __get_boards(dict):
boards = []
- keys = dict.keys()
+ keys = list(dict.keys())
for key in keys:
idx = key.find('.name')
if idx > 0:
def __get_cpu(dict, board):
cpus = []
- keys = dict.keys()
+ keys = list(dict.keys())
for key in keys:
idx = key.find(board + '.menu.cpu.')
start = len(board + '.menu.cpu.')
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
+ print("Upload command: %s" %upload_cmd)
install_cmd = env.Command('install_cmd', None, upload_cmd)
env.Default('install_cmd')
elif target_arch == 'arm':
port = 'ttyACM0'
upload_cmd = 'stty -F /dev/' + port + ' speed 1200 cs8 -cstopb -parenb \n' + arduino_home + '/hardware/tools/bossac -i --port=' + port + ' -U false -e -w -b ' + binary + ' -R'
- print "Upload command: %s" %upload_cmd
+ print("Upload command: %s" %upload_cmd)
install_cmd = env.Command('install_cmd', None, upload_cmd)
env.Default('install_cmd')
# installed. If not, get them and install them.
SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'arduino', 'SConscript'))
arduino_home = env.get('ARDUINO_HOME')
-print 'ARDUINO_HOME = ' + env.get('ARDUINO_HOME')
+print('ARDUINO_HOME = ' + env.get('ARDUINO_HOME'))
# Overwrite suffixes and prefixes
if env['HOST_OS'] == 'win32':
else:
env.AppendUnique(CCFLAGS = ['-g'])
+# Force header presence defines
+env.AppendUnique(CPPDEFINES = ['HAVE_ARDUINO_TIME_H'])
+
# BOARD / CPU option
# Get IDE version
vf = open(os.path.join(arduino_home, 'lib', 'version.txt'), 'r')
version = vf.readline().replace('.', '').strip()
else:
- print '''
+ print('''
************************************* Error ***********************************
* Can't find version file (lib/version.txt), please check if (%s)
* is arduino root directory. *
*******************************************************************************
-''' % arduino_home
+''' % arduino_home)
Exit(1)
if version[0:2] == '10':
env.Replace(LINK = 'avr-gcc')
env.Replace(RANLIB = 'avr-ranlib')
if target_arch != 'avr':
- print '''
+ print('''
************************************* Error ***********************************
* Arduino 1.0.x IDE only support 'avr', to support other arch at least 1.5.x *
* is required.
*******************************************************************************
-'''
+''')
Exit(1)
else:
is_1_0_x = False
boards_info = __parse_config(os.path.join(arduino_home, 'hardware', 'arduino', 'sam', 'boards.txt'))
platform_info = __parse_config(os.path.join(arduino_home, 'hardware', 'arduino', 'sam', 'platform.txt'))
else:
- print '''
+ print('''
************************************* Error ***********************************
* CPU arch %s isn't supported currently.
*******************************************************************************
-''' % target_arch
+''' % target_arch)
#Board option, let user to select the board
boards = __get_boards(boards_info)