[bsp][ra6m3-hmi-board] support gcc and llvm-arm toolchain. (#7553)

Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
guo 2023-05-25 23:09:34 +08:00 committed by GitHub
parent b27f910cad
commit 3cc5fe5539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 49 additions and 9 deletions

View File

@ -290,6 +290,7 @@ jobs:
RTT_TOOL_CHAIN: "llvm-arm" RTT_TOOL_CHAIN: "llvm-arm"
SUB_RTT_BSP: SUB_RTT_BSP:
- "stm32/stm32l475-atk-pandora" - "stm32/stm32l475-atk-pandora"
- "renesas/ra6m3-hmi-board"
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python

View File

@ -12,7 +12,7 @@ list = os.listdir(cwd)
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang']: elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
CPPPATH = [cwd] CPPPATH = [cwd]
src = Glob('./src/*.c') src = Glob('./src/*.c')

View File

@ -11,7 +11,7 @@ src += Glob('pwm_audio.c')
CPPPATH = [cwd] CPPPATH = [cwd]
LOCAL_CFLAGS = '' LOCAL_CFLAGS = ''
if rtconfig.PLATFORM in ['gcc', 'armclang']: if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
LOCAL_CFLAGS += ' -std=c99' LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']: elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99' LOCAL_CFLAGS += ' --c99'

View File

@ -8,7 +8,7 @@ src = Glob('*.c')
CPPPATH = [cwd] CPPPATH = [cwd]
LOCAL_CFLAGS = '' LOCAL_CFLAGS = ''
if rtconfig.PLATFORM in ['gcc', 'armclang']: if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
LOCAL_CFLAGS += ' -std=c99' LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']: elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99' LOCAL_CFLAGS += ' --c99'

View File

@ -12,7 +12,7 @@ if GetDepend(['BSP_USING_RW007']):
CPPPATH = [cwd] CPPPATH = [cwd]
LOCAL_CFLAGS = '' LOCAL_CFLAGS = ''
if rtconfig.PLATFORM in ['gcc', 'armclang']: if rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
LOCAL_CFLAGS += ' -std=c99' LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']: elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99' LOCAL_CFLAGS += ' --c99'

View File

@ -10,7 +10,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang']: elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src += Glob(cwd + '/fsp/src/bsp/mcu/all/*.c') src += Glob(cwd + '/fsp/src/bsp/mcu/all/*.c')
src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c'] src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c']

View File

@ -64,7 +64,12 @@ void Reset_Handler (void)
SystemInit(); SystemInit();
/* Call user application. */ /* Call user application. */
#ifdef __ARMCC_VERSION
main(); main();
#elif defined(__GNUC__)
extern int entry(void);
entry();
#endif
while (1) while (1)
{ {

View File

@ -10,7 +10,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang']: elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [cwd+'/fsp_cfg', cwd + '/fsp_cfg/bsp'] CPPPATH = [cwd+'/fsp_cfg', cwd + '/fsp_cfg/bsp']

View File

@ -10,7 +10,7 @@ CPPPATH = []
if rtconfig.PLATFORM in ['iccarm']: if rtconfig.PLATFORM in ['iccarm']:
print("\nThe current project does not support IAR build\n") print("\nThe current project does not support IAR build\n")
Return('group') Return('group')
elif rtconfig.PLATFORM in ['gcc', 'armclang']: elif rtconfig.PLATFORM in ['gcc', 'armclang', 'llvm-arm']:
if GetOption('target') != 'mdk5': if GetOption('target') != 'mdk5':
src = Glob('*.c') src = Glob('*.c')
CPPPATH = [cwd, ] CPPPATH = [cwd, ]

View File

@ -4,7 +4,7 @@ import sys
# toolchains options # toolchains options
ARCH='arm' ARCH='arm'
CPU='cortex-m4' CPU='cortex-m4'
CROSS_TOOL='keil' CROSS_TOOL='gcc'
if os.getenv('RTT_CC'): if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC') CROSS_TOOL = os.getenv('RTT_CC')
@ -22,6 +22,9 @@ elif CROSS_TOOL == 'keil':
elif CROSS_TOOL == 'iar': elif CROSS_TOOL == 'iar':
PLATFORM = 'iccarm' PLATFORM = 'iccarm'
EXEC_PATH = r'C:/Program Files/IAR Systems/Embedded Workbench 8.0' EXEC_PATH = r'C:/Program Files/IAR Systems/Embedded Workbench 8.0'
elif CROSS_TOOL == 'llvm-arm':
PLATFORM = 'llvm-arm'
EXEC_PATH = r'D:\Progrem\LLVMEmbeddedToolchainForArm-16.0.0-Windows-x86_64\bin'
if os.getenv('RTT_EXEC_PATH'): if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH') EXEC_PATH = os.getenv('RTT_EXEC_PATH')
@ -93,6 +96,37 @@ elif PLATFORM == 'armclang':
CFLAGS += ' -Os' CFLAGS += ' -Os'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET \n' POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET \n'
elif PLATFORM == 'llvm-arm':
# toolchains
PREFIX = 'llvm-'
CC = 'clang'
AS = 'clang'
AR = PREFIX + 'ar'
CXX = 'clang++'
LINK = 'clang'
TARGET_EXT = 'elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' --config armv7em_hard_fpv4_sp_d16.cfg'
DEVICE += ' -ffunction-sections -fdata-sections'
CFLAGS = DEVICE
CFLAGS += ' -mfloat-abi=hard -march=armv7em -mfpu=fpv4-sp-d16'
AFLAGS = ' -c' + DEVICE + ' -Wa,-mimplicit-it=thumb ' ## -x assembler-with-cpp
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-u,Reset_Handler -T script/fsp.ld -L script/'
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -gdwarf-2 -g'
AFLAGS += ' -gdwarf-2'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O ihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'
def dist_handle(BSP_ROOT, dist_dir): def dist_handle(BSP_ROOT, dist_dir):
import sys import sys

View File

@ -86,7 +86,7 @@ MEMORY
} }
/* Library configurations */ /* Library configurations */
GROUP(libgcc.a libc.a libm.a libnosys.a) GROUP(libc.a libm.a)
/* Linker script to place sections and symbol values. Should be used together /* Linker script to place sections and symbol values. Should be used together
* with other linker script that defines memory regions FLASH and RAM. * with other linker script that defines memory regions FLASH and RAM.