Skip to content

Commit f7a6986

Browse files
CYFS3Rbb666
authored andcommitted
Fix BSP dist packaging
1 parent c577400 commit f7a6986

61 files changed

Lines changed: 681 additions & 83 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bsp/ESP/ESP32_C3/rtconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@
4242
CXXFLAGS = CFLAGS
4343

4444
POST_ACTION = OBJCPY + ' -Oihex $TARGET rtthread.hex\n' + SIZE + ' $TARGET \n'
45+
46+
def dist_handle(BSP_ROOT, dist_dir):
47+
import sys
48+
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
49+
from sdk_dist import dist_do_building
50+
dist_do_building(BSP_ROOT, dist_dir)

bsp/ESP/tools/sdk_dist.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
# BSP dist function
1010
def dist_do_building(BSP_ROOT, dist_dir):
1111
from mkdist import bsp_copy_files
12-
import rtconfig
1312

13+
library_dir = os.path.join(dist_dir, 'libraries')
14+
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
1415

1516
print("=> copy bsp drivers")
1617
bsp_copy_files(os.path.join(library_path, 'drivers'), os.path.join(library_dir, 'drivers'))
17-
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
18+
kconfig = os.path.join(library_path, 'Kconfig')
19+
if os.path.exists(kconfig):
20+
shutil.copyfile(kconfig, os.path.join(library_dir, 'Kconfig'))

bsp/Infineon/tools/sdk_dist.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ def dist_do_building(BSP_ROOT, dist_dir):
1313

1414
print("=> copy ifx bsp library")
1515
library_dir = os.path.join(dist_dir, 'libraries')
16+
sibling_library_dir = os.path.join(os.path.dirname(dist_dir), 'libraries')
1617
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
17-
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
18-
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
18+
if rtconfig.BSP_LIBRARY_TYPE is not None:
19+
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
20+
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
1921

2022
print("=> copy bsp drivers")
2123
bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(library_dir, 'HAL_Drivers'))
2224
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
25+
26+
print("=> copy sibling bsp drivers")
27+
bsp_copy_files(os.path.join(library_path, 'HAL_Drivers'), os.path.join(sibling_library_dir, 'HAL_Drivers'))
28+
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(sibling_library_dir, 'Kconfig'))

bsp/allwinner/d1s/rtconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@
5454

5555
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtthread.asm\n'
5656
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' + './mksdimg.sh\n'
57+
58+
def dist_handle(BSP_ROOT, dist_dir):
59+
import sys
60+
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
61+
from sdk_dist import dist_do_building
62+
dist_do_building(BSP_ROOT, dist_dir)

bsp/allwinner/tools/sdk_dist.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@
66
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
77

88

9+
def update_kconfig_library_path(dist_dir):
10+
library_dir = os.path.join(dist_dir, 'libraries')
11+
if not os.path.isdir(library_dir):
12+
return
13+
14+
for root, dirs, files in os.walk(library_dir):
15+
if 'Kconfig' not in files:
16+
continue
17+
18+
kconfig_path = os.path.join(root, 'Kconfig')
19+
with open(kconfig_path, 'r') as f:
20+
data = f.read()
21+
22+
data = data.replace('$(BSP_DIR)/../libraries', 'libraries')
23+
data = data.replace('$BSP_DIR/../libraries', 'libraries')
24+
data = data.replace('../libraries', 'libraries')
25+
26+
with open(kconfig_path, 'w') as f:
27+
f.write(data)
28+
29+
930
# BSP dist function
1031
def dist_do_building(BSP_ROOT, dist_dir):
1132
from mkdist import bsp_copy_files
@@ -19,4 +40,9 @@ def dist_do_building(BSP_ROOT, dist_dir):
1940

2041
print("=> copy bsp drivers")
2142
bsp_copy_files(os.path.join(library_path, 'drivers'), os.path.join(library_dir, 'drivers'))
43+
44+
print("=> copy bsp libos")
45+
bsp_copy_files(os.path.join(library_path, 'libos'), os.path.join(library_dir, 'libos'))
46+
2247
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
48+
update_kconfig_library_path(dist_dir)

bsp/at32/at32f421-start/board/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ menu "On-chip Peripheral Drivers"
115115
depends on RT_USING_SERIAL_V2 && BSP_UART2_RX_USING_DMA
116116
default 64
117117
endif
118+
endif
118119

119120
menuconfig BSP_USING_PWM
120121
bool "Enable PWM"

bsp/at32/at32m412-start/board/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ menu "On-chip Peripheral Drivers"
115115
depends on RT_USING_SERIAL_V2 && BSP_UART2_RX_USING_DMA
116116
default 64
117117
endif
118+
endif
118119

119120
menuconfig BSP_USING_PWM
120121
bool "Enable PWM"

bsp/at32/at32m416-start/board/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ menu "On-chip Peripheral Drivers"
115115
depends on RT_USING_SERIAL_V2 && BSP_UART2_RX_USING_DMA
116116
default 64
117117
endif
118+
endif
118119

119120
menuconfig BSP_USING_PWM
120121
bool "Enable PWM"

bsp/essemi/es32f365x/rtconfig.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,9 @@
133133
LFLAGS += ' --entry __iar_program_start'
134134
EXEC_PATH = EXEC_PATH + '/arm/bin/'
135135
POST_ACTION = ''
136+
137+
def dist_handle(BSP_ROOT, dist_dir):
138+
import sys
139+
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
140+
from sdk_dist import dist_do_building
141+
dist_do_building(BSP_ROOT, dist_dir)

bsp/essemi/tools/sdk_dist.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os
2+
3+
4+
def dist_do_building(BSP_ROOT, dist_dir):
5+
from mkdist import bsp_copy_files
6+
7+
print("=> copy es32f369x libraries")
8+
bsp_copy_files(
9+
os.path.join(os.path.dirname(BSP_ROOT), 'es32f369x'),
10+
os.path.join(os.path.dirname(dist_dir), 'es32f369x'),
11+
)

0 commit comments

Comments
 (0)