prk_firmware icon indicating copy to clipboard operation
prk_firmware copied to clipboard

Builds via Docker will not load onto the microcontroller

Open rschenk opened this issue 2 years ago • 13 comments

When I download the most recent tagged release, 0.9.14 it works perfectly on my two Seeed XIAO RP2040 boards.

I am quite excited by PRK and interested in poking at the source (and hopefully sending in some pull requests!). I can successfully run the tests and build the latest few commits to master with the Docker image. Unfortunately, when I load the built uf2 file onto either of my boards, the board will not mount the PRKFirmware volume. Unfortunately it seems something is corrupted in the uf2? (Thankfully I can reboot the board back into bootsel mode and load the 0.9.14 firmware again.)

I am running a Mac with Intel Core i5 processor. Here's what I'm doing:

git checkout master
git pull master
rake deep_clean
docker compose build
docker compose run --rm prk rake setup
docker compose run --rm prk rake
# steep checks pass
# tests pass
# binaries are successfully built
# ...
# [100%] Linking CXX executable prk_firmware-0.9.14-20220629-d921fc5.elf
#   adding: prk_firmware-0.9.14-20220629-d921fc5.uf2 (deflated 73%)
# [100%] Built target prk_firmware-0.9.14-20220629-d921fc5

ls build
# ... lots of things ...
# prk_firmware-0.9.14-20220629-d921fc5.uf2

# 👉🔘 Reboot Seed XIAO RP2040 into bootsel mode
# Drag-and-drop flash_nuke.uf2 to /Volumes/RPI-RP2
# volume unmounts, then mounts again

# Drag-and-drop prk_firmware-0.9.14-20220629-d921fc5.uf2 onto the RPI-RP2 volume
# The volume unmounts and then nothing happens.

Please let me know if I can provide any other details. Thank you!

rschenk avatar Jun 29 '22 01:06 rschenk

@rschenk Seems you are right. A uf2 which I've just built on docker doesn't work, too. I totally can't figure out what is the reason so far. Investigating...

hasumikin avatar Jun 29 '22 07:06 hasumikin

I've worked to find related information on the internet for a couple of hours, but I couldn't. Please try to make the environment on the macOS host instead https://github.com/picoruby/prk_firmware/wiki/Building-a-binary#macos

hasumikin avatar Jun 29 '22 09:06 hasumikin

Thank you for investigating, I will set up a local build environment and report back. I've got a busy couple days but I'll try to fit it in when I can.

rschenk avatar Jun 29 '22 23:06 rschenk

Well, turns out I had more free time tonight than I anticipated. I was able to set up a development environment on my Mac, build a uf2 locally (without Docker) and it worked successfully!!

Not sure if this is helpful, but I also made a build via Docker, and while I am no expert, I can see the file sizes are rather different:

ls -l build_local/prk_firmware-0.9.14-20220629-d921fc5.uf2
-rw-r--r--  1 rschenk  staff  717312 Jun 29 21:12 build_local/prk_firmware-0.9.14-20220629-d921fc5.uf2

ls -l build_docker/prk_firmware-0.9.14-20220629-d921fc5.uf2
-rw-r--r--  1 rschenk  staff  714240 Jun 29 21:22 build_docker/prk_firmware-0.9.14-20220629-d921fc5.uf2

rschenk avatar Jun 30 '22 01:06 rschenk

I tested building PRK on debian buster (same to the docker image) on local machine, the built UF2 is working …..

yswallow avatar Jul 05 '22 02:07 yswallow

@yswallow What architecture and what OS you are using as the host computer?

hasumikin avatar Jul 15 '22 00:07 hasumikin

@hasumikin Debian buster on x86_64, and I did not use docker.

yswallow avatar Jul 15 '22 05:07 yswallow

Ah, ok, docker is still a suspect, then

As rschenk pointed out, I also saw some differences between the uf2 built by the host and the one built by docker. I still don't know what happened in docker

hasumikin avatar Jul 15 '22 06:07 hasumikin

Sorry for my poor expression. I want to say the problem may related on the docker application, and may not related on the guest OS.

yswallow avatar Jul 15 '22 06:07 yswallow

Sorry again, in my mistake, the ruby docker image is debian bullseye.

So I tested bullseye on my physical machine, the built UF2 Failed.

So this problem is related on the guest OS (and the packages).

To avoid this, use ruby:3.1.2-slim-buster docker image instead of ruby:3.1.2-slim image. (I tested ruby:3.1.2-slim-buster, and the built UF2 Works )

https://github.com/picoruby/prk_firmware/blob/91d43a2f7b25d3f40643bff6e79f96b61bb1ab4c/Dockerfile#L4

yswallow avatar Jul 16 '22 01:07 yswallow

@yswallow Using "slim-buster" also doesn't work for me...

hasumikin avatar Aug 03 '22 05:08 hasumikin

Oh... It reproduced on mine. I tested now, version 0.9.14 commit 91d43a was worked by using 3.1.2-slim-buster, but after 0.9.15 was not worked.

How about using Manjaro Linux image? https://github.com/yswallow/prk_firmware/blob/docker-manjaro/Dockerfile

yswallow avatar Aug 03 '22 08:08 yswallow

@yswallow Oh, it worked for me! Please send a PR to replace Dockerfile with it!!

(I think I want to fix the pico-sdk version like this:)

RUN git clone https://github.com/raspberrypi/pico-sdk.git

RUN git clone https://github.com/raspberrypi/pico-sdk.git -b 1.4.0

hasumikin avatar Aug 04 '22 00:08 hasumikin

Can this be closed?

yswallow avatar Aug 25 '22 00:08 yswallow

@yswallow Yes, I'm closing

hasumikin avatar Aug 25 '22 05:08 hasumikin