2022-11-10 22:22:48 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH ='aarch64'
|
|
|
|
CPU ='cortex-a'
|
2023-05-11 10:25:21 +08:00
|
|
|
CROSS_TOOL = 'gcc'
|
2022-11-10 22:22:48 +08:00
|
|
|
PLATFORM = 'gcc'
|
2023-05-11 10:25:21 +08:00
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin'
|
|
|
|
BUILD = 'debug'
|
2022-11-10 22:22:48 +08:00
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
2023-05-11 10:25:21 +08:00
|
|
|
PREFIX = os.getenv('RTT_CC_PREFIX') or 'aarch64-none-elf-'
|
2022-11-10 22:22:48 +08:00
|
|
|
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'
|
2023-05-11 10:25:21 +08:00
|
|
|
STRIP = PREFIX + 'strip'
|
|
|
|
CFPFLAGS = ' '
|
|
|
|
AFPFLAGS = ' '
|
|
|
|
DEVICE = ' -march=armv8-a -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing'
|
|
|
|
|
|
|
|
CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always'
|
|
|
|
CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always'
|
|
|
|
AFLAGS = ' -c' + AFPFLAGS + ' -x assembler-with-cpp'
|
|
|
|
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread_a64.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
|
2022-11-10 22:22:48 +08:00
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
2023-05-11 10:25:21 +08:00
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
CXXFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
2022-11-10 22:22:48 +08:00
|
|
|
else:
|
2023-05-11 10:25:21 +08:00
|
|
|
CFLAGS += ' -Os'
|
|
|
|
CXXFLAGS += ' -Os'
|
|
|
|
CXXFLAGS += ' -Woverloaded-virtual -fno-exceptions -fno-rtti'
|
2022-11-10 22:22:48 +08:00
|
|
|
|
2023-05-11 10:25:21 +08:00
|
|
|
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtthread_a64.asm\n'
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread_a64.bin\n' + SIZE + ' $TARGET \n'
|