[tool][release] add tools/release folder for the scrips that prepare the version release
This commit is contained in:
parent
5e188b8ca8
commit
6cea142222
|
@ -21,7 +21,7 @@ elif CROSS_TOOL == 'iar':
|
||||||
PLATFORM = 'iccarm'
|
PLATFORM = 'iccarm'
|
||||||
EXEC_PATH = 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0'
|
EXEC_PATH = 'C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0'
|
||||||
else:
|
else:
|
||||||
print 'Please make sure your toolchains is GNU GCC!'
|
print('Please make sure your toolchains is GNU GCC!')
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if os.getenv('RTT_EXEC_PATH'):
|
if os.getenv('RTT_EXEC_PATH'):
|
||||||
|
|
|
@ -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保持一致
|
|
@ -4,9 +4,9 @@ import sys
|
||||||
def usage():
|
def usage():
|
||||||
print('%s all -- build all bsp' % os.path.basename(sys.argv[0]))
|
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 clean -- clean all bsp' % os.path.basename(sys.argv[0]))
|
||||||
print('%s project -- update all prject files' % 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")
|
BSP_ROOT = os.path.join("..", "..", "bsp")
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
usage()
|
usage()
|
||||||
|
@ -65,9 +65,15 @@ if sys.argv[1] == 'all':
|
||||||
command = ' '
|
command = ' '
|
||||||
elif sys.argv[1] == 'clean':
|
elif sys.argv[1] == 'clean':
|
||||||
command = ' -c'
|
command = ' -c'
|
||||||
elif sys.argv[1] == 'project':
|
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)
|
update_all_project_files(BSP_ROOT)
|
||||||
|
|
||||||
|
print('finished!')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
usage()
|
usage()
|
|
@ -1,46 +1,27 @@
|
||||||
|
# Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
#
|
#
|
||||||
# File : upgrade.py
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# This file is part of RT-Thread RTOS
|
|
||||||
# COPYRIGHT (C) 2006 - 2021, RT-Thread Development Team
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along
|
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
#
|
||||||
# Change Logs:
|
# Change Logs:
|
||||||
# Date Author Notes
|
# Date Author Notes
|
||||||
# 2021-10-11 Meco Man First version
|
# 2021-10-11 Meco Man First version
|
||||||
#
|
|
||||||
|
|
||||||
# 本文件用于在HAL库更新之后
|
# STM32 startup assembly language file:
|
||||||
# 1.对gcc的汇编启动文件中main替换为entry函数
|
# 1.replace main to entry (GCC)
|
||||||
# 2.将启动文件heap降为0(Keil IAR)
|
# 2.reduce the heap size as 0x000 (Keil IAR)
|
||||||
# 3.将GCC的堆大小扩展到0x400,与Keil IAR保持一致
|
# 3.extend the GCC stack size as 0x400, which is the same as Keil and IAR startup files.
|
||||||
|
|
||||||
|
|
||||||
#使用方法:运行脚本,将bsp/stm32的绝对路径传给脚本即可,如:C:\Users\92036\Desktop\rt-thread\bsp\stm32
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
#将'bl main' 替换为 'bl entry'
|
# replace 'bl main' to 'bl entry'
|
||||||
def main2entry(path):
|
def stm32update_main2entry(path):
|
||||||
oldline = ''
|
oldline = ''
|
||||||
newline = ''
|
newline = ''
|
||||||
|
|
||||||
for root, dirs, files in os.walk(path): #递归扫描里面的所有文件
|
for root, dirs, files in os.walk(path):
|
||||||
for file in files:
|
for file in files:
|
||||||
if os.path.splitext(file)[1] == '.s': #找.s文件
|
if os.path.splitext(file)[1] == '.s': # find .s files (Keil MDK)
|
||||||
file_path = os.path.join(root,file)
|
file_path = os.path.join(root,file)
|
||||||
flag_need_replace = False
|
flag_need_replace = False
|
||||||
with open(file_path,'r+',) as f:
|
with open(file_path,'r+',) as f:
|
||||||
|
@ -48,13 +29,13 @@ def main2entry(path):
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
if line == '':
|
if line == '':
|
||||||
break
|
break
|
||||||
elif ('bl' in line) and ('main' in line): #发现'bl main'
|
elif ('bl' in line) and ('main' in line): # find 'bl main'
|
||||||
oldline = line # bl main
|
oldline = line # bl main
|
||||||
newline = line.replace('main', 'entry') #将main替换为entry,形成新的字符串
|
newline = line.replace('main', 'entry') # use 'entry' to replace 'main'
|
||||||
flag_need_replace = True #标记该文件需要做entry替换
|
flag_need_replace = True # mark that need to be replaced
|
||||||
break
|
break
|
||||||
|
|
||||||
if (flag_need_replace == True): #若该文件需要将main替换为entry
|
if (flag_need_replace == True): # use 'entry' to replace 'main'
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
content = f.read()
|
content = f.read()
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
@ -62,14 +43,14 @@ def main2entry(path):
|
||||||
newcontent = content.replace(oldline, newline)
|
newcontent = content.replace(oldline, newline)
|
||||||
f.write(newcontent)
|
f.write(newcontent)
|
||||||
|
|
||||||
#将启动文件的heap降为0
|
#reduce the heap size as 0x000
|
||||||
def heap2zero(path):
|
def stm32update_heap2zero(path):
|
||||||
oldline = ''
|
oldline = ''
|
||||||
newline = ''
|
newline = ''
|
||||||
for root, dirs, files in os.walk(path): #递归扫描里面的所有文件
|
for root, dirs, files in os.walk(path):
|
||||||
for file in files:
|
for file in files:
|
||||||
file_path = os.path.join(root,file)
|
file_path = os.path.join(root,file)
|
||||||
if os.path.splitext(file)[1] == '.s': #找.s文件
|
if os.path.splitext(file)[1] == '.s': # find .s files (Keil MDK)
|
||||||
with open(file_path,'r+',) as f:
|
with open(file_path,'r+',) as f:
|
||||||
flag_need_replace = False
|
flag_need_replace = False
|
||||||
while True:
|
while True:
|
||||||
|
@ -77,7 +58,7 @@ def heap2zero(path):
|
||||||
if line == '':
|
if line == '':
|
||||||
break
|
break
|
||||||
|
|
||||||
re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line) #MDK的表示方法
|
re_result = re.match('\s*Heap_Size\s+EQU\s+0[xX][0-9a-fA-F]+', line)
|
||||||
if re_result != None:
|
if re_result != None:
|
||||||
oldline = line
|
oldline = line
|
||||||
newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline)
|
newline = re.sub('0[xX][0-9a-fA-F]+','0x00000000', oldline)
|
||||||
|
@ -92,7 +73,7 @@ def heap2zero(path):
|
||||||
newcontent = content.replace(oldline, newline)
|
newcontent = content.replace(oldline, newline)
|
||||||
f.write(newcontent)
|
f.write(newcontent)
|
||||||
|
|
||||||
elif os.path.splitext(file)[1] == '.icf': #找.icf文件(IAR)
|
elif os.path.splitext(file)[1] == '.icf': # find .icf files (IAR)
|
||||||
with open(file_path,'r+',) as f:
|
with open(file_path,'r+',) as f:
|
||||||
flag_need_replace = False
|
flag_need_replace = False
|
||||||
while True:
|
while True:
|
||||||
|
@ -100,7 +81,7 @@ def heap2zero(path):
|
||||||
if line == '':
|
if line == '':
|
||||||
break
|
break
|
||||||
|
|
||||||
re_result = re.match('\s*define\s+symbol\s+__ICFEDIT_size_heap__\s*=\s*0[xX][0-9a-fA-F]+', line) #IAR的表示方法
|
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:
|
if re_result != None:
|
||||||
oldline = line
|
oldline = line
|
||||||
newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline)
|
newline = re.sub('0[xX][0-9a-fA-F]+','0x000', oldline)
|
||||||
|
@ -115,7 +96,7 @@ def heap2zero(path):
|
||||||
newcontent = content.replace(oldline, newline)
|
newcontent = content.replace(oldline, newline)
|
||||||
f.write(newcontent)
|
f.write(newcontent)
|
||||||
|
|
||||||
elif os.path.splitext(file)[1] == '.lds': #找.lds文件(GCC)
|
elif os.path.splitext(file)[1] == '.lds': # find .lds files (GCC)
|
||||||
with open(file_path,'r+',) as f:
|
with open(file_path,'r+',) as f:
|
||||||
flag_need_replace = False
|
flag_need_replace = False
|
||||||
while True:
|
while True:
|
||||||
|
@ -123,7 +104,7 @@ def heap2zero(path):
|
||||||
if line == '':
|
if line == '':
|
||||||
break
|
break
|
||||||
|
|
||||||
re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line) #GCC的表示方法, 将默认的栈大小增加到0x400
|
re_result = re.match('\s*_system_stack_size\s*=\s*0[xX][0-9a-fA-F]+', line)
|
||||||
if re_result != None:
|
if re_result != None:
|
||||||
oldline = line
|
oldline = line
|
||||||
newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline)
|
newline = re.sub('0[xX][0-9a-fA-F]+','0x400', oldline)
|
||||||
|
@ -138,6 +119,7 @@ def heap2zero(path):
|
||||||
newcontent = content.replace(oldline, newline)
|
newcontent = content.replace(oldline, newline)
|
||||||
f.write(newcontent)
|
f.write(newcontent)
|
||||||
|
|
||||||
folder_path = input('please input path:')
|
|
||||||
main2entry(folder_path)
|
def stm32_update(path):
|
||||||
heap2zero(folder_path)
|
stm32update_main2entry(path)
|
||||||
|
stm32update_heap2zero(path)
|
Loading…
Reference in New Issue