2014-07-18 17:17:56 +08:00
|
|
|
# BSP Note: For TI EK-TM4C1294XL Tiva C Series Connected LancuhPad (REV D)
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH='arm'
|
|
|
|
CPU='cortex-m4'
|
|
|
|
CROSS_TOOL='keil'
|
|
|
|
|
|
|
|
if os.getenv('RTT_CC'):
|
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
|
|
|
|
#device options
|
|
|
|
PART_TYPE = 'PART_TM4C129XNCZAD'
|
|
|
|
# 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 = r'D:\ArdaArmTools\Sourcery_Lite\bin'
|
|
|
|
elif CROSS_TOOL == 'keil':
|
|
|
|
PLATFORM = 'armcc'
|
2017-04-25 18:02:51 +08:00
|
|
|
EXEC_PATH = r'D:\Keil_v5'
|
2014-07-18 17:17:56 +08:00
|
|
|
elif CROSS_TOOL == 'iar':
|
2018-02-06 20:07:28 +08:00
|
|
|
print('================ERROR============================')
|
|
|
|
print('Not support iar yet!')
|
|
|
|
print('=================================================')
|
2014-07-18 17:17:56 +08:00
|
|
|
exit(0)
|
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
|
2014-07-31 14:11:26 +08:00
|
|
|
#BUILD = 'debug'
|
|
|
|
BUILD = 'release'
|
2014-07-18 17:17:56 +08:00
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# tool-chains
|
|
|
|
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'
|
|
|
|
|
|
|
|
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections'
|
2014-07-25 23:25:32 +08:00
|
|
|
CFLAGS = DEVICE + ' -std=c99 -Dgcc'
|
2014-07-18 17:17:56 +08:00
|
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
|
|
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-tm4c129x.map,-cref,-u,Reset_Handler -T tm4c_rom.ld'
|
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2 -g'
|
|
|
|
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'
|
|
|
|
|
|
|
|
DEVICE = ' --cpu Cortex-M4.fp '
|
|
|
|
CFLAGS = '-c ' + DEVICE + ' --apcs=interwork --c99'
|
|
|
|
AFLAGS = DEVICE + ' --apcs=interwork '
|
|
|
|
LFLAGS = DEVICE + ' --scatter tm4c_rom.sct --info sizes --info totals --info unused --info veneers --list rtthread-tm4c129x.map --strict'
|
|
|
|
|
|
|
|
CFLAGS += ' -I' + EXEC_PATH + '/ARM/ARMCC/INC'
|
|
|
|
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/ARMCC/LIB'
|
|
|
|
|
|
|
|
EXEC_PATH += '/arm/armcc/bin/'
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -g -O0'
|
|
|
|
AFLAGS += ' -g'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
|
|
|
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
|