2016-04-24 19:34:41 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH ='mips'
|
2017-11-11 13:51:56 +08:00
|
|
|
CPU ='x1000'
|
2016-04-24 19:34:41 +08:00
|
|
|
CROSS_TOOL ='gcc'
|
|
|
|
|
|
|
|
if os.getenv('RTT_CC'):
|
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
|
|
PLATFORM = 'gcc'
|
2017-11-11 13:51:56 +08:00
|
|
|
EXEC_PATH = r'E:\work\env\tools\gnu_gcc\mips_gcc\mips-2016.05\bin'
|
2016-04-24 19:34:41 +08:00
|
|
|
else:
|
|
|
|
print 'Please make sure your toolchains is GNU GCC!'
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
|
2017-11-11 13:51:56 +08:00
|
|
|
|
|
|
|
# BUILD = 'debug'
|
|
|
|
# BUILD = 'release'
|
|
|
|
BUILD = 'release_O3'
|
|
|
|
|
|
|
|
# FLOAT = 'soft'
|
|
|
|
FLOAT = 'hard'
|
2016-04-24 19:34:41 +08:00
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
|
|
|
PREFIX = 'mips-sde-elf-'
|
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
CXX = PREFIX + 'g++'
|
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
2017-11-11 13:51:56 +08:00
|
|
|
LINK = PREFIX + 'g++'
|
2016-04-24 19:34:41 +08:00
|
|
|
TARGET_EXT = 'elf'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
2017-11-11 13:51:56 +08:00
|
|
|
STRIP = PREFIX + 'strip'
|
2016-04-24 19:34:41 +08:00
|
|
|
|
2017-11-11 13:51:56 +08:00
|
|
|
if FLOAT == 'soft':
|
|
|
|
DEVICE = ' -mips32r2 -msoft-float -mfp32'
|
|
|
|
else:
|
|
|
|
DEVICE = ' -mips32r2 -mhard-float -mfp32'
|
|
|
|
|
|
|
|
CFLAGS = DEVICE + ' -EL -G0 -mno-abicalls -fno-pic -fno-builtin -fno-exceptions -ffunction-sections -fno-omit-frame-pointer'
|
2016-04-24 19:34:41 +08:00
|
|
|
AFLAGS = ' -c' + DEVICE + ' -EL -x assembler-with-cpp'
|
|
|
|
LFLAGS = DEVICE + ' -EL -Wl,--gc-sections,-Map=rtthread_x1000.map,-cref,-u,Reset_Handler -T x1000_ram.lds'
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
2017-11-11 13:51:56 +08:00
|
|
|
elif BUILD == 'release_O3':
|
|
|
|
CFLAGS += ' -O3'
|
2016-04-24 19:34:41 +08:00
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
CXXFLAGS = CFLAGS
|
|
|
|
|
2017-11-11 13:51:56 +08:00
|
|
|
M_CFLAGS = DEVICE + ' -EL -G0 -O2 -mno-abicalls -fno-common -fno-exceptions -fno-omit-frame-pointer -mlong-calls -fno-pic '
|
|
|
|
M_CXXFLAGS = M_CFLAGS
|
|
|
|
M_LFLAGS = DEVICE + ' -EL -r -Wl,--gc-sections,-z,max-page-size=0x4' +\
|
|
|
|
' -nostartfiles -static-libgcc'
|
|
|
|
M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n'
|
|
|
|
|
2016-04-24 19:34:41 +08:00
|
|
|
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|