编译app自动生成boot.bin文件
This commit is contained in:
@@ -7,7 +7,7 @@ import prebuild as time
|
||||
|
||||
# 定义app和boot文件路径(没有尾缀)
|
||||
APP_FILE_SRC = "./Objects/app/checker_gen1_app"
|
||||
BOOT_FILE_SRC = "./Objects/app/checker_gen1_boot"
|
||||
BOOT_FILE_SRC = "./Objects/boot/checker_gen1_boot"
|
||||
# APP_FILE_DST = "./Objects/checker_gen1_app"
|
||||
APP_FILE_DST = "./python/file/checker_gen1_app"
|
||||
BOOT_FILE_DST = "./Objects/checker_gen1_boot"
|
||||
@@ -141,9 +141,23 @@ def main():
|
||||
data=head+data
|
||||
with open(dst,"wb") as f:
|
||||
f.write(data)
|
||||
print(dst+' File copy success.')
|
||||
|
||||
|
||||
print(dst+' create app file success.')
|
||||
boot=BOOT_FILE_SRC+".bin"
|
||||
boot_dst=BOOT_FILE_DST+"_"+date+".bin"
|
||||
if os.path.exists(boot):
|
||||
d=bytearray()
|
||||
with open(boot,"rb") as f:
|
||||
d+=f.read()
|
||||
d+=arr_byte_copy(0xff,0x20000-len(d))
|
||||
with open(src,"rb") as f:
|
||||
d+=f.read()
|
||||
if os.path.exists(boot_dst):
|
||||
os.remove(boot_dst)
|
||||
with open(boot_dst,"wb") as f:
|
||||
f.write(d)
|
||||
print(boot_dst+" create boot file success.")
|
||||
else:
|
||||
print("please build bootloader to create boot file")
|
||||
if __name__=="__main__":
|
||||
main()
|
||||
|
||||
|
Reference in New Issue
Block a user