Merge pull request #6531 from foss-for-synopsys-dwc-arc-processors/abrodkin-update

ARC: Minor port updates
This commit is contained in:
Bernard Xiong 2022-10-18 01:39:58 +08:00 committed by GitHub
commit b617a6abd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 38 deletions

View File

@ -59,7 +59,7 @@ Now both GNU and MetaWare Toolchain are supported, set the System environment va
GNU: GNU:
set RTT_CC=gnu set RTT_CC=gcc
MetaWare: MetaWare:

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)

View File

@ -302,7 +302,7 @@ void rt_hw_board_init()
static void rt_hw_timer_isr(int vector, void *param) static void rt_hw_timer_isr(int vector, void *param)
{ {
timer_int_clear(BOARD_OS_TIMER_ID); arc_timer_int_clear(BOARD_OS_TIMER_ID);
rt_tick_increase(); rt_tick_increase();
} }
@ -312,8 +312,8 @@ int rt_hw_timer_init(void)
unsigned int cyc = BOARD_CPU_CLOCK / RT_TICK_PER_SECOND; unsigned int cyc = BOARD_CPU_CLOCK / RT_TICK_PER_SECOND;
int_disable(BOARD_OS_TIMER_INTNO); /* disable os timer interrupt */ int_disable(BOARD_OS_TIMER_INTNO); /* disable os timer interrupt */
timer_stop(BOARD_OS_TIMER_ID); arc_timer_stop(BOARD_OS_TIMER_ID);
timer_start(BOARD_OS_TIMER_ID, TIMER_CTRL_IE | TIMER_CTRL_NH, cyc); arc_timer_start(BOARD_OS_TIMER_ID, TIMER_CTRL_IE | TIMER_CTRL_NH, cyc);
int_handler_install(BOARD_OS_TIMER_INTNO, (INT_HANDLER_T)rt_hw_timer_isr); int_handler_install(BOARD_OS_TIMER_INTNO, (INT_HANDLER_T)rt_hw_timer_isr);
int_pri_set(BOARD_OS_TIMER_INTNO, INT_PRI_MIN + 1); /* currently, firq(INT_PRI_MIN) not supported*/ int_pri_set(BOARD_OS_TIMER_INTNO, INT_PRI_MIN + 1); /* currently, firq(INT_PRI_MIN) not supported*/

View File

@ -15,8 +15,8 @@ elif CROSS_TOOL =='mw':
PLATFORM = 'mw' PLATFORM = 'mw'
EXEC_PATH = 'C:/ARC/MetaWare/arc/bin' EXEC_PATH = 'C:/ARC/MetaWare/arc/bin'
# if os.getenv('RTT_EXEC_PATH'): if os.getenv('RTT_EXEC_PATH'):
# EXEC_PATH = os.getenv('RTT_EXEC_PATH') EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'debug' BUILD = 'debug'