diff --git a/main.go b/main.go index 48a3a279..120a5a91 100644 --- a/main.go +++ b/main.go @@ -403,24 +403,34 @@ func Flash(pkgName, target, port string, config *BuildConfig) error { // determine the type of file to compile var fileExt string - switch { - case strings.Contains(spec.Flasher, "{hex}"): + switch spec.FlashMethod { + case "command", "": + switch { + case strings.Contains(spec.FlashCommand, "{hex}"): + fileExt = ".hex" + case strings.Contains(spec.FlashCommand, "{elf}"): + fileExt = ".elf" + case strings.Contains(spec.FlashCommand, "{bin}"): + fileExt = ".bin" + case strings.Contains(spec.FlashCommand, "{uf2}"): + fileExt = ".uf2" + default: + return errors.New("invalid target file - did you forget the {hex} token in the 'flash-command' section?") + } + case "msd": + if spec.FlashFilename == "" { + return errors.New("invalid target file: flash-method was set to \"msd\" but no msd-firmware-name was set") + } + fileExt = filepath.Ext(spec.FlashFilename) + case "openocd": fileExt = ".hex" - case strings.Contains(spec.Flasher, "{elf}"): - fileExt = ".elf" - case strings.Contains(spec.Flasher, "{bin}"): - fileExt = ".bin" - case strings.Contains(spec.Flasher, "{uf2}"): - fileExt = ".uf2" + case "native": + return errors.New("unknown flash method \"native\" - did you miss a -target flag?") default: - return errors.New("invalid target file - did you forget the {hex} token in the 'flash' section?") + return errors.New("unknown flash method: " + spec.FlashMethod) } return Compile(pkgName, fileExt, spec, config, func(tmppath string) error { - if spec.Flasher == "" { - return errors.New("no flash command specified - did you miss a -target flag?") - } - // do we need port reset to put MCU into bootloader mode? if spec.PortReset == "true" { err := touchSerialPortAt1200bps(port) @@ -432,7 +442,25 @@ func Flash(pkgName, target, port string, config *BuildConfig) error { } // this flashing method copies the binary data to a Mass Storage Device (msd) - if spec.FlashMethod == "msd" { + switch spec.FlashMethod { + case "", "command": + // Create the command. + flashCmd := spec.FlashCommand + fileToken := "{" + fileExt[1:] + "}" + flashCmd = strings.Replace(flashCmd, fileToken, tmppath, -1) + flashCmd = strings.Replace(flashCmd, "{port}", port, -1) + + // Execute the command. + cmd := exec.Command("/bin/sh", "-c", flashCmd) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + cmd.Dir = sourceDir() + err := cmd.Run() + if err != nil { + return &commandError{"failed to flash", tmppath, err} + } + return nil + case "msd": switch fileExt { case ".uf2": err := flashUF2UsingMSD(spec.FlashVolume, tmppath) @@ -449,24 +477,23 @@ func Flash(pkgName, target, port string, config *BuildConfig) error { default: return errors.New("mass storage device flashing currently only supports uf2 and hex") } + case "openocd": + args, err := spec.OpenOCDConfiguration() + if err != nil { + return err + } + args = append(args, "-c", "program "+tmppath+" reset exit") + cmd := exec.Command("openocd", args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err = cmd.Run() + if err != nil { + return &commandError{"failed to flash", tmppath, err} + } + return nil + default: + return fmt.Errorf("unknown flash method: %s", spec.FlashMethod) } - - // Create the command. - flashCmd := spec.Flasher - fileToken := "{" + fileExt[1:] + "}" - flashCmd = strings.Replace(flashCmd, fileToken, tmppath, -1) - flashCmd = strings.Replace(flashCmd, "{port}", port, -1) - - // Execute the command. - cmd := exec.Command("/bin/sh", "-c", flashCmd) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - cmd.Dir = sourceDir() - err := cmd.Run() - if err != nil { - return &commandError{"failed to flash", tmppath, err} - } - return nil }) } @@ -485,9 +512,33 @@ func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig) } return Compile(pkgName, "", spec, config, func(tmppath string) error { - if len(spec.OCDDaemon) != 0 { + // Find a good way to run GDB. + gdbInterface := spec.FlashMethod + switch gdbInterface { + case "msd", "command", "": + if gdbInterface == "" { + gdbInterface = "command" + } + if spec.OpenOCDInterface != "" && spec.OpenOCDTarget != "" { + gdbInterface = "openocd" + } + } + + // Run the GDB server, if necessary. + var gdbCommands []string + switch gdbInterface { + case "native": + // Run GDB directly. + gdbCommands = append(gdbCommands, "run") + case "openocd": + gdbCommands = append(gdbCommands, "target remote :3333", "monitor halt", "load", "monitor reset", "c") + // We need a separate debugging daemon for on-chip debugging. - daemon := exec.Command(spec.OCDDaemon[0], spec.OCDDaemon[1:]...) + args, err := spec.OpenOCDConfiguration() + if err != nil { + return err + } + daemon := exec.Command("openocd", args...) if ocdOutput { // Make it clear which output is from the daemon. w := &ColorWriter{ @@ -512,6 +563,10 @@ func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig) // Maybe we should send a .Kill() after x seconds? daemon.Wait() }() + case "msd": + return errors.New("gdb is not supported for drag-and-drop programmable devices") + default: + return fmt.Errorf("gdb is not supported with interface %#v", gdbInterface) } // Ignore Ctrl-C, it must be passed on to GDB. @@ -526,7 +581,7 @@ func FlashGDB(pkgName, target, port string, ocdOutput bool, config *BuildConfig) // By default: gdb -ex run // Exit GDB with Ctrl-D. params := []string{tmppath} - for _, cmd := range spec.GDBCmds { + for _, cmd := range gdbCommands { params = append(params, "-ex", cmd) } cmd := exec.Command(spec.GDB, params...) @@ -606,7 +661,7 @@ func flashUF2UsingMSD(volume, tmppath string) error { return err } if d == nil { - return errors.New("unable to locate UF2 device:" + volume) + return errors.New("unable to locate UF2 device: " + volume) } return moveFile(tmppath, filepath.Dir(d[0])+"/flash.uf2") @@ -624,7 +679,7 @@ func flashHexUsingMSD(volume, tmppath string) error { return err } if d == nil { - return errors.New("unable to locate device:" + volume) + return errors.New("unable to locate device: " + volume) } return moveFile(tmppath, d[0]+"/flash.hex") diff --git a/target.go b/target.go index 69fde7d8..25e9ff8d 100644 --- a/target.go +++ b/target.go @@ -26,29 +26,32 @@ var TINYGOROOT string // https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.TargetOptions.html // https://github.com/shepmaster/rust-arduino-blink-led-no-core-with-cargo/blob/master/blink/arduino.json type TargetSpec struct { - Inherits []string `json:"inherits"` - Triple string `json:"llvm-target"` - CPU string `json:"cpu"` - Features []string `json:"features"` - GOOS string `json:"goos"` - GOARCH string `json:"goarch"` - BuildTags []string `json:"build-tags"` - GC string `json:"gc"` - Scheduler string `json:"scheduler"` - Compiler string `json:"compiler"` - Linker string `json:"linker"` - RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt) - CFlags []string `json:"cflags"` - LDFlags []string `json:"ldflags"` - ExtraFiles []string `json:"extra-files"` - Emulator []string `json:"emulator"` - Flasher string `json:"flash"` - OCDDaemon []string `json:"ocd-daemon"` - GDB string `json:"gdb"` - GDBCmds []string `json:"gdb-initial-cmds"` - PortReset string `json:"flash-1200-bps-reset"` - FlashMethod string `json:"flash-method"` - FlashVolume string `json:"flash-msd-volume-name"` + Inherits []string `json:"inherits"` + Triple string `json:"llvm-target"` + CPU string `json:"cpu"` + Features []string `json:"features"` + GOOS string `json:"goos"` + GOARCH string `json:"goarch"` + BuildTags []string `json:"build-tags"` + GC string `json:"gc"` + Scheduler string `json:"scheduler"` + Compiler string `json:"compiler"` + Linker string `json:"linker"` + RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt) + CFlags []string `json:"cflags"` + LDFlags []string `json:"ldflags"` + ExtraFiles []string `json:"extra-files"` + Emulator []string `json:"emulator"` + FlashCommand string `json:"flash-command"` + OCDDaemon []string `json:"ocd-daemon"` + GDB string `json:"gdb"` + PortReset string `json:"flash-1200-bps-reset"` + FlashMethod string `json:"flash-method"` + FlashVolume string `json:"msd-volume-name"` + FlashFilename string `json:"msd-firmware-name"` + OpenOCDInterface string `json:"openocd-interface"` + OpenOCDTarget string `json:"openocd-target"` + OpenOCDTransport string `json:"openocd-transport"` } // copyProperties copies all properties that are set in spec2 into itself. @@ -91,8 +94,8 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) { if len(spec2.Emulator) != 0 { spec.Emulator = spec2.Emulator } - if spec2.Flasher != "" { - spec.Flasher = spec2.Flasher + if spec2.FlashCommand != "" { + spec.FlashCommand = spec2.FlashCommand } if len(spec2.OCDDaemon) != 0 { spec.OCDDaemon = spec2.OCDDaemon @@ -100,9 +103,6 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) { if spec2.GDB != "" { spec.GDB = spec2.GDB } - if len(spec2.GDBCmds) != 0 { - spec.GDBCmds = spec2.GDBCmds - } if spec2.PortReset != "" { spec.PortReset = spec2.PortReset } @@ -112,6 +112,18 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) { if spec2.FlashVolume != "" { spec.FlashVolume = spec2.FlashVolume } + if spec2.FlashFilename != "" { + spec.FlashFilename = spec2.FlashFilename + } + if spec2.OpenOCDInterface != "" { + spec.OpenOCDInterface = spec2.OpenOCDInterface + } + if spec2.OpenOCDTarget != "" { + spec.OpenOCDTarget = spec2.OpenOCDTarget + } + if spec2.OpenOCDTransport != "" { + spec.OpenOCDTransport = spec2.OpenOCDTransport + } } // load reads a target specification from the JSON in the given io.Reader. It @@ -248,9 +260,8 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { Compiler: "clang", Linker: "cc", GDB: "gdb", - GDBCmds: []string{"run"}, PortReset: "false", - FlashMethod: "command", + FlashMethod: "native", } if goos == "darwin" { spec.LDFlags = append(spec.LDFlags, "-Wl,-dead_strip") @@ -277,6 +288,33 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { return &spec, nil } +// OpenOCDConfiguration returns a list of command line arguments to OpenOCD. +// This list of command-line arguments is based on the various OpenOCD-related +// flags in the target specification. +func (spec *TargetSpec) OpenOCDConfiguration() (args []string, err error) { + if spec.OpenOCDInterface == "" { + return nil, errors.New("OpenOCD programmer not set") + } + if !regexp.MustCompile("^[\\p{L}0-9_-]+$").MatchString(spec.OpenOCDInterface) { + return nil, fmt.Errorf("OpenOCD programmer has an invalid name: %#v", spec.OpenOCDInterface) + } + if spec.OpenOCDTarget == "" { + return nil, errors.New("OpenOCD chip not set") + } + if !regexp.MustCompile("^[\\p{L}0-9_-]+$").MatchString(spec.OpenOCDTarget) { + return nil, fmt.Errorf("OpenOCD target has an invalid name: %#v", spec.OpenOCDTarget) + } + if spec.OpenOCDTransport != "" && spec.OpenOCDTransport != "swd" { + return nil, fmt.Errorf("unknown OpenOCD transport: %#v", spec.OpenOCDTransport) + } + args = []string{"-f", "interface/" + spec.OpenOCDInterface + ".cfg"} + if spec.OpenOCDTransport != "" { + args = append(args, "-c", "transport select "+spec.OpenOCDTransport) + } + args = append(args, "-f", "target/"+spec.OpenOCDTarget+".cfg") + return args, nil +} + // Return the TINYGOROOT, or exit with an error. func sourceDir() string { // Use $TINYGOROOT as root, if available. diff --git a/targets/arduino-nano33.json b/targets/arduino-nano33.json index 839fd7c1..788fa407 100644 --- a/targets/arduino-nano33.json +++ b/targets/arduino-nano33.json @@ -1,6 +1,6 @@ { "inherits": ["atsamd21g18a"], "build-tags": ["sam", "atsamd21g18a", "arduino_nano33"], - "flash": "bossac -d -i -e -w -v -R --port={port} --offset=0x2000 {bin}", + "flash-command": "bossac -d -i -e -w -v -R --port={port} --offset=0x2000 {bin}", "flash-1200-bps-reset": "true" } diff --git a/targets/arduino.json b/targets/arduino.json index f26fcc0e..ec4e0da8 100644 --- a/targets/arduino.json +++ b/targets/arduino.json @@ -15,5 +15,5 @@ "targets/avr.S", "src/device/avr/atmega328p.s" ], - "flash": "avrdude -c arduino -p atmega328p -P {port} -U flash:w:{hex}" + "flash-command": "avrdude -c arduino -p atmega328p -P {port} -U flash:w:{hex}" } diff --git a/targets/bluepill.json b/targets/bluepill.json index cacaf343..12e0cec0 100644 --- a/targets/bluepill.json +++ b/targets/bluepill.json @@ -12,7 +12,7 @@ "extra-files": [ "src/device/stm32/stm32f103xx.s" ], - "flash": "openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/stlink-v2.cfg", "-f", "target/stm32f1x.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "openocd", + "openocd-interface": "stlink-v2", + "openocd-target": "stm32f1x" } diff --git a/targets/circuitplay-express.json b/targets/circuitplay-express.json index b4a1059c..b0672100 100644 --- a/targets/circuitplay-express.json +++ b/targets/circuitplay-express.json @@ -1,8 +1,8 @@ { "inherits": ["atsamd21g18a"], "build-tags": ["sam", "atsamd21g18a", "circuitplay_express"], - "flash": "{uf2}", "flash-1200-bps-reset": "true", "flash-method": "msd", - "flash-msd-volume-name": "CPLAYBOOT" + "msd-volume-name": "CPLAYBOOT", + "msd-firmware-name": "firmware.uf2" } diff --git a/targets/digispark.json b/targets/digispark.json index 290f1649..079dcd34 100644 --- a/targets/digispark.json +++ b/targets/digispark.json @@ -15,5 +15,5 @@ "targets/avr.S", "src/device/avr/attiny85.s" ], - "flash": "micronucleus --run {hex}" + "flash-command": "micronucleus --run {hex}" } diff --git a/targets/feather-m0.json b/targets/feather-m0.json index 5397fbfc..92936645 100644 --- a/targets/feather-m0.json +++ b/targets/feather-m0.json @@ -1,8 +1,8 @@ { "inherits": ["atsamd21g18a"], "build-tags": ["sam", "atsamd21g18a", "feather_m0"], - "flash": "{uf2}", "flash-1200-bps-reset": "true", "flash-method": "msd", - "flash-msd-volume-name": "FEATHERBOOT" + "msd-volume-name": "FEATHERBOOT", + "msd-firmware-name": "firmware.uf2" } diff --git a/targets/hifive1b.json b/targets/hifive1b.json index c0ab3aaf..10b55137 100644 --- a/targets/hifive1b.json +++ b/targets/hifive1b.json @@ -4,7 +4,7 @@ "ldflags": [ "-T", "targets/hifive1b.ld" ], - "flash": "{hex}", "flash-method": "msd", - "flash-msd-volume-name": "HiFive" + "msd-volume-name": "HiFive", + "msd-firmware-name": "firmware.hex" } diff --git a/targets/itsybitsy-m0.json b/targets/itsybitsy-m0.json index 1f093685..39b57c84 100644 --- a/targets/itsybitsy-m0.json +++ b/targets/itsybitsy-m0.json @@ -1,8 +1,8 @@ { "inherits": ["atsamd21g18a"], "build-tags": ["sam", "atsamd21g18a", "itsybitsy_m0"], - "flash": "{uf2}", "flash-1200-bps-reset": "true", "flash-method": "msd", - "flash-msd-volume-name": "ITSYBOOT" + "msd-volume-name": "ITSYBOOT", + "msd-firmware-name": "firmware.uf2" } diff --git a/targets/itsybitsy-m4.json b/targets/itsybitsy-m4.json index 152898a6..d833b13e 100644 --- a/targets/itsybitsy-m4.json +++ b/targets/itsybitsy-m4.json @@ -1,8 +1,8 @@ { "inherits": ["atsamd51g19a"], "build-tags": ["sam", "atsamd51g19a", "itsybitsy_m4"], - "flash": "{uf2}", "flash-1200-bps-reset": "true", "flash-method": "msd", - "flash-msd-volume-name": "ITSYM4BOOT" + "msd-volume-name": "ITSYM4BOOT", + "msd-firmware-name": "firmware.uf2" } diff --git a/targets/microbit.json b/targets/microbit.json index daf91a40..1b677c5d 100644 --- a/targets/microbit.json +++ b/targets/microbit.json @@ -1,9 +1,8 @@ { "inherits": ["nrf51"], "build-tags": ["microbit"], - "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"], "flash-method": "msd", - "flash-msd-volume-name": "MICROBIT" + "openocd-interface": "cmsis-dap", + "msd-volume-name": "MICROBIT", + "msd-firmware-name": "firmware.hex" } diff --git a/targets/nrf51.json b/targets/nrf51.json index 05ca1dee..deb111d9 100644 --- a/targets/nrf51.json +++ b/targets/nrf51.json @@ -14,5 +14,6 @@ "extra-files": [ "lib/nrfx/mdk/system_nrf51.c", "src/device/nrf/nrf51.s" - ] + ], + "openocd-target": "nrf51" } diff --git a/targets/nrf52.json b/targets/nrf52.json index 945a4151..e8932aa3 100644 --- a/targets/nrf52.json +++ b/targets/nrf52.json @@ -15,5 +15,6 @@ "extra-files": [ "lib/nrfx/mdk/system_nrf52.c", "src/device/nrf/nrf52.s" - ] + ], + "openocd-target": "nrf51" } diff --git a/targets/nrf52840-mdk.json b/targets/nrf52840-mdk.json index 388c325b..244b3d96 100644 --- a/targets/nrf52840-mdk.json +++ b/targets/nrf52840-mdk.json @@ -1,7 +1,6 @@ { "inherits": ["nrf52840"], "build-tags": ["nrf52840_mdk"], - "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "openocd", + "openocd-interface": "cmsis-dap" } diff --git a/targets/nrf52840.json b/targets/nrf52840.json index dd6f1e08..503d350c 100644 --- a/targets/nrf52840.json +++ b/targets/nrf52840.json @@ -15,5 +15,6 @@ "extra-files": [ "lib/nrfx/mdk/system_nrf52840.c", "src/device/nrf/nrf52840.s" - ] + ], + "openocd-target": "nrf51" } diff --git a/targets/nucleo-f103rb.json b/targets/nucleo-f103rb.json index 7f2a5741..b92db048 100644 --- a/targets/nucleo-f103rb.json +++ b/targets/nucleo-f103rb.json @@ -12,7 +12,7 @@ "extra-files": [ "src/device/stm32/stm32f103xx.s" ], - "flash": "openocd -f interface/stlink-v2-1.cfg -f target/stm32f1x.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/stlink-v2-1.cfg", "-f", "target/stm32f1x.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "openocd", + "openocd-interface": "stlink-v2-1", + "openocd-target": "stm32f1x" } diff --git a/targets/pca10031.json b/targets/pca10031.json index d0dd3d46..cccae828 100644 --- a/targets/pca10031.json +++ b/targets/pca10031.json @@ -1,7 +1,6 @@ { "inherits": ["nrf51"], "build-tags": ["pca10031"], - "flash": "nrfjprog -f nrf51 --sectorerase --program {hex} --reset", - "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-command": "nrfjprog -f nrf51 --sectorerase --program {hex} --reset", + "openocd-interface": "cmsis-dap" } diff --git a/targets/pca10040.json b/targets/pca10040.json index 1bff6e8c..7685be42 100644 --- a/targets/pca10040.json +++ b/targets/pca10040.json @@ -1,7 +1,8 @@ { "inherits": ["nrf52"], "build-tags": ["pca10040"], - "flash": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset", - "ocd-daemon": ["openocd", "-f", "interface/jlink.cfg", "-c", "transport select swd", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "openocd", + "flash-command": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset", + "openocd-interface": "jlink", + "openocd-transport": "swd" } diff --git a/targets/pca10056.json b/targets/pca10056.json index 382d2277..1e35e51e 100644 --- a/targets/pca10056.json +++ b/targets/pca10056.json @@ -1,7 +1,8 @@ { "inherits": ["nrf52840"], "build-tags": ["pca10056"], - "flash": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset", - "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "command", + "flash-command": "nrfjprog -f nrf52 --sectorerase --program {hex} --reset", + "msd-volume-name": "JLINK", + "msd-firmware-name": "firmware.hex" } diff --git a/targets/reelboard.json b/targets/reelboard.json index 208e8213..60aeb1cf 100644 --- a/targets/reelboard.json +++ b/targets/reelboard.json @@ -1,7 +1,8 @@ { "inherits": ["nrf52840"], "build-tags": ["reelboard"], - "flash": "openocd -f interface/cmsis-dap.cfg -f target/nrf51.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/cmsis-dap.cfg", "-f", "target/nrf51.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "msd", + "msd-volume-name": "reel-board", + "msd-firmware-name": "firmware.hex", + "openocd-interface": "cmsis-dap" } diff --git a/targets/stm32f4disco.json b/targets/stm32f4disco.json index 67fe7841..2a549c32 100644 --- a/targets/stm32f4disco.json +++ b/targets/stm32f4disco.json @@ -12,7 +12,7 @@ "extra-files": [ "src/device/stm32/stm32f407.s" ], - "flash": "openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c 'program {hex} reset exit'", - "ocd-daemon": ["openocd", "-f", "interface/stlink.cfg", "-f", "target/stm32f4x.cfg"], - "gdb-initial-cmds": ["target remote :3333", "monitor halt", "load", "monitor reset", "c"] + "flash-method": "openocd", + "openocd-interface": "stlink-v2", + "openocd-target": "stm32f4x" } diff --git a/targets/trinket-m0.json b/targets/trinket-m0.json index 198cc873..c9c69e57 100644 --- a/targets/trinket-m0.json +++ b/targets/trinket-m0.json @@ -1,8 +1,8 @@ { "inherits": ["atsamd21e18a"], "build-tags": ["sam", "atsamd21e18a", "trinket_m0"], - "flash": "{uf2}", "flash-1200-bps-reset": "true", "flash-method": "msd", - "flash-msd-volume-name": "TRINKETBOOT" + "msd-volume-name": "TRINKETBOOT", + "msd-firmware-name": "firmware.uf2" }