Unverified Commit 4a5585e9 authored by MatteoPologruto's avatar MatteoPologruto Committed by GitHub

Add `programmer` field to sketch profile and `--profile` flag to `debug` command (#2505)

* Add programmer field to rpc.SketchProfile

* Add programmer to the sketch profile

* Retrieve programmer's information from the profile if the flag is not used

* Add profile flag to debug command

* Add default_programmer field to sketch project

* Add default_programmer to rpc.Sketch

* Add methods to set and retrieve default_programmer from a sketch

* Modify SetSketchDefaults function to set a programmer if specified

* Modify board attach command to set a default programmer

* Use default programmer if no other value is specified

* Update docs

* Update TestBoardAttach to test that a programmer is correctly written to sketch.yaml

* Add TestDebugProfile to integration tests
parent a617a401
......@@ -35,6 +35,7 @@ func SetSketchDefaults(ctx context.Context, req *rpc.SetSketchDefaultsRequest) (
oldAddress, oldProtocol := sk.GetDefaultPortAddressAndProtocol()
res := &rpc.SetSketchDefaultsResponse{
DefaultFqbn: sk.GetDefaultFQBN(),
DefaultProgrammer: sk.GetDefaultProgrammer(),
DefaultPortAddress: oldAddress,
DefaultPortProtocol: oldProtocol,
}
......@@ -45,6 +46,12 @@ func SetSketchDefaults(ctx context.Context, req *rpc.SetSketchDefaultsRequest) (
}
res.DefaultFqbn = fqbn
}
if programmer := req.GetDefaultProgrammer(); programmer != "" {
if err := sk.SetDefaultProgrammer(programmer); err != nil {
return nil, &cmderrors.CantUpdateSketchError{Cause: err}
}
res.DefaultProgrammer = programmer
}
if newAddress, newProtocol := req.GetDefaultPortAddress(), req.GetDefaultPortProtocol(); newAddress != "" {
if err := sk.SetDefaultPort(newAddress, newProtocol); err != nil {
return nil, &cmderrors.CantUpdateSketchError{Cause: err}
......
......@@ -146,6 +146,14 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er
fqbn = pme.GetProfile().FQBN
}
programmer := req.GetProgrammer()
if programmer == "" && pme.GetProfile() != nil {
programmer = pme.GetProfile().Programmer
}
if programmer == "" {
programmer = sk.GetDefaultProgrammer()
}
updatedPort, err := runProgramAction(
pme,
sk,
......@@ -153,7 +161,7 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er
req.GetImportDir(),
fqbn,
req.GetPort(),
req.GetProgrammer(),
programmer,
req.GetVerbose(),
req.GetVerify(),
false, // burnBootloader
......
......@@ -10,6 +10,7 @@ multiple profiles.
Each profile will define:
- The board FQBN
- The programmer to use
- The target core platform name and version (with the 3rd party platform index URL if needed)
- A possible core platform name and version, that is a dependency of the target core platform (with the 3rd party
platform index URL if needed)
......@@ -22,6 +23,7 @@ profiles:
<PROFILE_NAME>:
notes: <USER_NOTES>
fqbn: <FQBN>
programmer: <PROGRAMMER>
platforms:
- platform: <PLATFORM> (<PLATFORM_VERSION>)
platform_index_url: <3RD_PARTY_PLATFORM_URL>
......@@ -50,6 +52,7 @@ otherwise below). The available fields are:
- `libraries:` is a section where the required libraries to build the project are defined. This section is optional.
- `<LIB_VERSION>` is the version required for the library, for example, `1.0.0`.
- `<USER_NOTES>` is a free text string available to the developer to add comments. This field is optional.
- `<PROGRAMMER>` is the programmer that will be used. This field is optional.
A complete example of a sketch project file may be the following:
......@@ -134,6 +137,7 @@ The sketch project file may be used to set the default value for some command li
particular:
- The `default_fqbn` key sets the default value for the `--fqbn` flag
- The `default_programmer` key sets the default value for the `--programmer` flag
- The `default_port` key sets the default value for the `--port` flag
- The `default_protocol` key sets the default value for the `--protocol` flag
- The `default_profile` key sets the default value for the `--profile` flag
......@@ -141,12 +145,14 @@ particular:
For example:
```
default_fqbn: arduino:avr:uno
default_fqbn: arduino:samd:mkr1000
default_programmer: atmel_ice
default_port: /dev/ttyACM0
default_protocol: serial
default_profile: myprofile
```
With this configuration set, it is not necessary to specify the `--fqbn`, `--port`, `--protocol` or `--profile` flags to
the [`arduino-cli compile`](commands/arduino-cli_compile.md) or [`arduino-cli upload`](commands/arduino-cli_upload.md)
commands when compiling or uploading the sketch.
With this configuration set, it is not necessary to specify the `--fqbn`, `--programmer`, `--port`, `--protocol` or
`--profile` flags to the [`arduino-cli compile`](commands/arduino-cli_compile.md),
[`arduino-cli upload`](commands/arduino-cli_upload.md) or [`arduino-cli debug`](commands/arduino-cli_debug.md) commands
when compiling, uploading or debugging the sketch.
......@@ -32,20 +32,22 @@ import (
// projectRaw is a support struct used only to unmarshal the yaml
type projectRaw struct {
ProfilesRaw yaml.Node `yaml:"profiles"`
DefaultProfile string `yaml:"default_profile"`
DefaultFqbn string `yaml:"default_fqbn"`
DefaultPort string `yaml:"default_port,omitempty"`
DefaultProtocol string `yaml:"default_protocol,omitempty"`
ProfilesRaw yaml.Node `yaml:"profiles"`
DefaultProfile string `yaml:"default_profile"`
DefaultFqbn string `yaml:"default_fqbn"`
DefaultPort string `yaml:"default_port,omitempty"`
DefaultProtocol string `yaml:"default_protocol,omitempty"`
DefaultProgrammer string `yaml:"default_programmer,omitempty"`
}
// Project represents the sketch project file
type Project struct {
Profiles []*Profile
DefaultProfile string
DefaultFqbn string
DefaultPort string
DefaultProtocol string
Profiles []*Profile
DefaultProfile string
DefaultFqbn string
DefaultPort string
DefaultProtocol string
DefaultProgrammer string
}
// AsYaml outputs the sketch project file as YAML
......@@ -69,6 +71,9 @@ func (p *Project) AsYaml() string {
if p.DefaultProtocol != "" {
res += fmt.Sprintf("default_protocol: %s\n", p.DefaultProtocol)
}
if p.DefaultProgrammer != "" {
res += fmt.Sprintf("default_programmer: %s\n", p.DefaultProgrammer)
}
return res
}
......@@ -93,18 +98,20 @@ func (p *projectRaw) getProfiles() ([]*Profile, error) {
// Profile is a sketch profile, it contains a reference to all the resources
// needed to build and upload a sketch
type Profile struct {
Name string
Notes string `yaml:"notes"`
FQBN string `yaml:"fqbn"`
Platforms ProfileRequiredPlatforms `yaml:"platforms"`
Libraries ProfileRequiredLibraries `yaml:"libraries"`
Name string
Notes string `yaml:"notes"`
FQBN string `yaml:"fqbn"`
Programmer string `yaml:"programmer"`
Platforms ProfileRequiredPlatforms `yaml:"platforms"`
Libraries ProfileRequiredLibraries `yaml:"libraries"`
}
// ToRpc converts this Profile to an rpc.SketchProfile
func (p *Profile) ToRpc() *rpc.SketchProfile {
return &rpc.SketchProfile{
Name: p.Name,
Fqbn: p.FQBN,
Name: p.Name,
Fqbn: p.FQBN,
Programmer: p.Programmer,
}
}
......@@ -115,6 +122,9 @@ func (p *Profile) AsYaml() string {
res += fmt.Sprintf(" notes: %s\n", p.Notes)
}
res += fmt.Sprintf(" fqbn: %s\n", p.FQBN)
if p.Programmer != "" {
res += fmt.Sprintf(" programmer: %s\n", p.Programmer)
}
res += p.Platforms.AsYaml()
res += p.Libraries.AsYaml()
return res
......@@ -275,10 +285,11 @@ func LoadProjectFile(file *paths.Path) (*Project, error) {
return nil, err
}
return &Project{
Profiles: profiles,
DefaultProfile: raw.DefaultProfile,
DefaultFqbn: raw.DefaultFqbn,
DefaultPort: raw.DefaultPort,
DefaultProtocol: raw.DefaultProtocol,
Profiles: profiles,
DefaultProfile: raw.DefaultProfile,
DefaultFqbn: raw.DefaultFqbn,
DefaultPort: raw.DefaultPort,
DefaultProtocol: raw.DefaultProtocol,
DefaultProgrammer: raw.DefaultProgrammer,
}, nil
}
......@@ -246,6 +246,12 @@ func (s *Sketch) GetDefaultPortAddressAndProtocol() (string, string) {
return s.Project.DefaultPort, s.Project.DefaultProtocol
}
// GetDefaultProgrammer return the default Programmer for the sketch (from the sketch.yaml project file),
// ore the empty string if not set.
func (s *Sketch) GetDefaultProgrammer() string {
return s.Project.DefaultProgrammer
}
// SetDefaultFQBN sets the default FQBN for the sketch and saves it in the sketch.yaml project file.
func (s *Sketch) SetDefaultFQBN(fqbn string) error {
s.Project.DefaultFqbn = fqbn
......@@ -263,6 +269,12 @@ func (s *Sketch) SetDefaultPort(address, protocol string) error {
return updateOrAddYamlRootEntry(s.GetProjectPath(), "default_protocol", protocol)
}
// SetDefaultFQBN sets the default programmer for the sketch and saves it in the sketch.yaml project file.
func (s *Sketch) SetDefaultProgrammer(programmer string) error {
s.Project.DefaultProgrammer = programmer
return updateOrAddYamlRootEntry(s.GetProjectPath(), "default_programmer", programmer)
}
// InvalidSketchFolderNameError is returned when the sketch directory doesn't match the sketch name
type InvalidSketchFolderNameError struct {
SketchFolder *paths.Path
......@@ -290,15 +302,16 @@ func (s *Sketch) Hash() string {
func (s *Sketch) ToRpc() *rpc.Sketch {
defaultPort, defaultProtocol := s.GetDefaultPortAddressAndProtocol()
res := &rpc.Sketch{
MainFile: s.MainFile.String(),
LocationPath: s.FullPath.String(),
OtherSketchFiles: s.OtherSketchFiles.AsStrings(),
AdditionalFiles: s.AdditionalFiles.AsStrings(),
RootFolderFiles: s.RootFolderFiles.AsStrings(),
DefaultFqbn: s.GetDefaultFQBN(),
DefaultPort: defaultPort,
DefaultProtocol: defaultProtocol,
Profiles: f.Map(s.Project.Profiles, (*Profile).ToRpc),
MainFile: s.MainFile.String(),
LocationPath: s.FullPath.String(),
OtherSketchFiles: s.OtherSketchFiles.AsStrings(),
AdditionalFiles: s.AdditionalFiles.AsStrings(),
RootFolderFiles: s.RootFolderFiles.AsStrings(),
DefaultFqbn: s.GetDefaultFQBN(),
DefaultPort: defaultPort,
DefaultProtocol: defaultProtocol,
DefaultProgrammer: s.GetDefaultProgrammer(),
Profiles: f.Map(s.Project.Profiles, (*Profile).ToRpc),
}
if defaultProfile, err := s.GetProfile(s.Project.DefaultProfile); err == nil {
res.DefaultProfile = defaultProfile.ToRpc()
......
profiles:
nanorp:
fqbn: arduino:mbed_nano:nanorp2040connect
programmer: p1
platforms:
- platform: arduino:mbed_nano (2.1.0)
libraries:
......
......@@ -56,3 +56,8 @@ func (p *Programmer) String(inst *commands.Instance, fqbn string) string {
}
return details.GetDefaultProgrammerId()
}
// GetProgrammer returns the programmer specified by the user
func (p *Programmer) GetProgrammer() string {
return p.programmer
}
......@@ -30,35 +30,39 @@ import (
func initAttachCommand() *cobra.Command {
var port arguments.Port
var fqbn arguments.Fqbn
var programmer arguments.Programmer
attachCommand := &cobra.Command{
Use: fmt.Sprintf("attach [-p <%s>] [-b <%s>] [%s]", tr("port"), tr("FQBN"), tr("sketchPath")),
Use: fmt.Sprintf("attach [-p <%s>] [-b <%s>] [-P <%s>] [%s]", tr("port"), tr("FQBN"), tr("programmer"), tr("sketchPath")),
Short: tr("Attaches a sketch to a board."),
Long: tr("Sets the default values for port and FQBN. If no port or FQBN are specified, the current default port and FQBN are displayed."),
Long: tr("Sets the default values for port and FQBN. If no port, FQBN or programmer are specified, the current default port, FQBN and programmer are displayed."),
Example: " " + os.Args[0] + " board attach -p /dev/ttyACM0\n" +
" " + os.Args[0] + " board attach -p /dev/ttyACM0 HelloWorld\n" +
" " + os.Args[0] + " board attach -b arduino:samd:mkr1000",
" " + os.Args[0] + " board attach -b arduino:samd:mkr1000" +
" " + os.Args[0] + " board attach -P atmel_ice",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
sketchPath := ""
if len(args) > 0 {
sketchPath = args[0]
}
runAttachCommand(sketchPath, &port, fqbn.String())
runAttachCommand(sketchPath, &port, fqbn.String(), &programmer)
},
}
fqbn.AddToCommand(attachCommand)
port.AddToCommand(attachCommand)
programmer.AddToCommand(attachCommand)
return attachCommand
}
func runAttachCommand(path string, port *arguments.Port, fqbn string) {
func runAttachCommand(path string, port *arguments.Port, fqbn string, programmer *arguments.Programmer) {
sketchPath := arguments.InitSketchPath(path)
portAddress, portProtocol, _ := port.GetPortAddressAndProtocol(nil, "", "")
newDefaults, err := sketch.SetSketchDefaults(context.Background(), &rpc.SetSketchDefaultsRequest{
SketchPath: sketchPath.String(),
DefaultFqbn: fqbn,
DefaultProgrammer: programmer.GetProgrammer(),
DefaultPortAddress: portAddress,
DefaultPortProtocol: portProtocol,
})
......@@ -67,7 +71,8 @@ func runAttachCommand(path string, port *arguments.Port, fqbn string) {
}
res := &boardAttachResult{
Fqbn: newDefaults.GetDefaultFqbn(),
Fqbn: newDefaults.GetDefaultFqbn(),
Programmer: newDefaults.GetDefaultProgrammer(),
}
if newDefaults.GetDefaultPortAddress() != "" {
res.Port = &boardAttachPortResult{
......@@ -92,8 +97,9 @@ func (b *boardAttachPortResult) String() string {
}
type boardAttachResult struct {
Fqbn string `json:"fqbn,omitempty"`
Port *boardAttachPortResult `json:"port,omitempty"`
Fqbn string `json:"fqbn,omitempty"`
Programmer string `json:"programmer,omitempty"`
Port *boardAttachPortResult `json:"port,omitempty"`
}
func (b *boardAttachResult) Data() interface{} {
......@@ -101,10 +107,11 @@ func (b *boardAttachResult) Data() interface{} {
}
func (b *boardAttachResult) String() string {
if b.Port == nil && b.Fqbn == "" {
return tr("No default port or FQBN set")
if b.Port == nil && b.Fqbn == "" && b.Programmer == "" {
return tr("No default port, FQBN or programmer set")
}
res := fmt.Sprintf("%s: %s\n", tr("Default port set to"), b.Port)
res += fmt.Sprintf("%s: %s\n", tr("Default FQBN set to"), b.Fqbn)
res += fmt.Sprintf("%s: %s\n", tr("Default programmer set to"), b.Programmer)
return res
}
......@@ -268,6 +268,14 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
}
}
prog := profile.GetProgrammer()
if prog == "" || programmer.GetProgrammer() != "" {
prog = programmer.String(inst, fqbn)
}
if prog == "" {
prog = sk.GetDefaultProgrammer()
}
uploadRequest := &rpc.UploadRequest{
Instance: inst,
Fqbn: fqbn,
......@@ -276,7 +284,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
Verbose: verbose,
Verify: verify,
ImportDir: buildPath,
Programmer: programmer.String(inst, fqbn),
Programmer: prog,
UserFields: fields,
}
......
......@@ -43,6 +43,7 @@ func NewCommand() *cobra.Command {
var (
fqbnArg arguments.Fqbn
portArgs arguments.Port
profileArg arguments.Profile
interpreter string
importDir string
printInfo bool
......@@ -56,7 +57,7 @@ func NewCommand() *cobra.Command {
Example: " " + os.Args[0] + " debug -b arduino:samd:mkr1000 -P atmel_ice /home/user/Arduino/MySketch",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
runDebugCommand(args, &portArgs, &fqbnArg, interpreter, importDir, &programmer, printInfo)
runDebugCommand(args, &portArgs, &fqbnArg, interpreter, importDir, &programmer, printInfo, &profileArg)
},
}
......@@ -64,6 +65,7 @@ func NewCommand() *cobra.Command {
fqbnArg.AddToCommand(debugCommand)
portArgs.AddToCommand(debugCommand)
programmer.AddToCommand(debugCommand)
profileArg.AddToCommand(debugCommand)
debugCommand.Flags().StringVar(&interpreter, "interpreter", "console", tr("Debug interpreter e.g.: %s", "console, mi, mi1, mi2, mi3"))
debugCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries for debug."))
debugCommand.Flags().BoolVarP(&printInfo, "info", "I", false, tr("Show metadata about the debug session instead of starting the debugger."))
......@@ -72,8 +74,7 @@ func NewCommand() *cobra.Command {
}
func runDebugCommand(args []string, portArgs *arguments.Port, fqbnArg *arguments.Fqbn,
interpreter string, importDir string, programmer *arguments.Programmer, printInfo bool) {
instance := instance.CreateAndInit()
interpreter string, importDir string, programmer *arguments.Programmer, printInfo bool, profileArg *arguments.Profile) {
logrus.Info("Executing `arduino-cli debug`")
path := ""
......@@ -88,15 +89,37 @@ func runDebugCommand(args []string, portArgs *arguments.Port, fqbnArg *arguments
}
feedback.WarnAboutDeprecatedFiles(sk)
fqbn, port := arguments.CalculateFQBNAndPort(portArgs, fqbnArg, instance, sk.GetDefaultFqbn(), sk.GetDefaultPort(), sk.GetDefaultProtocol())
var inst *rpc.Instance
var profile *rpc.SketchProfile
if profileArg.Get() == "" {
inst, profile = instance.CreateAndInitWithProfile(sk.GetDefaultProfile().GetName(), sketchPath)
} else {
inst, profile = instance.CreateAndInitWithProfile(profileArg.Get(), sketchPath)
}
if fqbnArg.String() == "" {
fqbnArg.Set(profile.GetFqbn())
}
fqbn, port := arguments.CalculateFQBNAndPort(portArgs, fqbnArg, inst, sk.GetDefaultFqbn(), sk.GetDefaultPort(), sk.GetDefaultProtocol())
prog := profile.GetProgrammer()
if prog == "" || programmer.GetProgrammer() != "" {
prog = programmer.String(inst, fqbn)
}
if prog == "" {
prog = sk.GetDefaultProgrammer()
}
debugConfigRequested := &rpc.GetDebugConfigRequest{
Instance: instance,
Instance: inst,
Fqbn: fqbn,
SketchPath: sketchPath.String(),
Port: port,
Interpreter: interpreter,
ImportDir: importDir,
Programmer: programmer.String(instance, fqbn),
Programmer: prog,
}
if printInfo {
......
......@@ -176,6 +176,14 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) {
path = sketchPath.String()
}
prog := profile.GetProgrammer()
if prog == "" || programmer.GetProgrammer() != "" {
prog = programmer.String(inst, fqbn)
}
if prog == "" {
prog = sketch.GetDefaultProgrammer()
}
stdOut, stdErr, stdIOResult := feedback.OutputStreams()
req := &rpc.UploadRequest{
Instance: inst,
......@@ -186,7 +194,7 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) {
Verify: verify,
ImportFile: importFile,
ImportDir: importDir,
Programmer: programmer.String(inst, fqbn),
Programmer: prog,
DryRun: dryRun,
UserFields: fields,
}
......
......@@ -550,7 +550,7 @@ func TestBoardAttach(t *testing.T) {
sketchName := "BoardAttach"
sketchPath := cli.SketchbookDir().Join(sketchName)
sketchProjectFlie := sketchPath.Join("sketch.yaml")
sketchProjectFile := sketchPath.Join("sketch.yaml")
// Create a test sketch
_, _, err := cli.Run("sketch", "new", sketchPath.String())
......@@ -561,7 +561,7 @@ func TestBoardAttach(t *testing.T) {
require.NoError(t, err)
requirejson.Query(t, stdout, ".fqbn", `"arduino:avr:uno"`)
yamlData, err := sketchProjectFlie.ReadFile()
yamlData, err := sketchProjectFile.ReadFile()
require.NoError(t, err)
require.Contains(t, string(yamlData), "default_fqbn: arduino:avr:uno")
require.NotContains(t, string(yamlData), "default_port:")
......@@ -574,7 +574,7 @@ func TestBoardAttach(t *testing.T) {
requirejson.Query(t, stdout, ".port.address", `"/dev/ttyACM0"`)
requirejson.Query(t, stdout, ".port.protocol", `"serial"`)
yamlData, err := sketchProjectFlie.ReadFile()
yamlData, err := sketchProjectFile.ReadFile()
require.NoError(t, err)
require.Contains(t, string(yamlData), "default_fqbn: arduino:avr:uno")
require.Contains(t, string(yamlData), "default_port: /dev/ttyACM0")
......@@ -587,12 +587,27 @@ func TestBoardAttach(t *testing.T) {
requirejson.Query(t, stdout, ".port.address", `"/dev/ttyACM0"`)
requirejson.Query(t, stdout, ".port.protocol", `null`)
yamlData, err := sketchProjectFlie.ReadFile()
yamlData, err := sketchProjectFile.ReadFile()
require.NoError(t, err)
require.Contains(t, string(yamlData), "default_fqbn: arduino:avr:uno")
require.Contains(t, string(yamlData), "default_port: /dev/ttyACM0")
require.NotContains(t, string(yamlData), "default_protocol:")
}
{
stdout, _, err := cli.Run("board", "attach", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice", sketchPath.String(), "--format", "json")
require.NoError(t, err)
requirejson.Query(t, stdout, ".fqbn", `"arduino:samd:mkr1000"`)
requirejson.Query(t, stdout, ".programmer", `"atmel_ice"`)
requirejson.Query(t, stdout, ".port.address", `"/dev/ttyACM0"`)
requirejson.Query(t, stdout, ".port.protocol", `null`)
yamlData, err := sketchProjectFile.ReadFile()
require.NoError(t, err)
require.Contains(t, string(yamlData), "default_fqbn: arduino:samd:mkr1000")
require.Contains(t, string(yamlData), "default_programmer: atmel_ice")
require.Contains(t, string(yamlData), "default_port: /dev/ttyACM0")
require.NotContains(t, string(yamlData), "default_protocol:")
}
}
func TestBoardListWithFailedBuiltinInstallation(t *testing.T) {
......
......@@ -376,3 +376,22 @@ func testDebugCheck(t *testing.T, env *integrationtest.Environment, cli *integra
require.NoError(t, err)
requirejson.Contains(t, out, `{ "debugging_supported" : true, "debug_fqbn" : "my:samd:my6" }`)
}
func TestDebugProfile(t *testing.T) {
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
defer env.CleanUp()
// Init the environment explicitly
_, _, err := cli.Run("core", "update-index")
require.NoError(t, err)
sketchPath := cli.CopySketch("sketch_with_profile")
// Compile the sketch using the profile
_, _, err = cli.Run("compile", "--profile", "samd", sketchPath.String())
require.NoError(t, err)
// Debug using the profile
_, _, err = cli.Run("debug", "--profile", "samd", sketchPath.String(), "--info")
require.NoError(t, err)
}
......@@ -6,7 +6,16 @@ profiles:
avr2:
fqbn: arduino:avr:uno
programmer: atmel_ice
platforms:
- platform: arduino:avr (1.8.5)
libraries:
- Arduino_JSON (0.1.0)
samd:
fqbn: arduino:samd:mkr1000
programmer: atmel_ice
platforms:
- platform: arduino:samd (1.8.13)
libraries:
- Arduino_JSON (0.1.0)
......@@ -354,6 +354,8 @@ message SetSketchDefaultsRequest {
string default_port_address = 3;
// The desired value for default_protocol in project file (sketch.yaml)
string default_port_protocol = 4;
// The desired value for default_programmer in project file (sketch.yaml)
string default_programmer = 5;
}
message SetSketchDefaultsResponse {
......@@ -366,4 +368,7 @@ message SetSketchDefaultsResponse {
// The value of default_protocol that has been written in project file
// (sketch.yaml)
string default_port_protocol = 3;
// The value of default_programmer that has been written in project file
// (sketch.yaml)
string default_programmer = 4;
}
......@@ -1113,6 +1113,8 @@ type Sketch struct {
Profiles []*SketchProfile `protobuf:"bytes,9,rep,name=profiles,proto3" json:"profiles,omitempty"`
// Default profile set in the project file (sketch.yaml)
DefaultProfile *SketchProfile `protobuf:"bytes,10,opt,name=default_profile,json=defaultProfile,proto3" json:"default_profile,omitempty"`
// Default Programmer set in project file (sketch.yaml)
DefaultProgrammer string `protobuf:"bytes,11,opt,name=default_programmer,json=defaultProgrammer,proto3" json:"default_programmer,omitempty"`
}
func (x *Sketch) Reset() {
......@@ -1217,6 +1219,13 @@ func (x *Sketch) GetDefaultProfile() *SketchProfile {
return nil
}
func (x *Sketch) GetDefaultProgrammer() string {
if x != nil {
return x.DefaultProgrammer
}
return ""
}
type SketchProfile struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
......@@ -1226,6 +1235,8 @@ type SketchProfile struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// FQBN used by the profile
Fqbn string `protobuf:"bytes,2,opt,name=fqbn,proto3" json:"fqbn,omitempty"`
// Programmer used by the profile
Programmer string `protobuf:"bytes,3,opt,name=programmer,proto3" json:"programmer,omitempty"`
}
func (x *SketchProfile) Reset() {
......@@ -1274,6 +1285,13 @@ func (x *SketchProfile) GetFqbn() string {
return ""
}
func (x *SketchProfile) GetProgrammer() string {
if x != nil {
return x.Programmer
}
return ""
}
var File_cc_arduino_cli_commands_v1_common_proto protoreflect.FileDescriptor
var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{
......@@ -1410,7 +1428,7 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{
0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x65, 0x6c, 0x70, 0x52, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x22,
0xdb, 0x03, 0x0a, 0x06, 0x53, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
0x8a, 0x04, 0x0a, 0x06, 0x53, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
0x69, 0x6e, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d,
0x61, 0x69, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
......@@ -1439,16 +1457,21 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{
0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e,
0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e,
0x53, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0e, 0x64,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x37, 0x0a,
0x0d, 0x53, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64,
0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f,
0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x2d, 0x0a,
0x12, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d,
0x6d, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75,
0x6c, 0x74, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x22, 0x57, 0x0a, 0x0d,
0x53, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x66, 0x71, 0x62, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d,
0x6d, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x67, 0x72,
0x61, 0x6d, 0x6d, 0x65, 0x72, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75,
0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61,
0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
......
......@@ -201,6 +201,8 @@ message Sketch {
repeated SketchProfile profiles = 9;
// Default profile set in the project file (sketch.yaml)
SketchProfile default_profile = 10;
// Default Programmer set in project file (sketch.yaml)
string default_programmer = 11;
}
message SketchProfile {
......@@ -208,4 +210,6 @@ message SketchProfile {
string name = 1;
// FQBN used by the profile
string fqbn = 2;
// Programmer used by the profile
string programmer = 3;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment