|
本帖最后由 Vmao 于 2018-3-13 14:19 编辑
像jlink那样,提供第三方接口吗? 市面上的脱机烧录功能不符合要求,只能用电脑配合stlink 做
烧写stm8L
....后记:已找到解决方案 使用st提供的 工具 STVP_CmdLine.exe
增加python 脚本自动化编辑地址 对于写C的人来说修改这个脚本实现按照自己的逻辑修改地址不成问题,不说了,直接上源码
(注意 需要安装IntelHex 库 )
from intelhex import IntelHex
from io import StringIO
import os
while 1:
ih = IntelHex("App.hex")
add=ih[0xAF05]+(ih[0xAF04]<<8)+(ih[0xAF03]<<16)+(ih[0xAF02]<<24)+(ih[0xAF01]<<32)+(ih[0xAF00]<<40)
num=0x00
num=input("Enter your number input, if 0 exit flashing: ")
num=(int(num))&0xff
if num==0:
break
part=0
add=add+1#地址曾1
ih[0xAF05]=(add)&0xff#修改固定地址数据
ih[0xAF04]=(add>>8)&0xff
ih[0xAF03]=(add>>16)&0xff
ih[0xAF02]=(add>>24)&0xff
ih[0xAF01]=(add>>32)&0xff
ih[0xAF00]=(add>>40)&0xff
print("add=%012X\n" %(add))
for i in range(0,num):
ih[0xAF06]=num
ih[0xAF07]=part
ih.tofile("App.hex", format='hex')
input("Enter any contiunue...: %d of %d " %((part+1),num))
print("flasering=%d of %d" %(part,num))
#烧写部分
command ='STVP_CmdLine.exe -Device=STM8L15xK4 -no_loop -no_warn_protect -FileOption=nolock.hex'
os.system(command)
command ='STVP_CmdLine.exe -Device=STM8L15xK4 -no_loop -no_warn_protect -FileProg=App.hex -FileOption=lock.hex'
os.system(command)
part=part+1
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|