mkdist和sdk_dist支持kconfiglib语法
This commit is contained in:
parent
fe3c4d456e
commit
f0e6d772f3
|
@ -1,9 +1,11 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
def bsp_update_kconfig_library(dist_dir):
|
||||
# change RTT_ROOT in Kconfig
|
||||
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
|
||||
|
@ -12,16 +14,12 @@ def bsp_update_kconfig_library(dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../libraries') != -1 and found:
|
||||
position = line.find('../libraries')
|
||||
line = line[0:position] + 'libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
|
@ -30,8 +28,10 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
print("=> copy at32 bsp library")
|
||||
library_dir = os.path.join(dist_dir, 'libraries')
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
bsp_copy_files(
|
||||
os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE),
|
||||
)
|
||||
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'rt_drivers'), os.path.join(library_dir, 'rt_drivers'))
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
import rtconfig
|
||||
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), '../libraries')
|
||||
print("library_path ",library_path)
|
||||
library_dir = os.path.join(dist_dir, 'libraries')
|
||||
print("library_dir ",library_dir)
|
||||
print("library_path ", library_path)
|
||||
library_dir = os.path.join(dist_dir, 'libraries')
|
||||
print("library_dir ", library_dir)
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'rt_drivers'), os.path.join(library_dir, 'rt_drivers'))
|
||||
print("=> copy bsp CMSIS")
|
||||
|
@ -28,12 +30,7 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../../libraries') != -1 and found:
|
||||
position = line.find('../../libraries')
|
||||
line = line[0:position] + 'libraries"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
#cwd_path = E:\rt-thread\bsp\core-v-mcu\tools
|
||||
# cwd_path = E:\rt-thread\bsp\core-v-mcu\tools
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
|
@ -13,25 +15,19 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
print("=> copy core-v bsp library")
|
||||
library_dir = os.path.join(dist_dir, 'Libraries')
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries')
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
#library_dir = E:\rt-thread\bsp\core-v-mcu\Libraries
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
# library_dir = E:\rt-thread\bsp\core-v-mcu\Libraries
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'core_v_drivers'), os.path.join(library_dir, 'core_v_drivers'))
|
||||
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
|
||||
# change RTT_ROOT in Kconfig
|
||||
# change RTT_ROOT in Kconfig
|
||||
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
|
||||
return
|
||||
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../Libraries') != -1 and found:
|
||||
position = line.find('../Libraries')
|
||||
line = line[0:position] + 'Libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
|
|
@ -2,9 +2,11 @@ import os
|
|||
import re
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
def bsp_update_kconfig_library(dist_dir):
|
||||
# change RTT_ROOT in Kconfig
|
||||
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
|
||||
|
@ -13,16 +15,12 @@ def bsp_update_kconfig_library(dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../libraries') != -1 and found:
|
||||
position = line.find('../libraries')
|
||||
line = line[0:position] + 'libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
|
@ -31,14 +29,14 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
print("=> copy ht32 bsp library")
|
||||
library_dir = os.path.join(dist_dir, 'libraries')
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'ht32_drivers'), os.path.join(library_dir, 'ht32_drivers'))
|
||||
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
|
||||
bsp_update_kconfig_library(dist_dir)
|
||||
|
||||
|
||||
def get_source(ic_model, file_path, system_path, base_path):
|
||||
source_path = []
|
||||
files_list = []
|
||||
|
@ -47,7 +45,7 @@ def get_source(ic_model, file_path, system_path, base_path):
|
|||
return
|
||||
|
||||
with open(file_path, 'r') as file:
|
||||
#content = file.read()
|
||||
# content = file.read()
|
||||
for line in file:
|
||||
if readafter == 2 and line.find('>') != -1:
|
||||
break
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
import rtconfig
|
||||
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries')
|
||||
library_dir = os.path.join(dist_dir, 'Libraries')
|
||||
library_dir = os.path.join(dist_dir, 'Libraries')
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'drivers'), os.path.join(library_dir, 'drivers'))
|
||||
print("=> copy bsp CMSIS")
|
||||
|
@ -26,12 +28,7 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../Libraries') != -1 and found:
|
||||
position = line.find('../Libraries')
|
||||
line = line[0:position] + 'Libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../Libraries', 'Libraries')
|
||||
f.write(line)
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
|
@ -12,25 +14,22 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
print("=> copy ch32 bsp library")
|
||||
library_dir = os.path.join(dist_dir, 'Libraries')
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries')
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
bsp_copy_files(
|
||||
os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE),
|
||||
)
|
||||
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'ch32_drivers'), os.path.join(library_dir, 'ch32_drivers'))
|
||||
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
|
||||
# change RTT_ROOT in Kconfig
|
||||
# change RTT_ROOT in Kconfig
|
||||
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
|
||||
return
|
||||
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../Libraries') != -1 and found:
|
||||
position = line.find('../Libraries')
|
||||
line = line[0:position] + 'Libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../Libraries', 'Libraries')
|
||||
f.write(line)
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
cwd_path = os.getcwd()
|
||||
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
|
||||
|
||||
|
||||
# BSP dist function
|
||||
def dist_do_building(BSP_ROOT, dist_dir):
|
||||
from mkdist import bsp_copy_files
|
||||
|
@ -12,25 +14,19 @@ def dist_do_building(BSP_ROOT, dist_dir):
|
|||
print("=> copy ch32 bsp library")
|
||||
library_dir = os.path.join(dist_dir, 'Libraries')
|
||||
library_path = os.path.join(os.path.dirname(BSP_ROOT), 'Libraries')
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE),
|
||||
os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
|
||||
|
||||
print("=> copy bsp drivers")
|
||||
bsp_copy_files(os.path.join(library_path, 'ch32_drivers'), os.path.join(library_dir, 'ch32_drivers'))
|
||||
shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
|
||||
# change RTT_ROOT in Kconfig
|
||||
# change RTT_ROOT in Kconfig
|
||||
if not os.path.isfile(os.path.join(dist_dir, 'Kconfig')):
|
||||
return
|
||||
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../Libraries') != -1 and found:
|
||||
position = line.find('../Libraries')
|
||||
line = line[0:position] + 'Libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../Libraries', 'Libraries')
|
||||
f.write(line)
|
||||
|
|
|
@ -126,14 +126,9 @@ def bsp_update_kconfig(dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('default') != -1 and found:
|
||||
position = line.find('default')
|
||||
line = line[0:position] + 'default "rt-thread"\n'
|
||||
found = 0
|
||||
if line.find('RTT_DIR') != -1 and line.find(':=') != -1:
|
||||
line = 'RTT_DIR := rt-thread\n'
|
||||
f.write(line)
|
||||
|
||||
def bsp_update_kconfig_library(dist_dir):
|
||||
|
@ -144,14 +139,9 @@ def bsp_update_kconfig_library(dist_dir):
|
|||
with open(os.path.join(dist_dir, 'Kconfig'), 'r') as f:
|
||||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'Kconfig'), 'w') as f:
|
||||
found = 0
|
||||
for line in data:
|
||||
if line.find('RTT_ROOT') != -1:
|
||||
found = 1
|
||||
if line.find('../libraries') != -1 and found:
|
||||
position = line.find('../libraries')
|
||||
line = line[0:position] + 'libraries/Kconfig"\n'
|
||||
found = 0
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
||||
# change board/kconfig path
|
||||
|
@ -162,9 +152,8 @@ def bsp_update_kconfig_library(dist_dir):
|
|||
data = f.readlines()
|
||||
with open(os.path.join(dist_dir, 'board/Kconfig'), 'w') as f:
|
||||
for line in data:
|
||||
if line.find('../libraries/HAL_Drivers/drivers/Kconfig') != -1:
|
||||
position = line.find('../libraries/HAL_Drivers/drivers/Kconfig')
|
||||
line = line[0:position] + 'libraries/HAL_Drivers/drivers/Kconfig"\n'
|
||||
if line.find('source') != -1 and line.find('../libraries') != -1:
|
||||
line = line.replace('../libraries', 'libraries')
|
||||
f.write(line)
|
||||
|
||||
def zip_dist(dist_dir, dist_name):
|
||||
|
|
Loading…
Reference in New Issue