Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce the --input-file flag for the upload command #777

Merged
merged 16 commits into from
Sep 7, 2020

Conversation

rsora
Copy link
Contributor

@rsora rsora commented Jul 3, 2020

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • The PR follows our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce?

This PR reintroduces the -i --input-file flag for the upload command, allowing to upload a single binary, according to the core recipe

  • What is the current behavior?

You cannot specify a single binary file for the upload

  • What is the new behavior?

This command allows the user to upload a specific pre-built binary

arduino-cli upload -b arduino:samd:mkrwifi1010 -p /dev/ttyACM1 --input-file foo.ino.bin
  • Does this PR introduce a breaking change?

Reintroduces the flag that was deprecated in the last release (0.11.0)

  • Other information:

Please note that the sketch binary extension (.bin in my example above) passed as the --input-file value will be ignored, because the file extension for the binary files is explicity set at the core recipe level for each board.

See for example here for the arduino:samd:mkrwifi1010 board upload recipe, that the .bin file is set explicitly:

tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R


See how to contribute

Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some inline requests.

The business logic is OK.

commands/upload/upload.go Outdated Show resolved Hide resolved
cli/upload/upload.go Outdated Show resolved Hide resolved
cli/upload/upload.go Outdated Show resolved Hide resolved
@cmaglie cmaglie force-pushed the rsora/upload-binfile branch 3 times, most recently from 25aab3a to c8b36e5 Compare September 7, 2020 10:59
@cmaglie cmaglie force-pushed the rsora/upload-binfile branch from c8b36e5 to f2c4839 Compare September 7, 2020 11:23
@cmaglie
Copy link
Member

cmaglie commented Sep 7, 2020

Ok, this one looked easy at a first glance but ended up being very complicated.
We basically have 4 flags to handle:

  • --input-dir specified or not
  • --input-file specified or not
  • path of the sketch specified or not
  • running the CLI from a sketch folder or not
--input-dir --input-file sketch run in sketch dir output
N N N N error: no sketch found
Y N N N OK
N Y N N OK
Y Y N N error: --input-file and --input-dir flags cannot be used together
N N Y N OK
Y N Y N OK, use --input-dir, sketch ignored
N Y Y N OK, use --input-file, sketch ignored
Y Y Y N error: --input-file and --input-dir flags cannot be used together
N N N Y OK
Y N N Y OK, use --input-dir, sketch ignored
N Y N Y OK, use --input-file, sketch ignored
Y Y N Y error: --input-file and --input-dir flags cannot be used together
N N Y Y OK, use the sketch specified via command line
Y N Y Y OK, use --input-dir, sketch ignored
N Y Y Y OK, use --input-file, sketch ignored
Y Y Y Y error: --input-file and --input-dir flags cannot be used together

Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto-approving my changes :-)

Copy link

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested both with programmer and bootloader
worked as expected

@cmaglie cmaglie merged commit f1877ef into master Sep 7, 2020
@cmaglie cmaglie deleted the rsora/upload-binfile branch September 7, 2020 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants