Skip to content

Commit 7122755

Browse files
eliasnaurdeadprogram
authored andcommitted
compileopts: apply OpenOCD commands after target configuration
The openocd-commands option cannot refer to commands defined by the target configuration. Lift this restriction by moving the commands to after target loading.
1 parent dcee228 commit 7122755

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compileopts/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,6 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
479479
return nil, fmt.Errorf("unknown OpenOCD transport: %#v", c.Target.OpenOCDTransport)
480480
}
481481
args = []string{"-f", "interface/" + openocdInterface + ".cfg"}
482-
for _, cmd := range c.Target.OpenOCDCommands {
483-
args = append(args, "-c", cmd)
484-
}
485482
if c.Target.OpenOCDTransport != "" {
486483
transport := c.Target.OpenOCDTransport
487484
if transport == "swd" {
@@ -493,6 +490,9 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
493490
args = append(args, "-c", "transport select "+transport)
494491
}
495492
args = append(args, "-f", "target/"+c.Target.OpenOCDTarget+".cfg")
493+
for _, cmd := range c.Target.OpenOCDCommands {
494+
args = append(args, "-c", cmd)
495+
}
496496
return args, nil
497497
}
498498

0 commit comments

Comments
 (0)