Skip to content

Commit 01a7587

Browse files
authored
Merge pull request #3547 from luhuadong/develop
[BSP] add Libraries when scons --dist
2 parents 00de74c + e1bd367 commit 01a7587

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

bsp/at32/at32f403a-start/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ config PKGS_DIR
1717

1818
source "$RTT_DIR/Kconfig"
1919
source "$PKGS_DIR/Kconfig"
20-
source "../libraries/Kconfig"
20+
source "../Libraries/Kconfig"
2121
source "board/Kconfig"
22-

bsp/at32/at32f403a-start/rtconfig.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23

34
# toolchains options
45
ARCH='arm'
@@ -57,7 +58,7 @@
5758
else:
5859
CFLAGS += ' -O2'
5960

60-
CXXFLAGS = CFLAGS
61+
CXXFLAGS = CFLAGS
6162

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

@@ -88,7 +89,7 @@
8889
else:
8990
CFLAGS += ' -O2'
9091

91-
CXXFLAGS = CFLAGS
92+
CXXFLAGS = CFLAGS
9293
CFLAGS += ' -std=c99'
9394

9495
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
@@ -136,8 +137,14 @@
136137

137138
LFLAGS = ' --config "board/linker_scripts/link.icf"'
138139
LFLAGS += ' --entry __iar_program_start'
139-
140+
140141
CXXFLAGS = CFLAGS
141142

142143
EXEC_PATH = EXEC_PATH + '/arm/bin/'
143144
POST_ACTION = 'ielftool --bin $TARGET rtthread.bin'
145+
146+
def dist_handle(BSP_ROOT):
147+
cwd_path = os.getcwd()
148+
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
149+
from sdk_dist import dist_do_building
150+
dist_do_building(BSP_ROOT)

bsp/at32/tools/sdk_dist.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
import sys
3+
import shutil
4+
cwd_path = os.getcwd()
5+
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
6+
7+
# BSP dist function
8+
def dist_do_building(BSP_ROOT):
9+
from mkdist import bsp_copy_files
10+
import rtconfig
11+
12+
dist_dir = os.path.join(BSP_ROOT, 'dist', os.path.basename(BSP_ROOT))
13+
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries')
14+
library_dir = os.path.join(dist_dir, 'Libraries')
15+
print("=> copy bsp drivers")
16+
bsp_copy_files(os.path.join(library_path, 'rt_drivers'), os.path.join(library_dir, 'rt_drivers'))
17+
print("=> copy bsp library")
18+
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
19+
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))

tools/mkdist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def bsp_update_kconfig(dist_dir):
122122
line = line[0:position] + 'default "rt-thread"\n'
123123
found = 0
124124
f.write(line)
125-
125+
126126
def bsp_update_kconfig_library(dist_dir):
127127
# change RTT_ROOT in Kconfig
128128
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
@@ -141,7 +141,7 @@ def bsp_update_kconfig_library(dist_dir):
141141
found = 0
142142
f.write(line)
143143

144-
# change board/kconfig path
144+
# change board/kconfig path
145145
if not os.path.isfile(os.path.join(dist_dir, 'board/Kconfig')):
146146
return
147147

@@ -215,11 +215,11 @@ def MkDist_Strip(program, BSP_ROOT, RTT_ROOT, Env):
215215
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
216216

217217
# do bsp special dist handle
218-
if 'dist_handle' in Env:
218+
if 'dist_handle' in Env:
219219
print("=> start dist handle")
220220
dist_handle = Env['dist_handle']
221221
dist_handle(BSP_ROOT)
222-
222+
223223
# get all source files from program
224224
for item in program:
225225
walk_children(item)

0 commit comments

Comments
 (0)