2013-01-08 22:40:58 +08:00
|
|
|
import os
|
2018-09-11 08:32:32 +08:00
|
|
|
ARCH = 'arm'
|
|
|
|
CPU = 'arm926'
|
2015-04-15 16:08:43 +08:00
|
|
|
# toolchains options
|
2018-09-11 08:32:32 +08:00
|
|
|
CROSS_TOOL = 'gcc'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
2015-04-15 16:08:43 +08:00
|
|
|
#------- toolchains path -------------------------------------------------------
|
2013-01-08 22:40:58 +08:00
|
|
|
if os.getenv('RTT_CC'):
|
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
|
|
PLATFORM = 'gcc'
|
2017-10-19 23:46:17 +08:00
|
|
|
EXEC_PATH = r'D:\arm-2013.11\bin'
|
2018-12-26 12:50:52 +08:00
|
|
|
elif CROSS_TOOL == 'keil':
|
|
|
|
PLATFORM = 'armcc'
|
|
|
|
EXEC_PATH = 'C:/Keil_v5'
|
|
|
|
elif CROSS_TOOL == 'iar':
|
2022-05-31 06:30:42 +08:00
|
|
|
PLATFORM = 'iccarm'
|
2018-12-26 12:50:52 +08:00
|
|
|
EXEC_PATH = 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.2'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
|
|
|
|
#BUILD = 'debug'
|
|
|
|
BUILD = 'release'
|
|
|
|
|
2015-04-15 16:08:43 +08:00
|
|
|
CORE = 'arm926ej-s'
|
|
|
|
MAP_FILE = 'rtthread_at91sam9260.map'
|
|
|
|
LINK_FILE = 'link_scripts/at91sam9260_ram'
|
|
|
|
TARGET_NAME = 'rtthread.bin'
|
|
|
|
|
|
|
|
#------- GCC settings ----------------------------------------------------------
|
2013-01-08 22:40:58 +08:00
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
|
|
|
PREFIX = 'arm-none-eabi-'
|
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
|
|
|
LINK = PREFIX + 'gcc'
|
2018-03-07 15:28:51 +08:00
|
|
|
TARGET_EXT = 'elf'
|
2013-01-08 22:40:58 +08:00
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
|
|
|
|
DEVICE = ' -mcpu=arm926ej-s'
|
|
|
|
CFLAGS = DEVICE
|
2015-04-15 16:08:43 +08:00
|
|
|
AFLAGS = '-c'+ DEVICE + ' -x assembler-with-cpp'
|
|
|
|
AFLAGS += ' -Iplatform'
|
|
|
|
LFLAGS = DEVICE
|
|
|
|
LFLAGS += ' -Wl,--gc-sections,-cref,-Map=' + MAP_FILE
|
|
|
|
LFLAGS += ' -T ' + LINK_FILE + '.ld'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2'
|
|
|
|
|
2015-04-15 16:08:43 +08:00
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET ' + TARGET_NAME + '\n'
|
|
|
|
POST_ACTION += SIZE + ' $TARGET\n'
|