Skip to content

Commit

Permalink
compileopts: apply OpenOCD commands after target configuration
Browse files Browse the repository at this point in the history
The openocd-commands option cannot refer to commands defined by the
target configuration. Lift this restriction by moving the commands to
after target loading.
  • Loading branch information
eliasnaur authored and deadprogram committed Apr 17, 2024
1 parent dcee228 commit 7122755
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compileopts/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,6 @@ 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 != "" {
transport := c.Target.OpenOCDTransport
if transport == "swd" {
Expand All @@ -493,6 +490,9 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
args = append(args, "-c", "transport select "+transport)
}
args = append(args, "-f", "target/"+c.Target.OpenOCDTarget+".cfg")
for _, cmd := range c.Target.OpenOCDCommands {
args = append(args, "-c", cmd)
}
return args, nil
}

Expand Down

0 comments on commit 7122755

Please sign in to comment.