2013-01-08 22:40:58 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH = 'avr32'
|
|
|
|
CPU = 'uc3'
|
|
|
|
PART = 'uc3b0256'
|
|
|
|
BOARD = 'USERBOARD'
|
2023-10-16 16:00:11 +08:00
|
|
|
ATOMICS = ' -D__STDC_NO_ATOMICS__'
|
2013-01-08 22:40:58 +08:00
|
|
|
|
|
|
|
CROSS_TOOL = 'gcc'
|
|
|
|
|
|
|
|
if os.getenv('RTT_CC'):
|
|
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
|
|
PLATFORM = 'gcc'
|
2023-10-16 16:00:11 +08:00
|
|
|
EXEC_PATH = 'C:/Program Files (x86)/Atmel/AVR Tools/AVR Toolchain/bin'
|
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)
|
|
|
|
elif CROSS_TOOL == 'iar':
|
2018-02-06 20:07:28 +08:00
|
|
|
print('================ERROR============================')
|
|
|
|
print('Not support iar yet!')
|
|
|
|
print('=================================================')
|
2013-01-08 22:40:58 +08:00
|
|
|
exit(0)
|
|
|
|
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
|
|
|
|
#BUILD = 'debug'
|
|
|
|
BUILD = 'release'
|
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
|
|
|
PREFIX = 'avr32-'
|
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
|
|
|
LINK = PREFIX + 'gcc'
|
|
|
|
TARGET_EXT = 'elf'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
|
|
|
|
DEVICE = ' -mpart=' + PART
|
2023-10-16 16:00:11 +08:00
|
|
|
CFLAGS = DEVICE + ' -DBOARD=' + BOARD + ATOMICS + ' -fmessage-length=0 -ffunction-sections -masm-addr-pseudos'
|
2013-01-08 22:40:58 +08:00
|
|
|
AFLAGS = ' -c -x assembler-with-cpp' + DEVICE
|
|
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections --rodata-writable -Wl,--direct-data -LSOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS -T avr32elf_uc3b0256.lds'
|
|
|
|
|
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
|
|
|
CFLAGS += ' -O0 -g3 -Wall'
|
|
|
|
AFLAGS += ' -g3'
|
|
|
|
else:
|
|
|
|
CFLAGS += ' -O2 -Wall'
|
|
|
|
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|