sparkfun / Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
83 stars 37 forks source link

permission denied uploading on linux #309

Closed jerabaul29 closed 3 years ago

jerabaul29 commented 3 years ago

Hi,

I get some denied permission errors when trying to upload successfully compiled sketches to an Apollo Red board on Linux (Ubuntu 20.04). I wonder if there may be some need to updates some udev rules? Any idea on this?

Thanks :)

jerabaul29 commented 3 years ago

(sorry, I think the true name is Artemis red board; anyways, this one:

https://www.sparkfun.com/products/15444

jerabaul29 commented 3 years ago

I tried to fix the access, but still not working. At the moment:

~$ ls -l /dev/ttyUSB0 
crw-rw---- 1 root dialout 188, 0 des.  11 13:35 /dev/ttyUSB0
~$ whoami
jrmet
~$ groups jrmet
jrmet : jrmet adm dialout cdrom sudo dip plugdev lpadmin lxd sambashare

So I would guess writing access should be ok (?), but I still get the error:

Sketch uses 118300 bytes (12%) of program storage space. Maximum is 983040 bytes.
Global variables use 27712 bytes (7%) of dynamic memory, leaving 365504 bytes for local variables. Maximum is 393216 bytes.
/home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/tools/uploaders/asb/dist/linux/asb --bin /tmp/arduino_build_439098/Threads.ino.bin --load-address-blob 0x20000 --magic-num 0xCB -o /tmp/arduino_build_439098/Threads.ino --version 0x0 --load-address-wired 0xC000 -i 6 --options 0x1 -b 115200 -port /dev/ttyUSB0 -r 2 -v 
java.io.IOException: Cannot run program "/home/jrmet/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/tools/uploaders/asb/dist/linux/asb": error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at java.lang.Runtime.exec(Runtime.java:485)
    at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
    at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
    at cc.arduino.packages.uploaders.SerialUploader.runCommand(SerialUploader.java:383)
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:197)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
    at processing.app.SketchController.upload(SketchController.java:732)
    at processing.app.SketchController.exportApplet(SketchController.java:703)
    at processing.app.Editor$UploadHandler.run(Editor.java:2055)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
    at java.lang.ProcessImpl.start(ProcessImpl.java:134)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 11 more
An error occurred while uploading the sketch
jerabaul29 commented 3 years ago

Ok, after some more debugging, the problem was that the program in charge of uploading the firmware did not have execution rights. I did:

~/.arduino15/packages/SparkFun/hardware/apollo3/2.0.3/tools/uploaders/asb/dist/linux$ chmod +x asb

and now it seems to be able to (try to) upload.

jerabaul29 commented 3 years ago

Do you think there is a way to update the rights on the asb utility installed by the board manager in linux? :)

oclyke commented 3 years ago

@jerabaul29 thanks for reporting this. we will correct the file permissions. please respond here if you find any more related issues.

@Wenn0101 we should investigate what happens to file permissions in and between these steps:

jerabaul29 commented 3 years ago

I updated to 2.0.5 today. The issue is still here (it even came back when the non-executable uploader replaced the old uploader that I had made executable).

Nothing bad for me to fix, just a small chmod +x, but for less experienced users this may be a hazzle.

oclyke commented 3 years ago

hit the same issue on fresh install of v2.0.5 (macOS) seems that the PRs for a possible fix were approved but never merged:

@Wenn0101 when you merge these PRs they will trigger a re-build of the tools. the new tools will be merged into the main branch automatically (I think - you should double check). when that is complete you'll need to update the submodules used in this core so that the latest tools are pulled in.