blob: 848aa2e94d832a272560530159b9fb1c5b344a04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
import os
ARCH = 'risc-v'
CPU = 'e901plus'
# toolchains options
CROSS_TOOL = 'gcc'
#------- toolchains path -------------------------------------------------------
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'D:\C-Sky\CDKRepo\Toolchain\XTGccElfNewlib\V3.2.0\R\bin'
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 = '../../libraries/xuantie_libraries/chip_riscv_dummy/gcc_flash_smartl_lite.ld'
if os.path.exists('./libraries'):
LINK_FILE = './libraries/xuantie_libraries/chip_riscv_dummy/gcc_flash_smartl_lite.ld'
TARGET_NAME = 'rtthread.bin'
#------- 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'
MCPU = ' -mcpu=e901plusbm-cp ' # Modify here based on CPU architecture.
MCPU_DEFINE = ' -DCONFIG_CPU_XUANTIE_E901PLUS_BM_CP=1 ' # Modify here based on CPU architecture.
DEVICE = MCPU + MCPU_DEFINE + ' -Wno-main -mcmodel=medany'
GLOBAL_DEFINES = (
'-DCONFIG_KERNEL_RTTHREAD=1 '
'-D__RT_KERNEL_SOURCE__=1 '
'-DCONFIG_CSI_V2=1 '
'-DCONFIG_CSI=csi2 '
'-DCONFIG_INIT_TASK_STACK_SIZE=4096 '
'-DCONFIG_APP_TASK_STACK_SIZE=8192 '
'-DCONFIG_ARCH_MAINSTACK=4096 '
'-DCONFIG_ARCH_INTERRUPTSTACK=4096 '
'-DCONFIG_INTC_CLIC=1 '
'-DCONFIG_SUPPORT_IRQ_NESTED=0 '
'-DCONFIG_XIP=1 '
'-DCONFIG_LIBC_MINI_PRINTF_SUPPORT=1 '
'-DCONFIG_BOARD_SMARTL_EVB=1 '
'-DCONFIG_DEBUG=1 '
'-DCLI_CONFIG_STACK_SIZE=4096 '
)
GLOBAL_DEFINES += ' -DCONFIG_SYSTICK_HZ=RT_TICK_PER_SECOND '
CFLAGS = DEVICE + ' -g -Wall -Wno-unused-function -Wformat -Wformat-security -Warray-bounds -Wuninitialized \
-Wreturn-type -Wcomment -Wswitch -Wparentheses -specs=minilibc.specs -MP -MMD -Os -Wpointer-arith \
-Wno-undef -ffunction-sections -fdata-sections -fno-inline-functions -fno-builtin \
-fno-strict-aliasing -Wno-char-subscripts -Wno-unused-but-set-variable ' + GLOBAL_DEFINES
AFLAGS = DEVICE + ' -g -Wall -Wno-unused-function -Wformat -Wformat-security -Warray-bounds -Wuninitialized \
-Wreturn-type -Wcomment -Wswitch -Wparentheses -specs=minilibc.specs -MP -MMD -Os -Wpointer-arith \
-Wno-undef -ffunction-sections -fdata-sections -fno-inline-functions -fno-builtin \
-fno-strict-aliasing -Wno-char-subscripts -Wno-unused-but-set-variable ' + GLOBAL_DEFINES
LFLAGS = DEVICE + ' -MP -MMD -Wl,-zmax-page-size=1024 -Wl,-Map=' + MAP_FILE + ' -Wl,--whole-archive -Wl,--no-whole-archive -specs=minilibc.specs -nostartfiles -Wl,--gc-sections '
LFLAGS += ' -T ' + LINK_FILE
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -Os -g3'
AFLAGS += ' -g3'
else:
CFLAGS += ' -O2 -g2'
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET ' + TARGET_NAME + '\n'
POST_ACTION += SIZE + ' $TARGET\n'
def dist_handle(BSP_ROOT, dist_dir):
import sys
cwd_path = os.getcwd()
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), '../tools'))
from sdk_dist import dist_do_building
dist_do_building(BSP_ROOT, dist_dir)
|