2021-08-06 18:35:58 +08:00
|
|
|
import os
|
|
|
|
|
|
|
|
# toolchains options
|
|
|
|
ARCH ='aarch64'
|
2021-09-22 17:57:45 +08:00
|
|
|
CPU ='cortex-a'
|
2022-12-20 17:49:37 +08:00
|
|
|
CROSS_TOOL = 'gcc'
|
|
|
|
PLATFORM = 'gcc'
|
|
|
|
EXEC_PATH = os.getenv('RTT_EXEC_PATH') or '/usr/bin'
|
|
|
|
BUILD = 'debug'
|
2021-08-06 18:35:58 +08:00
|
|
|
|
|
|
|
if PLATFORM == 'gcc':
|
|
|
|
# toolchains
|
2022-12-20 17:49:37 +08:00
|
|
|
PREFIX = os.getenv('RTT_CC_PREFIX') or 'aarch64-none-elf-'
|
2021-08-06 18:35:58 +08:00
|
|
|
CC = PREFIX + 'gcc'
|
|
|
|
CXX = PREFIX + 'g++'
|
2023-07-25 21:31:44 +08:00
|
|
|
CPP = PREFIX + 'cpp'
|
2021-08-06 18:35:58 +08:00
|
|
|
AS = PREFIX + 'gcc'
|
|
|
|
AR = PREFIX + 'ar'
|
|
|
|
LINK = PREFIX + 'gcc'
|
|
|
|
TARGET_EXT = 'elf'
|
|
|
|
SIZE = PREFIX + 'size'
|
|
|
|
OBJDUMP = PREFIX + 'objdump'
|
|
|
|
OBJCPY = PREFIX + 'objcopy'
|
2022-12-20 17:49:37 +08:00
|
|
|
STRIP = PREFIX + 'strip'
|
|
|
|
CFPFLAGS = ' '
|
|
|
|
AFPFLAGS = ' '
|
|
|
|
DEVICE = ' -march=armv8-a -mtune=cortex-a53 -ftree-vectorize -ffast-math -funwind-tables -fno-strict-aliasing'
|
|
|
|
|
2023-07-25 21:31:44 +08:00
|
|
|
CPPFLAGS= ' -E -P -x assembler-with-cpp'
|
2023-02-11 17:14:55 +08:00
|
|
|
CXXFLAGS= DEVICE + CFPFLAGS + ' -Wall -fdiagnostics-color=always'
|
|
|
|
CFLAGS = DEVICE + CFPFLAGS + ' -Wall -Wno-cpp -std=gnu99 -fdiagnostics-color=always'
|
2022-12-20 17:49:37 +08:00
|
|
|
AFLAGS = ' -c' + AFPFLAGS + ' -x assembler-with-cpp'
|
2023-07-25 21:31:44 +08:00
|
|
|
LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,system_vectors -T link.lds' + ' -lsupc++ -lgcc -static'
|
2021-08-06 18:35:58 +08:00
|
|
|
CPATH = ''
|
|
|
|
LPATH = ''
|
|
|
|
|
|
|
|
if BUILD == 'debug':
|
2022-12-20 17:49:37 +08:00
|
|
|
CFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
CXXFLAGS += ' -O0 -gdwarf-2'
|
|
|
|
AFLAGS += ' -gdwarf-2'
|
2021-08-06 18:35:58 +08:00
|
|
|
else:
|
2022-12-20 17:49:37 +08:00
|
|
|
CFLAGS += ' -Os'
|
|
|
|
CXXFLAGS += ' -Os'
|
|
|
|
CXXFLAGS += ' -Woverloaded-virtual -fno-exceptions -fno-rtti'
|
2021-08-06 18:35:58 +08:00
|
|
|
|
|
|
|
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
|
|
|
|
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
|