2012-04-09 11:32:35 +08:00
|
|
|
import os
|
|
|
|
|
2011-11-29 16:06:46 +08:00
|
|
|
# toolchains options
|
|
|
|
ARCH='arm'
|
|
|
|
CPU='cortex-m4'
|
|
|
|
CROSS_TOOL='keil'
|
|
|
|
|
2012-04-09 11:32:35 +08:00
|
|
|
if os.getenv('RTT_CC'):
|
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
|
2011-12-23 11:20:26 +08:00
|
|
|
#device options
|
|
|
|
PART_TYPE = 'PART_LM4F232H5QD'
|
|
|
|
|
2011-11-29 16:06:46 +08:00
|
|
|
# cross_tool provides the cross compiler
|
|
|
|
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
|
|
PLATFORM = 'gcc'
|
|
|
|
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
|
|
|
|
elif CROSS_TOOL == 'keil':
|
|
|
|
PLATFORM = 'armcc'
|
|
|
|
EXEC_PATH = 'E:/Keil'
|
2012-04-09 11:32:35 +08:00
|
|
|
elif CROSS_TOOL == 'iar':
|
|
|
|
print '================ERROR============================'
|
|
|
|
print 'Not support iar yet!'
|
|
|
|
print '================================================='
|
|
|
|
exit(0)
|
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
2011-12-23 15:22:36 +08:00
|
|
|
|
2011-11-29 16:06:46 +08:00
|
|
|
BUILD = 'debug'
|
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
|
|
|
PREFIX = 'arm-none-eabi-'
|
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
|
|
|
LINK = PREFIX + 'gcc'
|
|
|
|
TARGET_EXT = 'axf'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
|
2012-02-18 11:44:42 +08:00
|
|
|
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections'
|
|
|
|
CFLAGS = DEVICE
|
2011-11-29 16:06:46 +08:00
|
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
|
2012-02-18 11:44:42 +08:00
|
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-stm32.map,-cref,-u,Reset_Handler -T lm4f_rom.ld'
|
2011-11-29 16:06:46 +08:00
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|
|
|
|
|
|
|
|
elif PLATFORM == 'armcc':
|
|
|
|
# toolchains
|
|
|
|
CC = 'armcc'
|
|
|
|
AS = 'armasm'
|
|
|
|
AR = 'armar'
|
|
|
|
LINK = 'armlink'
|
|
|
|
TARGET_EXT = 'axf'
|
|
|
|
|
2011-12-22 16:16:27 +08:00
|
|
|
DEVICE = ' --device DLM'
|
2011-11-29 16:06:46 +08:00
|
|
|
CFLAGS = DEVICE + ' --apcs=interwork'
|
|
|
|
AFLAGS = DEVICE
|
2011-12-22 16:16:27 +08:00
|
|
|
LFLAGS = DEVICE + ' --ro-base 0x00000000 --entry 0x00000000 --rw-base 0x20000000 --entry Reset_Handler --first __Vectors --info sizes --info totals --info unused --info veneers --list rtthread-lm4f.map '
|
2011-11-29 16:06:46 +08:00
|
|
|
|
|
|
|
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
|
|
|
|
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
|
|
|
|
|
|
|
|
EXEC_PATH += '/arm/bin40/'
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -g -O0'
|
|
|
|
AFLAGS += ' -g'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|
|
|
|
|
|
|
|
|