rt-thread/bsp/juicevm/rtconfig.py

60 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 13:46:22 +08:00
import os
# toolchains options
ARCH ='risc-v'
CPU ='juicevm'
CROSS_TOOL ='gcc'
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = r'../..'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
2021-04-26 14:48:20 +08:00
EXEC_PATH = r'/opt/xpack-riscv-none-embed-gcc-8.3.0-2.1/bin'
2021-04-26 13:46:22 +08:00
else:
print('Please make sure your toolchains is GNU GCC!')
exit(0)
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = 'debug'
if PLATFORM == 'gcc':
# toolchains
2021-04-26 14:48:20 +08:00
PREFIX = 'riscv-none-embed-'
2021-04-26 13:46:22 +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'
DEVICE = ' -march=rv64ima -mabi=lp64 -mcmodel=medany'
CFLAGS = DEVICE + ' -fno-builtin -fno-exceptions -ffunction-sections -static'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
LFLAGS = DEVICE + ' -nostartfiles -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T link.lds'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O2 -Os -g'
AFLAGS += ' -g'
else:
CFLAGS += ' -O2 -Os'
CXXFLAGS = CFLAGS
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
POST_ACTION += DUMP_ACTION
# POST_ACTION = SIZE + ' $TARGET \n'