Add support for additional openocd commands (#1492)

main: add ability to define specific OpenOCD commands to be executed for a target.
This commit is contained in:
Jacques Supcik
2020-12-30 00:19:41 -08:00
committed by GitHub
parent 939b393325
commit 2f4200a01b
3 changed files with 8 additions and 0 deletions
+3
View File
@@ -303,6 +303,9 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
return nil, fmt.Errorf("unknown OpenOCD transport: %#v", c.Target.OpenOCDTransport)
}
args = []string{"-f", "interface/" + openocdInterface + ".cfg"}
for _, cmd := range c.Target.OpenOCDCommands {
args = append(args, "-c", cmd)
}
if c.Target.OpenOCDTransport != "" {
args = append(args, "-c", "transport select "+c.Target.OpenOCDTransport)
}
+1
View File
@@ -52,6 +52,7 @@ type TargetSpec struct {
OpenOCDInterface string `json:"openocd-interface"`
OpenOCDTarget string `json:"openocd-target"`
OpenOCDTransport string `json:"openocd-transport"`
OpenOCDCommands []string `json:"openocd-commands"`
JLinkDevice string `json:"jlink-device"`
CodeModel string `json:"code-model"`
RelocationModel string `json:"relocation-model"`
+4
View File
@@ -0,0 +1,4 @@
{
"inherits": ["bluepill"],
"openocd-commands": ["set CPUTAPID 0x2ba01477"]
}