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 cannot upload to Circuit Playground Express using adafruit FQBN #47

Closed
sta-c0000 opened this issue Dec 9, 2019 · 11 comments

Comments

@sta-c0000
Copy link
Contributor

sta-c0000 commented Dec 9, 2019

arduino-cli cannot upload to Circuit Playground Express using FQBN (Fully Qualified Board Name) adafruit:samd:adafruit_circuitplayground_m0

Error reported:

Error during Upload: cannot execute upload tool: fork/exec {runtime.tools.bossac-1.7.0-arduino3.path}/bossac: no such file or directory

Upload works OK using FQBN arduino:samd:adafruit_circuitplayground_m0

Apologies, the differences between the two (adafruit vs arduino) FQBNs is not clear to me. I imagine this issue implies users should use the arduino FQBN, but then why is there an adafruit one? EDIT: required for certain features, see two posts below...

Thank you!

More information

$ arduino-cli version
arduino-cli Version: 0.6.0 Commit: 3a08b07

With following added to ~/.arduino15/arduino-cli.yaml (or can use param below):

board_manager:
  additional_urls:
    - https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
$ arduino-cli core update-index # --additional-urls "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"
Updating index: package_index.json downloaded
Updating index: package_index.json downloaded
Updating index: package_adafruit_index.json downloaded
$ arduino-cli core search Adafruit Circuit Playground Express
ID            Version Name
adafruit:samd 1.5.7   Adafruit SAMD Boards
arduino:samd  1.8.4   Arduino SAMD Boards (32-bits ARM Cortex-M0+)

$ arduino-cli core install adafruit:samd
$ arduino-cli core install arduino:samd

Compile works, but upload fails using adafruit:samd:adafruit_circuitplayground_m0

$ arduino-cli compile --fqbn adafruit:samd:adafruit_circuitplayground_m0 MyFirstSketch
Sketch uses 10412 bytes (3%) of program storage space. Maximum is 262144 bytes.
$ arduino-cli upload -p /dev/ttyACM0 --fqbn adafruit:samd:adafruit_circuitplayground_m0 MyFirstSketch
No new serial port detected.
Error during Upload: cannot execute upload tool: fork/exec {runtime.tools.bossac-1.7.0-arduino3.path}/bossac: no such file or directory

Compile and upload works using arduino:samd:adafruit_circuitplayground_m0

$ arduino-cli compile --fqbn arduino:samd:adafruit_circuitplayground_m0 MyFirstSketch
Sketch uses 11176 bytes (4%) of program storage space. Maximum is 262144 bytes.
$ arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:samd:adafruit_circuitplayground_m0 MyFirstSketch
No new serial port detected.
Atmel SMART device 0x10010005 found
Device       : ATSAMD21G18A
{...}  # ...redacted ...works```
@ladyada
Copy link
Member

ladyada commented Dec 9, 2019

hi, unknown why that's happening - we've had no complaints or issue with IDE users or with our travisCI script https://github.com/adafruit/travis-ci-arduino/blob/master/install.sh

@sta-c0000
Copy link
Contributor Author

I just noticed that certain features, like the Adafruit_NeoPixel_ZeroDMA library, will not work when compiling using --fqbn arduino:samd:adafruit_circuitplayground_m0; whereas they do work using the adafruit fqbn.

So I'm working around this issue by compiling with --fqbn adafruit:samd:adafruit_circuitplayground_m0, then using uf2conv.py to convert the .bin into a .uf2 to copy to the CPLAYBOOT USB mount.

@photomoose
Copy link

I can confirm this is also happening with an Adafruit Feather M0.

arduino-cli does not expand the properties for the upload tool - on my machine, the command that is being executed is:

"{runtime.tools.bossac-1.7.0-arduino3.path}/bossac"  --port=cu.usbmodem14301 -U true -i -e -w -v "test/test.adafruit.samd.adafruit_feather_m0.bin"

It looks like there is something wrong with the expansion of {runtime.tools.bossac-1.7.0-arduino3.path}.

@sta-c0000
Copy link
Contributor Author

Based on issue #22...

Tool versions specified in .arduino15/packages/adafruit/hardware/samd/1.5.7/platform.txt:

[...]
compiler.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
[...]
tools.bossac.path={runtime.tools.bossac-1.7.0-arduino3.path}
[...]
tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path}
[...]

