rt-thread/bsp/sparkfun-redv/rtconfig.py

71 lines
2.0 KiB
Python
Raw Normal View History

2020-10-31 15:40:38 +08:00
import os
ARCH = 'risc-v'
CPU = 'e310'
VENDOR = 'sifive'
# toolchains options
CROSS_TOOL = 'gcc'
#------- toolchains path -------------------------------------------------------
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
2021-12-23 19:35:24 +08:00
EXEC_PATH = r'/opt/FreedomStudio/SiFive/riscv64-unknown-elf-gcc-8.3.0-2019.08.0/bin/'
2020-10-31 15:40:38 +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'
#BUILD = 'release'
CORE = 'risc-v'
MAP_FILE = 'rtthread.map'
LINK_FILE = './freedom-e-sdk/bsp/env/freedom-e300-hifive1/flash.lds'
TARGET_NAME = 'rtthread.bin'
TARGET_NAME_HEX = 'rtthread.hex'
#------- GCC settings ----------------------------------------------------------
if PLATFORM == 'gcc':
# toolchains
PREFIX = 'riscv64-unknown-elf-'
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=rv32imac -mabi=ilp32 -DUSE_PLIC -DUSE_M_TIME -DNO_INIT -mcmodel=medany -msmall-data-limit=8 -L. -nostartfiles -lc '
CFLAGS = DEVICE
CFLAGS += ' -save-temps=obj'
AFLAGS = '-c'+ DEVICE + ' -x assembler-with-cpp'
AFLAGS += ' -Iplatform -Ifreedom-e-sdk/bsp/include -Ifreedom-e-sdk/bsp/env'
LFLAGS = DEVICE
LFLAGS += ' -Wl,--gc-sections,-cref,-Map=' + MAP_FILE
LFLAGS += ' -T ' + LINK_FILE
LFLAGS += ' -Wl,-wrap=memset'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -g3'
AFLAGS += ' -g3'
else:
CFLAGS += ' -O2'
2021-12-23 19:35:24 +08:00
CXXFLAGS = CFLAGS
2020-10-31 15:40:38 +08:00
POST_ACTION = OBJCPY + ' -O binary $TARGET ' + TARGET_NAME + '\n'
POST_ACTION += OBJCPY + ' -O ihex $TARGET ' + TARGET_NAME_HEX + '\n'
#POST_ACTION += OBJCPY + ' -I binary -O ihex ' + TARGET_NAME + ' ' + TARGET_NAME_HEX + '\n'
POST_ACTION += SIZE + ' $TARGET\n'