Skip to content

Commit

Permalink
flash: add openocd-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
sago35 authored and deadprogram committed Apr 9, 2022
1 parent f613cb4 commit 09a3c6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions compileopts/target.go
Expand Up @@ -59,6 +59,7 @@ type TargetSpec struct {
OpenOCDTarget string `json:"openocd-target"`
OpenOCDTransport string `json:"openocd-transport"`
OpenOCDCommands []string `json:"openocd-commands"`
OpenOCDVerify *bool `json:"openocd-verify"` // enable verify when flashing with openocd
JLinkDevice string `json:"jlink-device"`
CodeModel string `json:"code-model"`
RelocationModel string `json:"relocation-model"`
Expand Down
6 changes: 5 additions & 1 deletion main.go
Expand Up @@ -453,7 +453,11 @@ func Flash(pkgName, port string, options *compileopts.Options) error {
if err != nil {
return err
}
args = append(args, "-c", "program "+filepath.ToSlash(result.Binary)+" reset exit")
exit := " reset exit"
if config.Target.OpenOCDVerify != nil && *config.Target.OpenOCDVerify {
exit = " verify" + exit
}
args = append(args, "-c", "program "+filepath.ToSlash(result.Binary)+exit)
cmd := executeCommand(config.Options, "openocd", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down
3 changes: 2 additions & 1 deletion targets/wioterminal.json
Expand Up @@ -6,5 +6,6 @@
"flash-1200-bps-reset": "true",
"flash-method": "msd",
"msd-volume-name": "Arduino",
"msd-firmware-name": "firmware.uf2"
"msd-firmware-name": "firmware.uf2",
"openocd-verify": true
}

0 comments on commit 09a3c6a

Please sign in to comment.