Skip to content

Commit 97ec224

Browse files
committed
复用 libcpu 内容
1 parent 0756e35 commit 97ec224

15 files changed

Lines changed: 85 additions & 1700 deletions

File tree

bsp/rdk/s100/SConstruct

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,53 @@ Export('RTT_ROOT')
2626
Export('rtconfig')
2727

2828
# prepare building environment
29-
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=True)
29+
objs = PrepareBuilding(env, RTT_ROOT)
30+
31+
def _replace_cortex_r52_with_startup(objects):
32+
startup_dir = os.path.join(Dir('#').abspath, 'startup')
33+
startup_names = set(
34+
name for name in os.listdir(startup_dir)
35+
if os.path.isfile(os.path.join(startup_dir, name))
36+
)
37+
cpu_dir = os.path.abspath(os.path.join(RTT_ROOT, 'libcpu', 'arm', 'cortex-r52'))
38+
39+
def _source_path(node):
40+
for attr in ('srcnode', 'rfile'):
41+
if hasattr(node, attr):
42+
source = getattr(node, attr)()
43+
if hasattr(source, 'abspath'):
44+
return os.path.abspath(source.abspath)
45+
if hasattr(node, 'abspath'):
46+
return os.path.abspath(node.abspath)
47+
return None
48+
49+
def _filter(items):
50+
filtered = []
51+
for item in items:
52+
if isinstance(item, list):
53+
filtered.append(_filter(item))
54+
continue
55+
56+
if not hasattr(item, 'abspath'):
57+
filtered.append(item)
58+
continue
59+
60+
item_path = _source_path(item)
61+
if item_path is None:
62+
filtered.append(item)
63+
continue
64+
65+
item_name = os.path.basename(item_path)
66+
if item_name in startup_names and item_path.startswith(cpu_dir + os.sep):
67+
continue
68+
69+
filtered.append(item)
70+
71+
return filtered
72+
73+
return _filter(objects)
74+
75+
objs = _replace_cortex_r52_with_startup(objs)
3076

3177
# make a building
3278
DoBuilding(TARGET, objs)

bsp/rdk/s100/board/board.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ extern char OS_HEAP_END_ADDR;
1818
#error "GCC support only!"
1919
#endif
2020

21+
#ifndef __DSB
22+
#define __DSB() __asm volatile ("dsb" : : : "memory")
23+
#endif
24+
25+
#ifndef __ISB
26+
#define __ISB() __asm volatile ("isb" : : : "memory")
27+
#endif
28+
2129
/***********************************************************************************************************************
2230
* GIC definitions
2331
**********************************************************************************************************************/

bsp/rdk/s100/startup/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ cwd = GetCurrentDir()
88
src = Glob('*.c') + Glob('*.S')
99
CPPPATH = [cwd]
1010

11-
group = DefineGroup('CPU', src, depend = [''], CPPPATH = CPPPATH)
11+
group = DefineGroup('startup', src, depend = [''], CPPPATH = CPPPATH)
1212

1313
Return('group')

bsp/rdk/s100/startup/armv8.h

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)