2013-01-08 22:40:58 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH = 'v850'
|
|
|
|
CPU = '70f34'
|
|
|
|
|
|
|
|
CROSS_TOOL = 'iar'
|
|
|
|
|
|
|
|
if os.getenv('RTT_CC'):
|
2022-03-29 18:42:22 +08:00
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
if CROSS_TOOL == 'gcc':
|
2018-02-06 20:07:28 +08:00
|
|
|
print('================ERROR============================')
|
|
|
|
print('Not support gcc yet!')
|
|
|
|
print('=================================================')
|
2013-01-08 22:40:58 +08:00
|
|
|
exit(0)
|
|
|
|
elif CROSS_TOOL == 'iar':
|
2022-05-31 06:30:42 +08:00
|
|
|
PLATFORM = 'iccarm'
|
2022-03-29 18:42:22 +08:00
|
|
|
EXEC_PATH = 'C:/Program Files/IAR Systems/Embedded Workbench 6.0 Evaluation_0'
|
2013-01-08 22:40:58 +08:00
|
|
|
elif CROSS_TOOL == 'keil':
|
2018-02-06 20:07:28 +08:00
|
|
|
print('================ERROR============================')
|
|
|
|
print('Not support keil yet!')
|
|
|
|
print('=================================================')
|
2013-01-08 22:40:58 +08:00
|
|
|
exit(0)
|
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
2022-03-29 18:42:22 +08:00
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
BUILD = 'debug'
|
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
|
|
|
PREFIX = 'm32c-elf-'
|
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
|
|
|
LINK = PREFIX + 'gcc'
|
|
|
|
TARGET_EXT = 'out'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
|
|
|
|
DEVICE = ' -mcpu=m16c'
|
|
|
|
CFLAGS = DEVICE
|
|
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
|
|
|
LFLAGS = DEVICE + ' -nostartfiles' + ' -Wl,--gc-sections,-Map=rtthread_m16c.map,-cref,-u,_start -T m16c62p.ld'
|
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
POST_ACTION = OBJCPY + ' -O srec $TARGET rtthread.mot\n' + SIZE + ' $TARGET \n'
|
|
|
|
|
2022-05-31 06:30:42 +08:00
|
|
|
elif PLATFORM == 'iccarm':
|
2013-01-08 22:40:58 +08:00
|
|
|
# toolchains
|
|
|
|
CC = 'iccv850'
|
|
|
|
AS = 'av850'
|
|
|
|
AR = 'xar'
|
|
|
|
LINK = 'xlink'
|
|
|
|
TARGET_EXT = 'hex'
|
|
|
|
|
|
|
|
DEVICE = '--cpu V850'
|
|
|
|
|
|
|
|
AFLAGS = '-s+'
|
|
|
|
AFLAGS = ' -v1'
|
|
|
|
# AFLAGS += ' -M<>'
|
|
|
|
AFLAGS += ' -s+'
|
|
|
|
AFLAGS += ' -DCODE_MODEL_NORMAL'
|
|
|
|
AFLAGS += ' -DDATA_MODEL_TINY'
|
|
|
|
AFLAGS += ' -w+'
|
|
|
|
AFLAGS += ' -r'
|
2018-04-07 15:43:45 +08:00
|
|
|
AFLAGS += ' -I"' + EXEC_PATH + '/v850/INC"'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
LFLAGS = '-xms'
|
2018-04-07 15:43:45 +08:00
|
|
|
LFLAGS += ' -I"' + EXEC_PATH + '/v850/LIB"'
|
2013-01-08 22:40:58 +08:00
|
|
|
LFLAGS += ' -rt'
|
|
|
|
LFLAGS += ' -s __program_start'
|
|
|
|
LFLAGS += ' -D_CSTACK_SIZE=1000'
|
2018-04-07 15:43:45 +08:00
|
|
|
LFLAGS += ' "' + EXEC_PATH + '/v850/LIB/dl85nn1.r85"'
|
2013-01-08 22:40:58 +08:00
|
|
|
LFLAGS += ' -D_HEAP_SIZE=0'
|
|
|
|
|
2018-04-07 15:43:45 +08:00
|
|
|
# LFLAGS += ' "' + EXEC_PATH + '/v850/lib/CLIB/clm16cfnffwc.r34"'
|
2013-01-08 22:40:58 +08:00
|
|
|
# LFLAGS += ' -e_small_write=_formatted_write'
|
|
|
|
# LFLAGS += ' -e_medium_read=_formatted_read'
|
|
|
|
|
|
|
|
# CFLAGS = DEVICE
|
|
|
|
CFLAGS = '--diag_suppress Pa050'
|
|
|
|
CFLAGS += ' -v1'
|
|
|
|
CFLAGS += ' -mt'
|
|
|
|
CFLAGS += ' --code_model normal'
|
|
|
|
CFLAGS += ' --no_cse'
|
|
|
|
CFLAGS += ' --no_unroll'
|
|
|
|
CFLAGS += ' --no_inline'
|
|
|
|
CFLAGS += ' --no_code_motion'
|
2018-04-07 15:43:45 +08:00
|
|
|
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/v850/LIB/dl85nn1.h"'
|
|
|
|
CFLAGS += ' -I"' + EXEC_PATH + '/v850/INC"'
|
2013-01-08 22:40:58 +08:00
|
|
|
CFLAGS += ' --no_tbaa'
|
|
|
|
CFLAGS += ' --debug'
|
|
|
|
CFLAGS += ' --lock_regs 0'
|
|
|
|
CFLAGS += ' --migration_preprocessor_extensions'
|
|
|
|
CFLAGS += ' -e'
|
|
|
|
CFLAGS += ' -Ol'
|
2022-03-29 18:42:22 +08:00
|
|
|
|
|
|
|
EXEC_PATH = EXEC_PATH + '/v850/bin'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
POST_ACTION = ''
|