Distro: Fedora 31
tinygo version: 0.11.0
$ ls -al /dev/ttyACM0
crw-rw----. 1 root dialout 166, 0 Mar 14 2020 /dev/ttyACM0
$ groups
my_username wheel dialout docker
$ tinygo flash -target=pybadge main.go
error: failed to flash /tmp/tinygo_xxxxxx_/main.uf2: unable to locate UF2 device: PYBADGEBOOT
$ id -a
uid=_xxxx_(my_username) gid=_xxxx_(my_username) groups=_xxxx_(my_username),10(wheel),_xx_(dialout),971(docker) context=unconfined_(etc. etc.)
I've also tried:
$ tinygo flash -port=/dev/ttyACM0 -target=pybadge main.go
However...
I can easily copy UF2 files directly to the PYBADGEBOOT over USB with no issues.
How can I get tinygo flashing to work on Fedora 31?
What is the location of the PYBADGEBOOT directory? You can get it with the mount command. On Debian it's usually /home/<username>/PYBADGEBOOT.
As a temporary workaround, you can write it manually to the device. For example:
tinygo build -o /media/$USER/PYBADGEBOOT/firmware.uf2 -target=pybadge main.go
The location of this drive on Fedora is not the same as Debians. We ran into this exact problem recently at our workshop at SCaLE.
I think someone was going to submit a PR that added the correct path.
What is the location of the PYBADGEBOOT directory? You can get it with the
mountcommand. On Debian it's usually/home/<username>/PYBADGEBOOT.
According to the Files app, the directory is:
/run/media/(my_username)/PYBADGEBOOT
Thanks @aykevl !
As a temporary workaround, you can write it manually to the device. For example:
tinygo build -o /media/$USER/PYBADGEBOOT/firmware.uf2 -target=pybadge main.go
This workaround appears to work (note the path below):
tinygo build -o /run/media/$USER/PYBADGEBOOT/firmware.uf2 -target=pybadge main.go
The location of this drive on Fedora is not the same as Debians. We ran into this exact problem recently at our workshop at SCaLE.
I think someone was going to submit a PR that added the correct path.
@deadprogram : Does the PR need to be submitted here or somewhere at Fedora? This looks like a tinygo building / flash issue. Does issue 954 serve as notice? :)
Not sure if this related, but I get this new error trying to flash the name badge code:
$ tinygo build -o /run/media/$USER/PYBADGEBOOT/firmware.uf2 -target=pybadge main.go
main.go:25:22: SPI1_MISO_PIN not declared by package machine
Changing the code from MISO to MIS0 doesn't appear to help....
EDIT: I'm finding commenting that line by prepending a "//" (no quotes) appears to get the ball rolling. Yay!
Regarding the path to the badge for flashing, that would be a PR here, please.
Regarding the SPI1 compile error, which program are you trying to build?
The relevant code is here if you want to make a PR: https://github.com/tinygo-org/tinygo/blob/master/main.go#L483
It locates the correct path simply by globbing at a well-known location (that unfortunately varies between distros).
Most helpful comment
As a temporary workaround, you can write it manually to the device. For example: