@@ -17,13 +17,13 @@ package debug
1717
1818import (
1919 "fmt"
20+ "strings"
21+ "testing"
22+
2023 "github.com/arduino/arduino-cli/arduino/cores/packagemanager"
21- rpc "github.com/arduino/arduino-cli/rpc/common"
2224 dbg "github.com/arduino/arduino-cli/rpc/debug"
2325 "github.com/arduino/go-paths-helper"
2426 "github.com/stretchr/testify/assert"
25- "strings"
26- "testing"
2727)
2828
2929var customHardware = paths .New ("testdata" , "custom_hardware" )
@@ -36,14 +36,18 @@ func TestGetCommandLine(t *testing.T) {
3636 pm .LoadHardwareFromDirectory (customHardware )
3737 pm .LoadHardwareFromDirectory (dataDir )
3838
39+ // Arduino Zero has an integrated debugger port, anc it could be debugged directly using USB
3940 req := & dbg.DebugConfigReq {
40- Instance : & rpc .Instance {Id : 1 },
41+ Instance : & dbg .Instance {Id : 1 },
4142 Fqbn : "arduino-test:samd:arduino_zero_edbg" ,
4243 SketchPath : sketchPath ,
4344 Port : "none" ,
4445 }
4546 packageName := strings .Split (req .Fqbn , ":" )[0 ]
4647 processor := strings .Split (req .Fqbn , ":" )[1 ]
48+ // This boardFamily variable is necessary for this particular board as it is represented in the core as 2 separated
49+ // boards, to expose the programming port and the debug (edbg) port. So we point at the same openocd configuration
50+ // variant for upload in both cases
4751 boardFamily := "arduino_zero"
4852
4953 goldCommand := []string {
@@ -59,9 +63,10 @@ func TestGetCommandLine(t *testing.T) {
5963 assert .Nil (t , err )
6064 assert .Equal (t , goldCommand , command )
6165
62- // for other samd boards
66+ // Other samd boards such as mkr1000 can be debugged using an external tool such as Atmel ICE connected to
67+ // the board debug port
6368 req2 := & dbg.DebugConfigReq {
64- Instance : & rpc .Instance {Id : 1 },
69+ Instance : & dbg .Instance {Id : 1 },
6570 Fqbn : "arduino-test:samd:mkr1000" ,
6671 SketchPath : sketchPath ,
6772 Port : "none" ,
0 commit comments