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
|
# RT-Thread building script for RISC-V
import os
from building import *
Import('rtconfig')
cwd = GetCurrentDir()
group = []
cpu = getattr(rtconfig, 'CPU', '')
vendor = getattr(rtconfig, 'VENDOR', '')
if GetDepend('RT_USING_RISCV_NEW_COMMON'):
bsp_path = Dir('#').abspath
if not os.path.exists(os.path.join(bsp_path, 'link.lds')):
Env['LINKFLAGS'] = Env['LINKFLAGS'].replace(
'link.lds', os.path.join(cwd, 'link.lds'))
Preprocessing('link.lds.S', '.lds',
CPPPATH=[bsp_path, os.path.join(cwd, 'common', 'include')])
# The new common owns the complete C runtime entry.
Env['LINKFLAGS'] += ' -nostartfiles'
group += SConscript(os.path.join('common', 'SConscript'))
# New vendor ports are architecture-wide overrides, not per-CPU copies.
if vendor:
vendor_path = os.path.join(cwd, vendor)
vendor_script = os.path.join(vendor, 'SConscript')
if os.path.isfile(os.path.join(cwd, vendor_script)):
Env.Append(CPPPATH=[vendor_path])
group += SConscript(vendor_script)
if os.path.exists(os.path.join(vendor_path, 'mmu_vendor.h')):
Env.Append(ASFLAGS=' -D__HAS_MMU_VENDOR__')
Env.Append(CFLAGS=' -D__HAS_MMU_VENDOR__')
Env.Append(CXXFLAGS=' -D__HAS_MMU_VENDOR__')
if os.path.exists(os.path.join(vendor_path, 'opcode_vendor.h')):
Env.Append(ASFLAGS=' -D__HAS_OPCODE_VENDOR__')
Env.Append(CFLAGS=' -D__HAS_OPCODE_VENDOR__')
Env.Append(CXXFLAGS=' -D__HAS_OPCODE_VENDOR__')
else:
common64_cpus = ['virt64', 'c906', 'c908', 'ur-cp100']
if cpu in common64_cpus:
group += SConscript(os.path.join('common64', 'SConscript'))
else:
group += SConscript(os.path.join('legacy_common', 'SConscript'))
group += SConscript(os.path.join('vector', 'SConscript'))
if vendor:
if vendor == 't-head':
port_script = os.path.join('legacy-t-head', cpu, 'SConscript')
else:
port_script = os.path.join(vendor, cpu, 'SConscript')
if os.path.isfile(os.path.join(cwd, port_script)):
group += SConscript(port_script)
elif cpu:
port_script = os.path.join(cpu, 'SConscript')
if os.path.isfile(os.path.join(cwd, port_script)):
group += SConscript(port_script)
Return('group')
|