Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bsp/stm32/stm32f407-atk-explorer/board/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ path += [cwd + '/ports']

startup_path_prefix = SDK_LIB

if rtconfig.CROSS_TOOL == 'gcc':
if rtconfig.CROSS_TOOL == 'gcc' or rtconfig.CROSS_TOOL == 'clang':
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang可否有更好的名字,clang和armclang太相近了,很容易被人误解

src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
src += [startup_path_prefix + '/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/arm/startup_stm32f407xx.s']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ SECTIONS
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;

. = ALIGN(4);
KEEP(*(FalPartTable))

. = ALIGN(4);

PROVIDE(__ctors_start__ = .);
Expand Down
35 changes: 35 additions & 0 deletions bsp/stm32/stm32f407-atk-explorer/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
elif CROSS_TOOL == 'iar':
PLATFORM = 'iar'
EXEC_PATH = r'C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.0'
elif CROSS_TOOL == 'clang':
PLATFORM = 'clang'
EXEC_PATH = r'/opt/LLVMEmbeddedToolchainForArm-13.0.0/bin'

if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
Expand Down Expand Up @@ -176,6 +179,38 @@
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'

elif PLATFORM == 'clang':
# 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_nosys -ffunction-sections -fdata-sections'
CFLAGS = DEVICE
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rt-thread.map,-u,Reset_Handler -T board/linker_scripts/link.lds'

CPATH = ''
LPATH = ''

if BUILD == 'debug':
CFLAGS += ' -O0 -gdwarf-2 -g'
AFLAGS += ' -gdwarf-2'
else:
CFLAGS += ' -O2'

CXXFLAGS = CFLAGS

POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'


def dist_handle(BSP_ROOT, dist_dir):
import sys
cwd_path = os.getcwd()
Expand Down
2 changes: 1 addition & 1 deletion components/libc/compilers/gcc/partial/mips/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cwd = GetCurrentDir()
CPPPATH = [cwd]
group = []

if rtconfig.PLATFORM == 'gcc' and ('mips' in rtconfig.PREFIX): # identify mips gcc tool chain
if (rtconfig.PLATFORM == 'gcc' and ('mips' in rtconfig.PREFIX)) or rtconfig.PLATFORM == 'clang': # identify mips gcc tool chain
try:
Comment on lines 11 to 12
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请删除对此文件的修改

# There is no 'sys/select.h' in tthe mips gcc toolchain; it will be copied from 'nogcc/sys/select.h'
copy("../../../common/nogcc/sys/select.h", "./sys/select.h")
Expand Down
12 changes: 9 additions & 3 deletions components/libc/compilers/gcc/partial/mips/sys/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include <sys/types.h>
#include <sys/time.h>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请删除对此文件的修改

#ifdef _WIN32
#include <winsock.h>
#endif

#ifndef FD_SETSIZE
#define FD_SETSIZE 32
#endif
Expand All @@ -26,16 +30,17 @@
#define FD_SETSIZE DFS_FD_MAX
#endif /* SAL_USING_POSIX */

#define NBBY 8 /* number of bits in a byte */

typedef long fd_mask;

#ifndef _WIN32
#ifndef _SYS_TYPES_FD_SET /* MIPS */

#define NBBY 8 /* number of bits in a byte */
#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
#ifndef howmany
#define howmany(x,y) (((x)+((y)-1))/(y))
#endif

#ifndef _SYS_TYPES_FD_SET /* MIPS */
typedef struct _types_fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} _types_fd_set;
Expand All @@ -48,5 +53,6 @@ typedef struct _types_fd_set {
#endif /* _SYS_TYPES_FD_SET */

int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
#endif /* _WIN32 */

#endif /* __SYS_SELECT_H__ */