The Wayback Machine - https://web.archive.org/web/20220603205233/https://github.com/tinygo-org/tinygo/issues/954
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

flash: unable to flash UF2 device using Fedora #954

Open
perryrivera opened this issue Mar 14, 2020 · 15 comments
Open

flash: unable to flash UF2 device using Fedora #954

perryrivera opened this issue Mar 14, 2020 · 15 comments
Labels
bug good first issue

Comments

@perryrivera
Copy link

@perryrivera perryrivera commented Mar 14, 2020

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?

@aykevl
Copy link
Member

@aykevl aykevl commented Mar 14, 2020

What is the location of the PYBADGEBOOT directory? You can get it with the mount command. On Debian it's usually /home/<username>/PYBADGEBOOT.

@aykevl
Copy link
Member

@aykevl aykevl commented Mar 14, 2020

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

@deadprogram
Copy link
Member

@deadprogram deadprogram commented Mar 14, 2020

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.

@perryrivera
Copy link
Author

@perryrivera perryrivera commented Mar 15, 2020

What is the location of the PYBADGEBOOT directory? You can get it with the mount command. On Debian it's usually /home/<username>/PYBADGEBOOT.

According to the Files app, the directory is:
/run/media/(my_username)/PYBADGEBOOT

@perryrivera
Copy link
Author

@perryrivera perryrivera commented Mar 15, 2020

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

@perryrivera
Copy link
Author

@perryrivera perryrivera commented Mar 15, 2020

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? :)

@perryrivera
Copy link
Author

@perryrivera perryrivera commented Mar 15, 2020

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

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!

@deadprogram
Copy link
Member

@deadprogram deadprogram commented Mar 16, 2020

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?

@deadprogram deadprogram added the bug label Mar 16, 2020
@aykevl
Copy link
Member

@aykevl aykevl commented Mar 18, 2020

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).

@deadprogram deadprogram changed the title error: failed to flash // unable to locate UF2 device: PYBADGEBOOT flash: unable to flash UF2 device using Fedora Jun 11, 2020
@Arsen6331
Copy link
Contributor

@Arsen6331 Arsen6331 commented Dec 23, 2021

Experiencing the same issue on Arch. The path for drives on Arch is /run/media/<user>/<drive name>.

@Arsen6331
Copy link
Contributor

@Arsen6331 Arsen6331 commented Dec 23, 2021

Another workaround is creating a symlink, like so: sudo ln -s /run/media/$USER /media/$USER. After this, tinygo flash should just work.

@aykevl
Copy link
Member

@aykevl aykevl commented Dec 28, 2021

Is there someone who would make a PR to fix this? The relevant code is here:

tinygo/main.go

Lines 498 to 499 in a9ba6eb

case "linux", "freebsd":
infoPath = "/media/*/" + volume + "/INFO_UF2.TXT"

It doesn't need any special knowledge, but is much easier done when you're actually running Fedora or Arch (which I don't).

@aykevl aykevl added the good first issue label Dec 28, 2021
@Arsen6331
Copy link
Contributor

@Arsen6331 Arsen6331 commented Dec 28, 2021

I will try to make a PR. Should be ready soon if I don't encounter any issues.

@Arsen6331
Copy link
Contributor

@Arsen6331 Arsen6331 commented Dec 29, 2021

I've just created a PR that seems to fix it. Only tested on Arch, not Fedora or Debian.

@Arsen6331
Copy link
Contributor

@Arsen6331 Arsen6331 commented Dec 29, 2021

I accidentally made my previous PR against release. Sorry about that. Anyway, I've created a new PR and changed it to work with pre-1.16 versions. If someone could look at it, and test it on Debian and Fedora, that would be much appreciated. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue
Projects
None yet
Development

No branches or pull requests

4 participants