ARC: SConstruct: Fix print syntax

In Python 3.x "print" is a function, not a command,
thus it requires braces around its arguments.

Otherwise build system fails to proceed.
This commit is contained in:
Alexey Brodkin 2022-10-16 17:18:44 +04:00
parent 56794960d1
commit d6924d7a56
1 changed files with 32 additions and 32 deletions

View File

@ -30,7 +30,7 @@ if not os.path.isdir(EMBARC_BSP_ROOT):
SUPPORTED_BOARD_DIR = EMBARC_BSP_ROOT + '/board' SUPPORTED_BOARD_DIR = EMBARC_BSP_ROOT + '/board'
SUPPORTED_BOARD = [d for d in os.listdir(SUPPORTED_BOARD_DIR) if os.path.isdir(os.path.join(SUPPORTED_BOARD_DIR,d))] SUPPORTED_BOARD = [d for d in os.listdir(SUPPORTED_BOARD_DIR) if os.path.isdir(os.path.join(SUPPORTED_BOARD_DIR,d))]
print 'supported BOARD = ' + str(SUPPORTED_BOARD) print('supported BOARD = ' + str(SUPPORTED_BOARD))
AddOption('--BOARD', AddOption('--BOARD',
dest = 'BOARD', dest = 'BOARD',
@ -99,29 +99,29 @@ AddOption('--embarc_clean',
if GetOption('BOARD'): if GetOption('BOARD'):
board = GetOption('BOARD') board = GetOption('BOARD')
if board not in SUPPORTED_BOARD: if board not in SUPPORTED_BOARD:
print 'board %s not supported, available boards:' % board print('board %s not supported, available boards:' % board)
print SUPPORTED_BOARD print(SUPPORTED_BOARD)
exit(0) exit(0)
else: else:
BOARD = board BOARD = board
print 'get BOARD = [%s]' % board print('get BOARD = [%s]' % board)
if BOARD == 'emsdp': if BOARD == 'emsdp':
SUPPORTED_BD_VER = ['rev2'] SUPPORTED_BD_VER = ['rev2']
else: else:
SUPPORTED_BD_VER_DIR = SUPPORTED_BOARD_DIR + '/' + BOARD + '/configs' SUPPORTED_BD_VER_DIR = SUPPORTED_BOARD_DIR + '/' + BOARD + '/configs'
SUPPORTED_BD_VER = [d for d in os.listdir(SUPPORTED_BD_VER_DIR) if os.path.isdir(os.path.join(SUPPORTED_BD_VER_DIR,d))] SUPPORTED_BD_VER = [d for d in os.listdir(SUPPORTED_BD_VER_DIR) if os.path.isdir(os.path.join(SUPPORTED_BD_VER_DIR,d))]
print 'supported BD_VER = ' + str(SUPPORTED_BD_VER) print('supported BD_VER = ' + str(SUPPORTED_BD_VER))
if GetOption('BD_VER'): if GetOption('BD_VER'):
bd_ver = GetOption('BD_VER') bd_ver = GetOption('BD_VER')
if bd_ver not in SUPPORTED_BD_VER: if bd_ver not in SUPPORTED_BD_VER:
print 'bd_ver %s not supported, available bd_ver:' % bd_ver print('bd_ver %s not supported, available bd_ver:' % bd_ver)
print SUPPORTED_BD_VER print(SUPPORTED_BD_VER)
exit(0) exit(0)
else: else:
BD_VER = bd_ver BD_VER = bd_ver
print 'get BD_VER = [%s]' % BD_VER print('get BD_VER = [%s]' % BD_VER)
if BOARD == 'emsdp': if BOARD == 'emsdp':
SUPPORTED_CORE_DIR = SUPPORTED_BOARD_DIR + '/' + BOARD + '/rev2/configs' SUPPORTED_CORE_DIR = SUPPORTED_BOARD_DIR + '/' + BOARD + '/rev2/configs'
@ -130,53 +130,53 @@ else:
SUPPORTED_CORE_DIR = SUPPORTED_BD_VER_DIR + '/' + BD_VER + '/tcf' SUPPORTED_CORE_DIR = SUPPORTED_BD_VER_DIR + '/' + BD_VER + '/tcf'
SUPPORTED_CORE = [os.path.splitext(d)[0] for d in os.listdir(SUPPORTED_CORE_DIR)] SUPPORTED_CORE = [os.path.splitext(d)[0] for d in os.listdir(SUPPORTED_CORE_DIR)]
print 'supported CUR_CORE = ' + str(SUPPORTED_CORE) print('supported CUR_CORE = ' + str(SUPPORTED_CORE))
if GetOption('CUR_CORE'): if GetOption('CUR_CORE'):
cur_core = GetOption('CUR_CORE') cur_core = GetOption('CUR_CORE')
if cur_core not in SUPPORTED_CORE: if cur_core not in SUPPORTED_CORE:
print 'cur_core %s not supported, available cur_core:' % cur_core print('cur_core %s not supported, available cur_core:' % cur_core)
print SUPPORTED_CORE print(SUPPORTED_CORE)
exit(0) exit(0)
else: else:
CUR_CORE = cur_core CUR_CORE = cur_core
print 'get CUR_CORE = [%s]' % CUR_CORE print('get CUR_CORE = [%s]' % CUR_CORE)
SUPPORTED_TOOLCHAIN = ['mw', 'gnu'] SUPPORTED_TOOLCHAIN = ['mw', 'gnu']
print 'supported TOOLCHAIN = ' + str(SUPPORTED_TOOLCHAIN) print('supported TOOLCHAIN = ' + str(SUPPORTED_TOOLCHAIN))
if GetOption('TOOLCHAIN'): if GetOption('TOOLCHAIN'):
toolchain = GetOption('TOOLCHAIN') toolchain = GetOption('TOOLCHAIN')
if toolchain not in SUPPORTED_TOOLCHAIN: if toolchain not in SUPPORTED_TOOLCHAIN:
print 'toolchain %s not supported, available toolchain:' % toolchain print('toolchain %s not supported, available toolchain:' % toolchain)
print SUPPORTED_TOOLCHAIN print(SUPPORTED_TOOLCHAIN)
exit(0) exit(0)
else: else:
TOOLCHAIN = toolchain TOOLCHAIN = toolchain
print 'get TOOLCHAIN = [%s]' % TOOLCHAIN print('get TOOLCHAIN = [%s]' % TOOLCHAIN)
SUPPORTED_OLEVEL = ['O0', 'O2', 'Os'] SUPPORTED_OLEVEL = ['O0', 'O2', 'Os']
print 'supported OLEVEL = ' + str(SUPPORTED_OLEVEL) print('supported OLEVEL = ' + str(SUPPORTED_OLEVEL))
if GetOption('OLEVEL'): if GetOption('OLEVEL'):
olevel = GetOption('OLEVEL') olevel = GetOption('OLEVEL')
if olevel not in SUPPORTED_OLEVEL: if olevel not in SUPPORTED_OLEVEL:
print 'olevel %s not supported, available olevel:' % toolchain print('olevel %s not supported, available olevel:' % toolchain)
print SUPPORTED_OLEVEL print(SUPPORTED_OLEVEL)
exit(0) exit(0)
else: else:
OLEVEL = olevel OLEVEL = olevel
print 'get OLEVEL = [%s]' % olevel print('get OLEVEL = [%s]' % olevel)
EMBARC_LIB_PATH = EMBARC_BSP_ROOT + '/obj_%s_%s/%s_%s'%(BOARD, BD_VER, TOOLCHAIN, CUR_CORE) EMBARC_LIB_PATH = EMBARC_BSP_ROOT + '/obj_%s_%s/%s_%s'%(BOARD, BD_VER, TOOLCHAIN, CUR_CORE)
# print 'EMBARC_LIB_PATH = %s'%EMBARC_LIB_PATH # print('EMBARC_LIB_PATH = %s'%EMBARC_LIB_PATH)
TARGET = 'rtthread_snps_embarc.elf' TARGET = 'rtthread_snps_embarc.elf'
# print 'TARGET = %s'%TARGET # print('TARGET = %s'%TARGET)
# ip_ph_dir = EMBARC_BSP_ROOT + '/device/peripheral' # ip_ph_dir = EMBARC_BSP_ROOT + '/device/peripheral'
# ip_ph_path = [os.path.join(ip_ph_dir,d) for d in os.listdir(ip_ph_dir) if os.path.isdir(os.path.join(ip_ph_dir,d))] # ip_ph_path = [os.path.join(ip_ph_dir,d) for d in os.listdir(ip_ph_dir) if os.path.isdir(os.path.join(ip_ph_dir,d))]
@ -186,17 +186,17 @@ if BOARD == 'emsdp':
else: else:
board_inc_path = [EMBARC_BSP_ROOT + '/board/%s/configs/%s'%(BOARD, BD_VER)] board_inc_path = [EMBARC_BSP_ROOT + '/board/%s/configs/%s'%(BOARD, BD_VER)]
# print 'board_inc_path = %s' % board_inc_path # print('board_inc_path = %s' % board_inc_path)
# print 'ip_dw_path = %s' % ip_dw_path # print('ip_dw_path = %s' % ip_dw_path)
# print 'ip_ss_path = %s' % ip_ss_path # print('ip_ss_path = %s' % ip_ss_path)
# print 'ip_ph_path = %s' % ip_ph_path # print('ip_ph_path = %s' % ip_ph_path)
EMBARC_CPPPATH = [ EMBARC_BSP_ROOT, EMBARC_CPPPATH = [ EMBARC_BSP_ROOT,
EMBARC_BSP_ROOT + '/include', EMBARC_BSP_ROOT + '/include',
EMBARC_BSP_ROOT + '/board', EMBARC_BSP_ROOT + '/board',
EMBARC_LIB_PATH + '/embARC_generated', EMBARC_LIB_PATH + '/embARC_generated',
] + board_inc_path ] + board_inc_path
#print "EMBARC_CPPPATH: %s"%EMBARC_CPPPATH #print("EMBARC_CPPPATH: %s"%EMBARC_CPPPATH)
if TOOLCHAIN == 'mw': if TOOLCHAIN == 'mw':
EXEC_PATH = 'C:/ARC/MetaWare/arc/bin' EXEC_PATH = 'C:/ARC/MetaWare/arc/bin'
@ -264,8 +264,8 @@ elif TOOLCHAIN == 'gnu':
DBG_HW_FLAGS = ''' -ex "target remote | openocd --pipe %s" -ex "load" ''' % OPENOCD_OPTIONS DBG_HW_FLAGS = ''' -ex "target remote | openocd --pipe %s" -ex "load" ''' % OPENOCD_OPTIONS
else : else :
print 'TOOLCHAIN %s is not supported, available toolchain:' % TOOLCHAIN print('TOOLCHAIN %s is not supported, available toolchain:' % TOOLCHAIN)
print SUPPORTED_TOOLCHAIN print(SUPPORTED_TOOLCHAIN)
exit(-1) exit(-1)
env = Environment(ENV = os.environ, tools = ['mingw'], env = Environment(ENV = os.environ, tools = ['mingw'],
@ -286,7 +286,7 @@ embarc_make_cmd = ' %s -f options/options.mk BOARD=%s BD_VER=%s CUR_CORE=%s TOOL
embarc_clean_cmd = ' %s -f options/options.mk distclean '%MAKE embarc_clean_cmd = ' %s -f options/options.mk distclean '%MAKE
if GetOption('embarc_build'): if GetOption('embarc_build'):
print 'os.system: ' + embarc_cd_cmd + ' && ' + embarc_make_cmd print('os.system: ' + embarc_cd_cmd + ' && ' + embarc_make_cmd)
os.system(embarc_cd_cmd + ' && ' + embarc_make_cmd) os.system(embarc_cd_cmd + ' && ' + embarc_make_cmd)
exit(0) exit(0)
@ -298,7 +298,7 @@ if GetOption('gdb'):
if os.path.isfile(TARGET): if os.path.isfile(TARGET):
os.system(DBG + DBG_HW_FLAGS + TARGET) os.system(DBG + DBG_HW_FLAGS + TARGET)
else: else:
print TARGET + 'not exist, please build first!!' print(TARGET + 'not exist, please build first!!')
exit(0) exit(0)
if GetOption('mdb'): if GetOption('mdb'):
@ -310,7 +310,7 @@ if GetOption('mdb'):
else: else:
os.system('mdb -source_path=%s -nooptions -nogoifmain -toggle=include_local_symbols=1 -hard -digilent '%startup_path + rtconfig.TARGET) os.system('mdb -source_path=%s -nooptions -nogoifmain -toggle=include_local_symbols=1 -hard -digilent '%startup_path + rtconfig.TARGET)
else: else:
print TARGET + 'not exist, please build first!!' print(TARGET + 'not exist, please build first!!')
exit(0) exit(0)
# os.system(embarc_cd_cmd + ' && ' + embarc_make_cmd) # os.system(embarc_cd_cmd + ' && ' + embarc_make_cmd)