输入通道改为实际使用通道
编译后自动添加到数据库
This commit is contained in:
@@ -2,6 +2,7 @@ import shutil
|
||||
import sys
|
||||
import os
|
||||
import prebuild as time
|
||||
import mysql
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +13,11 @@ BOOT_FILE_SRC = "./Objects/boot/coder_2channel_boot"
|
||||
APP_FILE_DST = "./python/file/coder_2channel_app"
|
||||
BOOT_FILE_DST = "./Objects/coder_2channel_boot"
|
||||
|
||||
# 定义app和boot的数据库目录
|
||||
SQL_APP_PATH = "coder_stm32f1_app"
|
||||
SQL_BOOT_PATH = "coder_stm32f1_boot"
|
||||
|
||||
|
||||
|
||||
# 找到指定后缀的文件
|
||||
def find_type(fix:str):
|
||||
@@ -67,8 +73,7 @@ def crc32(data:bytearray):
|
||||
|
||||
|
||||
|
||||
# app扇区地址为 0x08020000
|
||||
# 运行地址为 0x08020000
|
||||
# 运行地址为 0x08004000
|
||||
# 添加一个128byte为本程序添加的数据头
|
||||
|
||||
|
||||
@@ -142,6 +147,9 @@ def main():
|
||||
with open(dst,"wb") as f:
|
||||
f.write(data)
|
||||
print(dst+' create app file success.')
|
||||
sql=mysql.sql()
|
||||
if(sql.init(SQL_APP_PATH)==True):
|
||||
sql.insert(dst)
|
||||
boot=BOOT_FILE_SRC+".bin"
|
||||
boot_dst=BOOT_FILE_DST+"_"+date+".bin"
|
||||
if os.path.exists(boot):
|
||||
@@ -156,6 +164,9 @@ def main():
|
||||
with open(boot_dst,"wb") as f:
|
||||
f.write(d)
|
||||
print(boot_dst+" create boot file success.")
|
||||
sql=mysql.sql()
|
||||
if(sql.init(SQL_BOOT_PATH)==True):
|
||||
sql.insert(boot_dst)
|
||||
else:
|
||||
print("please build bootloader to create boot file")
|
||||
if __name__=="__main__":
|
||||
|
Reference in New Issue
Block a user