You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.8 KiB
105 lines
2.8 KiB
import os
|
|
|
|
# toolchains options
|
|
ARCH='arm'
|
|
CPU='am335x'
|
|
CROSS_TOOL='gcc'
|
|
|
|
if os.getenv('RTT_CC'):
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
|
|
if CROSS_TOOL == 'gcc':
|
|
PLATFORM = 'gcc'
|
|
EXEC_PATH = r'C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin'
|
|
elif CROSS_TOOL == 'iar':
|
|
PLATFORM = 'iccarm'
|
|
EXEC_PATH = r'C:\Program Files\IAR Systems\Embedded Workbench 9.1'
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
BUILD = 'debug'
|
|
|
|
if PLATFORM == 'gcc':
|
|
# toolchains
|
|
PREFIX = 'arm-none-eabi-'
|
|
CC = PREFIX + 'gcc'
|
|
CXX = PREFIX + 'g++'
|
|
AS = PREFIX + 'gcc'
|
|
AR = PREFIX + 'ar'
|
|
LINK = PREFIX + 'gcc'
|
|
TARGET_EXT = 'elf'
|
|
SIZE = PREFIX + 'size'
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
|
|
DEVICE = ' -Wall -march=armv7-a -mtune=cortex-a8'+\
|
|
' -ftree-vectorize -ffast-math -mfpu=vfpv3-d16 -mfloat-abi=softfp'
|
|
#DEVICE = ' '
|
|
CFLAGS = DEVICE
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -D__ASSEMBLY__'
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-beaglebone.map,-cref,-u,Reset_Handler -T beaglebone_ram.lds'
|
|
|
|
CPATH = ''
|
|
LPATH = ''
|
|
|
|
if BUILD == 'debug':
|
|
CFLAGS += ' -O0 -gdwarf-2 -Wall'
|
|
AFLAGS += ' -gdwarf-2'
|
|
else:
|
|
CFLAGS += ' -O2 -Wall'
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' +\
|
|
SIZE + ' $TARGET \n'
|
|
|
|
elif PLATFORM == 'iccarm':
|
|
# toolchains
|
|
CC = 'iccarm'
|
|
CXX = 'iccarm'
|
|
AS = 'iasmarm'
|
|
AR = 'iarchive'
|
|
LINK = 'ilinkarm'
|
|
TARGET_EXT = 'out'
|
|
|
|
DEVICE = '-Dewarm'
|
|
|
|
# ATTENTION from author vipox@qq.com: below *FLAGS are unverified and maybe wrong!
|
|
# I just copied it from STM32 and changed it according to my own understanding.
|
|
# However, even if it is wrong, it does not affect our generation of IAR project.
|
|
CFLAGS = DEVICE
|
|
CFLAGS += ' --diag_suppress Pa050'
|
|
CFLAGS += ' --no_cse'
|
|
CFLAGS += ' --no_unroll'
|
|
CFLAGS += ' --no_inline'
|
|
CFLAGS += ' --no_code_motion'
|
|
CFLAGS += ' --no_tbaa'
|
|
CFLAGS += ' --no_clustering'
|
|
CFLAGS += ' --no_scheduling'
|
|
CFLAGS += ' --endian=little'
|
|
CFLAGS += ' --cpu=Cortex-A8'
|
|
CFLAGS += ' -e'
|
|
CFLAGS += ' --fpu=VFPv3'
|
|
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
|
|
CFLAGS += ' --silent'
|
|
|
|
AFLAGS = DEVICE
|
|
AFLAGS += ' -s+'
|
|
AFLAGS += ' -w+'
|
|
AFLAGS += ' -r'
|
|
AFLAGS += ' --cpu Cortex-A8'
|
|
AFLAGS += ' --fpu VFPv3'
|
|
AFLAGS += ' -S'
|
|
|
|
if BUILD == 'debug':
|
|
CFLAGS += ' --debug'
|
|
CFLAGS += ' -On'
|
|
else:
|
|
CFLAGS += ' -Oh'
|
|
|
|
LFLAGS = ' --config "beaglebone_ram.icf"'
|
|
LFLAGS += ' --entry __iar_program_start'
|
|
|
|
CXXFLAGS = CFLAGS
|
|
|
|
EXEC_PATH = EXEC_PATH + '/arm/bin/'
|
|
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
|
|
|