import RT-Thread@9217865c without bsp, libcpu and components/net

This commit is contained in:
Zihao Yu 2023-05-20 16:23:33 +08:00
commit e2376a3709
1414 changed files with 390370 additions and 0 deletions

10
tools/release/README.md Normal file
View file

@ -0,0 +1,10 @@
# 版本发布前自动更新与部署
在ENV环境下并在release文件夹下执行 `python buildbot.py update` 可完成自动版本发布**前** **部分** 准备工作。 欢迎补充其他发布前自动化脚本。
目前可以自动更新和部署的内容包括:
1. 更新所有BSP工程包括.config文件、rtconfig文件更新以及Keil\IAR等工程的刷新
2. STM32启动文件更新
1. 对gcc的汇编启动文件中main替换为entry函数
2. 将启动文件heap降为0(Keil IAR)
3. 将GCC的堆大小扩展到0x400与Keil IAR保持一致

88
tools/release/buildbot.py Normal file
View file

@ -0,0 +1,88 @@
import os
import sys
def usage():
print('%s all -- build all bsp' % os.path.basename(sys.argv[0]))
print('%s clean -- clean all bsp' % os.path.basename(sys.argv[0]))
print('%s update -- update all prject files' % os.path.basename(sys.argv[0]))
BSP_ROOT = os.path.join("..", "..", "bsp")
if len(sys.argv) != 2:
usage()
sys.exit(0)
def update_project_file(project_dir):
if os.path.isfile(os.path.join(project_dir, 'template.Uv2')):
print('prepare MDK3 project file on ' + project_dir)
command = ' --target=mdk -s'
os.system('scons --directory=' + project_dir + command + ' > 1.txt')
if os.path.isfile(os.path.join(project_dir, 'template.uvproj')):
print('prepare MDK4 project file on ' + project_dir)
command = ' --target=mdk4 -s'
os.system('scons --directory=' + project_dir + command + ' > 1.txt')
if os.path.isfile(os.path.join(project_dir, 'template.uvprojx')):
print('prepare MDK5 project file on ' + project_dir)
command = ' --target=mdk5 -s'
os.system('scons --directory=' + project_dir + command + ' > 1.txt')
if os.path.isfile(os.path.join(project_dir, 'template.ewp')):
print('prepare IAR project file on ' + project_dir)
command = ' --target=iar -s'
os.system('scons --directory=' + project_dir + command + ' > 1.txt')
def update_all_project_files(root_path):
# current path is dir
if os.path.isdir(root_path):
projects = os.listdir(root_path)
# is a project path?
if "SConstruct" in projects:
try:
# update rtconfig.h and .config
if "Kconfig" in projects:
if "win32" in sys.platform:
retval = os.getcwd()
os.chdir(root_path)
os.system("menuconfig --silent")
os.chdir(retval)
else:
os.system('scons --pyconfig-silent -C {0}'.format(root_path))
update_project_file(root_path)
except Exception as e:
print("error message: {}".format(e))
sys.exit(-1)
else:
for i in projects:
new_root_path = os.path.join(root_path, i)
update_all_project_files(new_root_path)
# get command options
command = ''
if sys.argv[1] == 'all':
command = ' '
elif sys.argv[1] == 'clean':
command = ' -c'
elif sys.argv[1] == 'update':
print('begin to update all the bsp projects')
from stm32_update import stm32_update
stm32_update(os.path.join(BSP_ROOT, 'stm32'))
update_all_project_files(BSP_ROOT)
print('finished!')
sys.exit(0)
else:
usage()
sys.exit(0)
projects = os.listdir(BSP_ROOT)
for item in projects:
project_dir = os.path.join(BSP_ROOT, item)
if os.path.isfile(os.path.join(project_dir, 'SConstruct')):
if os.system('scons --directory=' + project_dir + command) != 0:
print('build failed!!')
break

View file

@ -0,0 +1,125 @@
# Copyright (c) 2006-2022, RT-Thread Development Team
#
# SPDX-License-Identifier: Apache-2.0
#
# Change Logs:
# Date Author Notes
# 2021-10-11 Meco Man First version
# STM32 startup assembly language file:
# 1.replace main to entry (GCC)
# 2.reduce the heap size as 0x000 (Keil IAR)
# 3.extend the GCC stack size as 0x400, which is the same as Keil and IAR startup files.
import os
import re
# replace 'bl main' to 'bl entry'
def stm32update_main2entry(path):
oldline = ''
newline = ''
for root, dirs, files in os.walk(path):
for file in files:
if os.path.splitext(file)[1] == '.s': # find .s files (Keil MDK)
file_path = os.path.join(root,file)
flag_need_replace = False
with open(file_path,'r+',) as f:
while True:
line = f.readline()
if line == '':
break
elif ('bl' in line) and ('main' in line): # find 'bl main'
oldline = line # bl main
newline = line.replace('main', 'entry') # use 'entry' to replace 'main'
flag_need_replace = True # mark that need to be replaced
break
if (flag_need_replace == True): # use 'entry' to replace 'main'
f.seek(0)
content = f.read()
f.seek(0)
f.truncate()
newcontent = content.replace(oldline, newline)
f.write(newcontent)
#reduce the heap size as 0x000
def stm32update_heap2zero(path):
oldline = ''
newline = ''
for root, dirs, files in os.walk(path):
for file in files:
file_path = os.path.join(root,file)
if os.path.splitext(file)[1] == '.s': # find .s files (Keil MDK)
with open(file_path,'r+',) as f:
flag_need_replace = False
while True:
line = f.readline()
if line == '':
break
re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line)
if re_result != None:
oldline = line
newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline)
flag_need_replace = True
break
if flag_need_replace == True:
f.seek(0)
content = f.read()
f.seek(0)
f.truncate()
newcontent = content.replace(oldline, newline)
f.write(newcontent)
elif os.path.splitext(file)[1] == '.icf': # find .icf files (IAR)
with open(file_path,'r+',) as f:
flag_need_replace = False
while True:
line = f.readline()
if line == '':
break
re_result = re.match('\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line)
if re_result != None:
oldline = line
newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline)
flag_need_replace = True
break
if flag_need_replace == True:
f.seek(0)
content = f.read()
f.seek(0)
f.truncate()
newcontent = content.replace(oldline, newline)
f.write(newcontent)
elif os.path.splitext(file)[1] == '.lds': # find .lds files (GCC)
with open(file_path,'r+',) as f:
flag_need_replace = False
while True:
line = f.readline()
if line == '':
break
re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line)
if re_result != None:
oldline = line
newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline)
flag_need_replace = True
break
if flag_need_replace == True:
f.seek(0)
content = f.read()
f.seek(0)
f.truncate()
newcontent = content.replace(oldline, newline)
f.write(newcontent)
def stm32_update(path):
stm32update_main2entry(path)
stm32update_heap2zero(path)