Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6f1f710

Browse files
committed
Command 'debug info' choose between "script" and "scripts" configs exclusively
1 parent 1e45f64 commit 6f1f710

File tree

3 files changed

+63
-6
lines changed

3 files changed

+63
-6
lines changed

‎commands/debug/debug_info.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ func getDebugProperties(req *rpc.GetDebugConfigRequest, pme *packagemanager.Expl
159159
case "openocd":
160160
openocdProperties := debugProperties.SubTree("server." + server)
161161
scripts := openocdProperties.ExtractSubIndexLists("scripts")
162-
if s := openocdProperties.Get("script"); s != "" {
163-
// backward compatibility
162+
if s := openocdProperties.Get("script"); s != "" &&len(scripts) ==0{
163+
// backward compatibility: use "script" property if there are no "scipts.N"
164164
scripts = append(scripts, s)
165165
}
166166
openocdConf := &rpc.DebugOpenOCDServerConfiguration{

‎internal/integrationtest/debug/debug_test.go‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
106106
require.NoError(t, err)
107107

108108
// Build sketch
109-
fqbn := "my:samd:my"
110-
_, _, err = cli.Run("compile", "-b", fqbn, sketchPath.String(), "--format", "json")
109+
_, _, err = cli.Run("compile", "-b", "my:samd:my", sketchPath.String(), "--format", "json")
111110
require.NoError(t, err)
112111

113112
{
114113
// Starts debugger
115-
jsonDebugOut, _, err := cli.Run("debug", "-b", fqbn, "-P", "atmel_ice", sketchPath.String(), "--info", "--format", "json")
114+
jsonDebugOut, _, err := cli.Run("debug", "-b", "my:samd:my", "-P", "atmel_ice", sketchPath.String(), "--info", "--format", "json")
116115
require.NoError(t, err)
117116
debugOut := requirejson.Parse(t, jsonDebugOut)
118117
debugOut.MustContain(`
@@ -154,7 +153,7 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
154153

155154
// Starts debugger with another programmer
156155
{
157-
jsonDebugOut, _, err := cli.Run("debug", "-b", fqbn, "-P", "my_cold_ice", sketchPath.String(), "--info", "--format", "json")
156+
jsonDebugOut, _, err := cli.Run("debug", "-b", "my:samd:my", "-P", "my_cold_ice", sketchPath.String(), "--info", "--format", "json")
158157
require.NoError(t, err)
159158
debugOut := requirejson.Parse(t, jsonDebugOut)
160159
debugOut.MustContain(`
@@ -192,5 +191,29 @@ func testAllDebugInformation(t *testing.T, env *integrationtest.Environment, cli
192191
]
193192
}
194193
}`)
194+
195+
{
196+
// Starts debugger with an old-style openocd script definition
197+
jsonDebugOut, _, err := cli.Run("debug", "-b", "my:samd:my2", "-P", "atmel_ice", sketchPath.String(), "--info", "--format", "json")
198+
require.NoError(t, err)
199+
debugOut := requirejson.Parse(t, jsonDebugOut)
200+
debugOut.MustContain(`
201+
{
202+
"toolchain": "gcc",
203+
"toolchain_path": "gcc-path",
204+
"toolchain_prefix": "gcc-prefix",
205+
"server": "openocd",
206+
"server_path": "openocd-path",
207+
"server_configuration": {
208+
"path": "openocd-path",
209+
"scripts_dir": "openocd-scripts-dir",
210+
"scripts": [
211+
"single-script"
212+
]
213+
},
214+
"svd_file": "svd-file"
215+
}`)
216+
}
217+
195218
}
196219
}

‎internal/integrationtest/debug/testdata/hardware/my/samd/boards.txt‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,37 @@ my.debug.cortex-debug.custom.overrideRestartCommands.2=thb setup
4545
my.debug.cortex-debug.custom.overrideRestartCommands.3=c
4646
my.debug.cortex-debug.custom.anotherStringParamer=hellooo
4747
my.debug.svd_file=svd-file
48+
49+
my2.name=My Cool Board
50+
my2.vid.0=0x2341
51+
my2.pid.0=0x804e
52+
my2.upload_port.0.vid=0x2341
53+
my2.upload_port.0.pid=0x804e
54+
my2.upload.tool=bossac
55+
my2.upload.tool.default=bossac
56+
my2.upload.tool.network=arduino_ota
57+
my2.upload.protocol=sam-ba
58+
my2.upload.maximum_size=262144
59+
my2.upload.maximum_data_size=32768
60+
my2.upload.use_1200bps_touch=true
61+
my2.upload.wait_for_upload_port=true
62+
my2.upload.native_usb=true
63+
my2.build.mcu=cortex-m0plus
64+
my2.build.f_cpu=48000000L
65+
my2.build.usb_product="Arduino MKR1000"
66+
my2.build.usb_manufacturer="Arduino LLC"
67+
my2.build.board=SAMD_MY
68+
my2.build.core=arduino:arduino
69+
my2.build.extra_flags=-DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ {build.usb_flags}
70+
my2.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
71+
my2.build.openocdscript=openocd_scripts/arduino_zero.cfg
72+
my2.build.variant=arduino:mkr1000
73+
my2.build.vid=0x2341
74+
my2.build.pid=0x804e
75+
76+
my2.debug.toolchain.path=gcc-path
77+
my2.debug.toolchain.prefix=gcc-prefix
78+
my2.debug.server.openocd.path=openocd-path
79+
my2.debug.server.openocd.scripts_dir=openocd-scripts-dir
80+
my2.debug.server.openocd.script=single-script
81+
my2.debug.svd_file=svd-file

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /