124 lines
3.4 KiB
Python
124 lines
3.4 KiB
Python
import os
|
|
import sys
|
|
|
|
# toolchains options
|
|
ARCH='arm'
|
|
CPU='cortex-r52'
|
|
CROSS_TOOL='gcc'
|
|
|
|
if os.getenv('RTT_CC'):
|
|
CROSS_TOOL = os.getenv('RTT_CC')
|
|
if os.getenv('RTT_ROOT'):
|
|
RTT_ROOT = os.getenv('RTT_ROOT')
|
|
|
|
# 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'C:\Users\XXYYZZ'
|
|
elif CROSS_TOOL == 'keil':
|
|
PLATFORM = 'armclang'
|
|
EXEC_PATH = r'C:/Keil_v5'
|
|
elif CROSS_TOOL == 'iar':
|
|
PLATFORM = 'iccarm'
|
|
EXEC_PATH = r'D:/IAR Systems/Embedded Workbench 9.2'
|
|
|
|
if os.getenv('RTT_EXEC_PATH'):
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
|
|
|
|
BUILD = 'debug'
|
|
# BUILD = 'release'
|
|
|
|
if PLATFORM == 'gcc':
|
|
# toolchains
|
|
PREFIX = 'arm-none-eabi-'
|
|
CC = PREFIX + 'gcc'
|
|
AS = PREFIX + 'gcc'
|
|
AR = PREFIX + 'ar'
|
|
CXX = PREFIX + 'g++'
|
|
LINK = PREFIX + 'gcc'
|
|
TARGET_EXT = 'elf'
|
|
SIZE = PREFIX + 'size'
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
OBJCPY = PREFIX + 'objcopy'
|
|
NM = PREFIX + 'nm'
|
|
|
|
DEVICE = ' -mcpu=cortex-r52 -marm -mfloat-abi=hard -mfpu=neon-fp-armv8 -munaligned-access -fdiagnostics-parseable-fixits -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -funwind-tables'
|
|
CFLAGS = DEVICE + ' -Dgcc'
|
|
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=arm '
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T script/fsp_xspi0_boot.ld -L script/'
|
|
|
|
CPATH = ''
|
|
LPATH = ''
|
|
|
|
if BUILD == 'debug':
|
|
CFLAGS += ' -O0 -gdwarf-2 -g -Wall'
|
|
AFLAGS += ' -gdwarf-2'
|
|
else:
|
|
CFLAGS += ' -Os'
|
|
CXXFLAGS = CFLAGS
|
|
|
|
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'
|
|
# 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'
|
|
|
|
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-R52'
|
|
CFLAGS += ' -e'
|
|
CFLAGS += ' --arm'
|
|
CFLAGS += ' --float-abi=hard'
|
|
CFLAGS += ' --fpu=neon-fp-armv8'
|
|
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-R52'
|
|
AFLAGS += ' --arm'
|
|
AFLAGS += ' --float-abi hard'
|
|
AFLAGS += ' --fpu neon-fp-armv8'
|
|
# AFLAGS += ' --unaligned-access'
|
|
AFLAGS += ' -S'
|
|
|
|
if BUILD == 'debug':
|
|
CFLAGS += ' --debug'
|
|
CFLAGS += ' -On'
|
|
else:
|
|
CFLAGS += ' -Oh'
|
|
|
|
LFLAGS = ' --config "script/fsp_xspi0_boot.icf"'
|
|
LFLAGS += ' --entry Reset_Handler'
|
|
|
|
CXXFLAGS = CFLAGS
|
|
|
|
EXEC_PATH = EXEC_PATH + '/arm/bin/'
|
|
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
|
|
|
|
def dist_handle(BSP_ROOT, dist_dir):
|
|
import sys
|
|
cwd_path = os.getcwd()
|
|
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
|
|
from sdk_dist import dist_do_building
|
|
dist_do_building(BSP_ROOT, dist_dir)
|