@@ -26,27 +26,29 @@ var TINYGOROOT string
26
26
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.TargetOptions.html
27
27
// https://github.com/shepmaster/rust-arduino-blink-led-no-core-with-cargo/blob/master/blink/arduino.json
28
28
type TargetSpec struct {
29
- Inherits []string `json:"inherits"`
30
- Triple string `json:"llvm-target"`
31
- CPU string `json:"cpu"`
32
- Features []string `json:"features"`
33
- GOOS string `json:"goos"`
34
- GOARCH string `json:"goarch"`
35
- BuildTags []string `json:"build-tags"`
36
- GC string `json:"gc"`
37
- Scheduler string `json:"scheduler"`
38
- Compiler string `json:"compiler"`
39
- Linker string `json:"linker"`
40
- RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt)
41
- CFlags []string `json:"cflags"`
42
- LDFlags []string `json:"ldflags"`
43
- ExtraFiles []string `json:"extra-files"`
44
- Emulator []string `json:"emulator"`
45
- Flasher string `json:"flash"`
46
- OCDDaemon []string `json:"ocd-daemon"`
47
- GDB string `json:"gdb"`
48
- GDBCmds []string `json:"gdb-initial-cmds"`
49
- PortReset string `json:"flash-1200-bps-reset"`
29
+ Inherits []string `json:"inherits"`
30
+ Triple string `json:"llvm-target"`
31
+ CPU string `json:"cpu"`
32
+ Features []string `json:"features"`
33
+ GOOS string `json:"goos"`
34
+ GOARCH string `json:"goarch"`
35
+ BuildTags []string `json:"build-tags"`
36
+ GC string `json:"gc"`
37
+ Scheduler string `json:"scheduler"`
38
+ Compiler string `json:"compiler"`
39
+ Linker string `json:"linker"`
40
+ RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt)
41
+ CFlags []string `json:"cflags"`
42
+ LDFlags []string `json:"ldflags"`
43
+ ExtraFiles []string `json:"extra-files"`
44
+ Emulator []string `json:"emulator"`
45
+ Flasher string `json:"flash"`
46
+ OCDDaemon []string `json:"ocd-daemon"`
47
+ GDB string `json:"gdb"`
48
+ GDBCmds []string `json:"gdb-initial-cmds"`
49
+ PortReset string `json:"flash-1200-bps-reset"`
50
+ FlashMethod string `json:"flash-method"`
51
+ FlashVolume string `json:"flash-msd-volume-name"`
50
52
}
51
53
52
54
// copyProperties copies all properties that are set in spec2 into itself.
@@ -104,6 +106,12 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) {
104
106
if spec2 .PortReset != "" {
105
107
spec .PortReset = spec2 .PortReset
106
108
}
109
+ if spec2 .FlashMethod != "" {
110
+ spec .FlashMethod = spec2 .FlashMethod
111
+ }
112
+ if spec2 .FlashVolume != "" {
113
+ spec .FlashVolume = spec2 .FlashVolume
114
+ }
107
115
}
108
116
109
117
// load reads a target specification from the JSON in the given io.Reader. It
@@ -233,15 +241,16 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) {
233
241
// No target spec available. Use the default one, useful on most systems
234
242
// with a regular OS.
235
243
spec := TargetSpec {
236
- Triple : triple ,
237
- GOOS : goos ,
238
- GOARCH : goarch ,
239
- BuildTags : []string {goos , goarch },
240
- Compiler : "clang" ,
241
- Linker : "cc" ,
242
- GDB : "gdb" ,
243
- GDBCmds : []string {"run" },
244
- PortReset : "false" ,
244
+ Triple : triple ,
245
+ GOOS : goos ,
246
+ GOARCH : goarch ,
247
+ BuildTags : []string {goos , goarch },
248
+ Compiler : "clang" ,
249
+ Linker : "cc" ,
250
+ GDB : "gdb" ,
251
+ GDBCmds : []string {"run" },
252
+ PortReset : "false" ,
253
+ FlashMethod : "command" ,
245
254
}
246
255
if goos == "darwin" {
247
256
spec .LDFlags = append (spec .LDFlags , "-Wl,-dead_strip" )
0 commit comments