...are out of sync with the 1.5.7 "toolsDependencies" versions specified in package_adafruit_index.json:

             {
              "packager": "arduino",
              "name": "arm-none-eabi-gcc",
              "version": "4.8.3-2014q1"
            },
            {
              "packager": "arduino",
              "name": "bossac",
              "version": "1.7.0"
            },
            {
              "packager": "arduino",
              "name": "openocd",
              "version": "0.9.0-arduino"
            },

Changing package_adafruit_index.json to match platform.txt does the trick:

            {
              "packager": "arduino",
              "name": "arm-none-eabi-gcc",
              "version": "7-2017q4"
            },
            {
              "packager": "arduino",
              "name": "bossac",
              "version": "1.7.0-arduino3"
            },
            {
              "packager": "arduino",
              "name": "openocd",
              "version": "0.10.0-arduino7"
            },

I tested and it works (but had to delete .arduino15/packages/ and re-install: arduino-cli core install adafruit:samd).

It appears it's important those two files have matching versions, but it's not clear to me how they are meant to be kept in sync in this repository? Manually?

@photomoose
Copy link

Thanks @sta-c0000 for finding the workaround - I spent an hour or so looking at these files and making changes but nothing took effect!

@themicp
Copy link

themicp commented Dec 25, 2019

Thanks @sta-c0000 for finding the workaround - I spent an hour or so looking at these files and making changes but nothing took effect!

After running arduino-cli core update-index you will find the downloaded package_adafruit_index.json file in the .arduino15/ folder. You can then make the changes @sta-c0000 suggested and retry uploading.

@sta-c0000
Copy link
Contributor Author

Hmmm, there's been two more versions generated since?...
I've just created PR#52 for bpt.ini so that at least future versions should have the correct toolsDependencies... hopefully.

I'll add that Initially I was only able to compile because I had also installed arduino:samd which has correct toolsDependencies and downloaded the correct compiler requested by adafruit:samd. Once package_adafruit_index.json is corrected, then you should be able to compile and upload without needing to also install arduino:samd ...saves disk space.

@ghost
Copy link

ghost commented Jan 24, 2020

I am having the same problem with my ItsyBitsym0. I am pretty new to this and I thought I would try the Arduino IDE. What I don't understand is that they share the same location for the board files (the arduino:samd and adafruit:samd I installed with the arduino-cli were detected) and the upload works fine in the GUI app and not in the CLI. So there may be a problem with the different versions of bossac in platform.txt and package_adafruit_index.json, but I don't understand how it would work fine in the IDE and not the cli if it was the only problem.

Anyway, I don't really undersand all this yet and there is probably a good explanation for it, but I find it a bit odd.

@ladyada
Copy link
Member

ladyada commented Jan 24, 2020

its def possible to use the CLI for itsym0 - we use it in our actions CI
https://github.com/adafruit/ci-arduino/blob/master/build_platform.py

@ghost
Copy link

ghost commented Jan 24, 2020

Yeah well, everything compiles fine. It's only the upload that doesn't work with the same Error during Upload: cannot execute upload tool: fork/exec {runtime.tools.bossac-1.7.0-arduino3.path}/bossac: no such file or directory error.

I simply thought it was strange that the issue only affects the cli and not the ide. I guess that the ide does things differently somehow. I thought the ide only used the arduino-cli behind the scenes, but it looks like it's not that simple 😐

Hopefully the pr #52 will fix it 😃

@sta-c0000
Copy link
Contributor Author

Closing, Thanks! Works since 1.5.11 package_adafruit_index.json now that it is in sync with Adafruit's SAMD platform.txt. And we no longer need to also install arduino:samd.

Note (to users) that it is easiest to add the file ~/.arduino15/arduino-cli.yaml with the contents:

board_manager:
  additional_urls:
    - https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

...otherwise you would need to add the following parameter for most arduino-cli commands, including upload:

 arduino-cli [commands] --additional-urls "https://adafruit.github.io/arduino-board-index/package_adafruit_index.json"

So, from scratch (assuming you've created ~/.arduino15/arduino-cli.yaml):

$ arduino-cli core update-index
$ arduino-cli core install adafruit:samd
$ arduino-cli board list # (= list connected; listall = all known)
# using fqbn and port from above command, to compile and upload:
$ arduino-cli compile --fqbn {fqbn} MyFirstSketch
$ arduino-cli upload -p {port} --fqbn {fqbn} MyFirstSketch

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

4 participants