Skip to content

Commit b02b8fa

Browse files
committed
bsp:Separate HC32F4 series library
1 parent 593ac8d commit b02b8fa

File tree

661 files changed

+122
-1105550
lines changed

Some content is hidden

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

661 files changed

+122
-1105550
lines changed

bsp/hc32/ev_hc32f448_lqfp80/SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "hc32-f4-cmsis-latest"),
23+
os.path.join("packages", "hc32-f4-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
1837
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1938

2039
DefaultEnvironment(tools=[])
@@ -47,11 +66,7 @@ Export('SDK_LIB')
4766
# prepare building environment
4867
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4968

50-
hc32_library = 'hc32f448_ddl'
51-
rtconfig.BSP_LIBRARY_TYPE = hc32_library
52-
53-
# include libraries
54-
objs.extend(SConscript(os.path.join(libraries_path_prefix, hc32_library, 'SConscript')))
69+
rtconfig.BSP_LIBRARY_TYPE = None
5570

5671
# include drivers
5772
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hc32_drivers', 'SConscript')))

bsp/hc32/ev_hc32f448_lqfp80/board/SConscript

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
2-
import rtconfig
32
from building import *
43

5-
Import('SDK_LIB')
6-
74
cwd = GetCurrentDir()
85

96
# add general drivers
@@ -16,14 +13,6 @@ path = [cwd]
1613
path += [cwd + '/ports']
1714
path += [cwd + '/config']
1815

19-
startup_path_prefix = SDK_LIB
20-
21-
if rtconfig.PLATFORM in ['gcc']:
22-
src += [startup_path_prefix + '/hc32f448_ddl/cmsis/Device/HDSC/hc32f4xx/Source/GCC/startup_hc32f448.S']
23-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
24-
src += [startup_path_prefix + '/hc32f448_ddl/cmsis/Device/HDSC/hc32f4xx/Source/ARM/startup_hc32f448.s']
25-
elif rtconfig.PLATFORM in ['iccarm']:
26-
src += [startup_path_prefix + '/hc32f448_ddl/cmsis/Device/HDSC/hc32f4xx/Source/IAR/startup_hc32f448.s']
2716

2817
CPPDEFINES = ['HC32F448', '__DEBUG']
2918
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

bsp/hc32/ev_hc32f460_lqfp100_v2/SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "hc32-f4-cmsis-latest"),
23+
os.path.join("packages", "hc32-f4-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
1837
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1938

2039
DefaultEnvironment(tools=[])
@@ -47,11 +66,7 @@ Export('SDK_LIB')
4766
# prepare building environment
4867
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4968

50-
hc32_library = 'hc32f460_ddl'
51-
rtconfig.BSP_LIBRARY_TYPE = hc32_library
52-
53-
# include libraries
54-
objs.extend(SConscript(os.path.join(libraries_path_prefix, hc32_library, 'SConscript')))
69+
rtconfig.BSP_LIBRARY_TYPE = None
5570

5671
# include drivers
5772
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hc32_drivers', 'SConscript')))

bsp/hc32/ev_hc32f460_lqfp100_v2/board/SConscript

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
2-
import rtconfig
32
from building import *
43

5-
Import('SDK_LIB')
6-
74
cwd = GetCurrentDir()
85

96
# add general drivers
@@ -17,15 +14,6 @@ path += [cwd + '/ports']
1714
path += [cwd + '/config']
1815
path += [cwd + '/config/usb_config']
1916

20-
startup_path_prefix = SDK_LIB
21-
22-
if rtconfig.PLATFORM in ['gcc']:
23-
src += [startup_path_prefix + '/hc32f460_ddl/cmsis/Device/HDSC/hc32f4xx/Source/GCC/startup_hc32f460.S']
24-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
25-
src += [startup_path_prefix + '/hc32f460_ddl/cmsis/Device/HDSC/hc32f4xx/Source/ARM/startup_hc32f460.s']
26-
elif rtconfig.PLATFORM in ['iccarm']:
27-
src += [startup_path_prefix + '/hc32f460_ddl/cmsis/Device/HDSC/hc32f4xx/Source/IAR/startup_hc32f460.s']
28-
2917
CPPDEFINES = ['HC32F460', '__DEBUG']
3018
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
3119

bsp/hc32/ev_hc32f472_lqfp100/SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "hc32-f4-cmsis-latest"),
23+
os.path.join("packages", "hc32-f4-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
1837
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1938

2039
DefaultEnvironment(tools=[])
@@ -47,11 +66,7 @@ Export('SDK_LIB')
4766
# prepare building environment
4867
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4968

50-
hc32_library = 'hc32f472_ddl'
51-
rtconfig.BSP_LIBRARY_TYPE = hc32_library
52-
53-
# include libraries
54-
objs.extend(SConscript(os.path.join(libraries_path_prefix, hc32_library, 'SConscript')))
69+
rtconfig.BSP_LIBRARY_TYPE = None
5570

5671
# include drivers
5772
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hc32_drivers', 'SConscript')))

bsp/hc32/ev_hc32f472_lqfp100/board/SConscript

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
2-
import rtconfig
32
from building import *
43

5-
Import('SDK_LIB')
6-
74
cwd = GetCurrentDir()
85

96
# add general drivers
@@ -17,15 +14,6 @@ path += [cwd + '/ports']
1714
path += [cwd + '/config']
1815
path += [cwd + '/config/usb_config']
1916

20-
startup_path_prefix = SDK_LIB
21-
22-
if rtconfig.PLATFORM in ['gcc']:
23-
src += [startup_path_prefix + '/hc32f472_ddl/cmsis/Device/HDSC/hc32f4xx/Source/GCC/startup_hc32f472.S']
24-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
25-
src += [startup_path_prefix + '/hc32f472_ddl/cmsis/Device/HDSC/hc32f4xx/Source/ARM/startup_hc32f472.s']
26-
elif rtconfig.PLATFORM in ['iccarm']:
27-
src += [startup_path_prefix + '/hc32f472_ddl/cmsis/Device/HDSC/hc32f4xx/Source/IAR/startup_hc32f472.s']
28-
2917
CPPDEFINES = ['HC32F472', '__DEBUG']
3018
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
3119

bsp/hc32/ev_hc32f4a0_lqfp176/SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "hc32-f4-cmsis-latest"),
23+
os.path.join("packages", "hc32-f4-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
1837
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1938

2039
DefaultEnvironment(tools=[])
@@ -47,11 +66,7 @@ Export('SDK_LIB')
4766
# prepare building environment
4867
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4968

50-
hc32_library = 'hc32f4a0_ddl'
51-
rtconfig.BSP_LIBRARY_TYPE = hc32_library
52-
53-
# include libraries
54-
objs.extend(SConscript(os.path.join(libraries_path_prefix, hc32_library, 'SConscript')))
69+
rtconfig.BSP_LIBRARY_TYPE = None
5570

5671
# include drivers
5772
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hc32_drivers', 'SConscript')))

bsp/hc32/ev_hc32f4a0_lqfp176/board/SConscript

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import os
2-
import rtconfig
32
from building import *
43

5-
Import('SDK_LIB')
6-
74
cwd = GetCurrentDir()
85

96
# add general drivers
@@ -17,15 +14,6 @@ path += [cwd + '/ports']
1714
path += [cwd + '/config']
1815
path += [cwd + '/config/usb_config']
1916

20-
startup_path_prefix = SDK_LIB
21-
22-
if rtconfig.PLATFORM in ['gcc']:
23-
src += [startup_path_prefix + '/hc32f4a0_ddl/cmsis/Device/HDSC/hc32f4xx/Source/GCC/startup_hc32f4a0.S']
24-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
25-
src += [startup_path_prefix + '/hc32f4a0_ddl/cmsis/Device/HDSC/hc32f4xx/Source/ARM/startup_hc32f4a0.s']
26-
elif rtconfig.PLATFORM in ['iccarm']:
27-
src += [startup_path_prefix + '/hc32f4a0_ddl/cmsis/Device/HDSC/hc32f4xx/Source/IAR/startup_hc32f4a0.s']
28-
2917
CPPDEFINES = ['HC32F4A0', '__DEBUG']
3018
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
3119

bsp/hc32/ev_hc32f4a8_lqfp176/SConscript

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,4 @@ for d in list:
1212
if os.path.isfile(os.path.join(path, 'SConscript')):
1313
objs = objs + SConscript(os.path.join(d, 'SConscript'))
1414

15-
def find_keyword_replace(file_path, keyword, replace, split_num, split_char):
16-
with open(file_path, 'r', encoding='utf-8') as file:
17-
lines = file.readlines()
18-
19-
for i, line in enumerate(lines):
20-
if keyword in line:
21-
parts = line.split(split_char)
22-
parts[split_num] = replace
23-
new_line = split_char.join(parts)
24-
lines[i] = new_line
25-
26-
with open(file_path, 'w', encoding='utf-8') as file:
27-
file.writelines(lines)
28-
29-
Import('PACKAGES_PATH')
30-
replace = PACKAGES_PATH.split("\\")[-1]
31-
32-
if rtconfig.PLATFORM in ['gcc']:
33-
file_path = os.path.join(cwd, 'jlink', 'ev_hc32f4a8_lqfp176 Debug.launch')
34-
svd_keyword = 'HC32F4A8.svd'
35-
split_num = 3
36-
elif rtconfig.PLATFORM in ['armcc', 'armclang']:
37-
file_path = os.path.join(cwd, 'template.uvprojx')
38-
svd_keyword = 'HC32F4A8.SFR'
39-
split_num = 2
40-
elif rtconfig.PLATFORM in ['iccarm']:
41-
file_path = os.path.join(cwd, 'project.ewd')
42-
svd_keyword = 'HC32F4A8.svd'
43-
split_num = 3
44-
board_keyword = 'FlashHC32F4A8xI.board'
45-
find_keyword_replace(file_path, board_keyword, replace, split_num, '/')
46-
47-
find_keyword_replace(file_path, svd_keyword, replace, split_num, '/')
48-
4915
Return('objs')

bsp/hc32/ev_hc32f4a8_lqfp176/SConstruct

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ except:
1515
print(RTT_ROOT)
1616
exit(-1)
1717

18+
def bsp_pkg_check():
19+
import subprocess
20+
21+
check_paths = [
22+
os.path.join("packages", "hc32-f4-cmsis-latest"),
23+
os.path.join("packages", "hc32-f4-series-latest")
24+
]
25+
26+
need_update = not all(os.path.exists(p) for p in check_paths)
27+
28+
if need_update:
29+
print("\n===============================================================================")
30+
print("Dependency packages missing, please running 'pkgs --update'...")
31+
print("If no packages are fetched, run 'pkgs --upgrade' first, then 'pkgs --update'...")
32+
print("===============================================================================")
33+
exit(1)
34+
35+
RegisterPreBuildingAction(bsp_pkg_check)
36+
1837
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1938

2039
DefaultEnvironment(tools=[])
@@ -47,8 +66,7 @@ Export('SDK_LIB')
4766
# prepare building environment
4867
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
4968

50-
hc32_library = 'hc32f4a8_ddl'
51-
rtconfig.BSP_LIBRARY_TYPE = hc32_library
69+
rtconfig.BSP_LIBRARY_TYPE = None
5270

5371
# include drivers
5472
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'hc32_drivers', 'SConscript')))

0 commit comments

Comments
 (0)