mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 03:03:27 +00:00
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.
This commit is contained in:
@@ -479,9 +479,6 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
|
|||||||
return nil, fmt.Errorf("unknown OpenOCD transport: %#v", c.Target.OpenOCDTransport)
|
return nil, fmt.Errorf("unknown OpenOCD transport: %#v", c.Target.OpenOCDTransport)
|
||||||
}
|
}
|
||||||
args = []string{"-f", "interface/" + openocdInterface + ".cfg"}
|
args = []string{"-f", "interface/" + openocdInterface + ".cfg"}
|
||||||
for _, cmd := range c.Target.OpenOCDCommands {
|
|
||||||
args = append(args, "-c", cmd)
|
|
||||||
}
|
|
||||||
if c.Target.OpenOCDTransport != "" {
|
if c.Target.OpenOCDTransport != "" {
|
||||||
transport := c.Target.OpenOCDTransport
|
transport := c.Target.OpenOCDTransport
|
||||||
if transport == "swd" {
|
if transport == "swd" {
|
||||||
@@ -493,6 +490,9 @@ func (c *Config) OpenOCDConfiguration() (args []string, err error) {
|
|||||||
args = append(args, "-c", "transport select "+transport)
|
args = append(args, "-c", "transport select "+transport)
|
||||||
}
|
}
|
||||||
args = append(args, "-f", "target/"+c.Target.OpenOCDTarget+".cfg")
|
args = append(args, "-f", "target/"+c.Target.OpenOCDTarget+".cfg")
|
||||||
|
for _, cmd := range c.Target.OpenOCDCommands {
|
||||||
|
args = append(args, "-c", cmd)
|
||||||
|
}
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user