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

arduino-cli upload -i flag removed #764

Closed
janjongboom opened this issue Jun 25, 2020 · 4 comments
Closed

arduino-cli upload -i flag removed #764

janjongboom opened this issue Jun 25, 2020 · 4 comments
Assignees

Comments

@janjongboom
Copy link

Bug Report

Current behavior

We currently upload via e.g.:

$ arduino-cli upload -p /dev/cu.usbmodem401101 --fqbn arduino:mbed:nano33ble -i path-to-our.bin

This no longer works in v0.11. This is a breaking change for us and I do not see any alternatives for specifying the bin file in the latest docs. Is there any way to achieve the same behavior? We use the Arduino CLI to flash prebuilt binaries, not sketches.

Environment

  • CLI version (output of arduino-cli version): arduino-cli Version: 0.11.0 Commit: 0296f4d
  • OS and platform: macOS Catalina

Additional context

@rsora
Copy link
Contributor

rsora commented Jun 26, 2020

Hi @janjongboom, thanks for the heads up!
In 0.11.0 with #687, we changed the way the CLI manages the binary artifacts.

Can you try the --input-dir flag and tell us if it works for your use case?

If not, can you give us more context on your issue?

@janjongboom
Copy link
Author

@rsora --input-dir does not work either, as it requires the .bin file to be named foldername.ino.bin. Users download this as a ZIP file and we have no control what the name of the folder where they extract this binary is.

@cmaglie
Copy link
Member

cmaglie commented Jun 26, 2020

@janjongboom I see that your usecase is a good one and is now lacking support, we'll reintroduce the --input-file flag to perform "upload without the sketch". We're are going to make another release soon, I'll try to strech a fix for this one.

For completeness, the current compile/upload flow is meant to be something like:

# sketch directory
$ find ~/Arduino/Blink/
/home/cmaglie/Arduino/Blink/
/home/cmaglie/Arduino/Blink/Blink.ino


# compile using the default build path (inside the sketch)
$ arduino-cli compile ~/Arduino/Blink -b arduino:samd:mkr1000
Sketch uses 11236 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2384 bytes of dynamic memory.

$ find ~/Arduino/Blink/
/home/cmaglie/Arduino/Blink/
/home/cmaglie/Arduino/Blink/build
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000/Blink.ino.map
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000/Blink.ino.hex
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000/Blink.ino.elf
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000/Blink.ino.bin
/home/cmaglie/Arduino/Blink/build/arduino.samd.mkr1000/Blink.ino.with_bootloader.hex
/home/cmaglie/Arduino/Blink/Blink.ino


# compile with custom build path (--output-dir)
$ arduino-cli compile ~/Arduino/Blink -b arduino:samd:mkr1000 --output-dir mybuild
Sketch uses 11236 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2384 bytes of dynamic memory.

$ find mybuild
mybuild
mybuild/Blink.ino.map
mybuild/Blink.ino.with_bootloader.bin
mybuild/Blink.ino.hex
mybuild/Blink.ino.elf
mybuild/Blink.ino.bin
mybuild/Blink.ino.with_bootloader.hex


# upload from custom build path (--input-dir)
$ arduino-cli upload ~/Arduino/Blink -b arduino:samd:mkr1000 --input-dir mybuild -p /dev/ttyACM0
Waiting for upload port...
No new serial port detected.
No device found on ttyACM0

so we replaced the pair --output-file / --input-file with --output-dir / --input-dir because some platforms produces more than one artifact out of the build that is required for upload (for example a .bin to upload via USB-DFU and a .zip to push via bootloader...), so we had to replace the "file" with a "dir".

@cmaglie cmaglie self-assigned this Jun 26, 2020
@cmaglie cmaglie added this to the 0.12.0 milestone Jun 26, 2020
cmaglie added a commit that referenced this issue Sep 7, 2020
This should make the upload command compatibile with all the reasonable
usages.

See #764
See #641
cmaglie added a commit that referenced this issue Sep 7, 2020
This should make the upload command compatibile with all the reasonable
usages.

See #764
See #641
cmaglie added a commit that referenced this issue Sep 7, 2020
* Remove deprecation from importFile param

* Implement --input-file flag

* Add comment in --input-file splitting step

* Add e2e test for --input-x flags

* Refine upload flags testing

* Add --input-file file existence check

* Use TrimSuffix instead of replace

* Restore -i shorthand flag for --input-file and add CLI checkFlagsConflicts function

* Improved build path and project name auto-detection

This should make the upload command compatibile with all the reasonable
usages.

See #764
See #641

* Made UploadTest more resilient

* upload: sketch is ignored if input-dir or input-file is specified

There is no point in overriding the sketch name if the user explicitly
give it via command line.

* Update go-paths-helper to version 1.3.2

fixes EquivalentTo when used with abs paths

* fix TestGetCommandLine

* 100% coverage on detectSketchNameFromBuildPath function

* Do not git-ignore all *.bin but just inside the client_example folder

* slightly simplified function signature (cosmetic)

Co-authored-by: Cristian Maglie <c.maglie@arduino.cc>
@cmaglie
Copy link
Member

cmaglie commented Sep 14, 2020

@janjongboom
we reintroduced the flag in 0.13.0, would you like to give it a try?

@cmaglie cmaglie modified the milestones: 0.12.0, 0.13.0 Sep 14, 2020
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

No branches or pull requests

3 participants