picoruby/prk_firmware

Builds via Docker will not load onto the microcontroller

rschenk opened this issue ยท 15 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 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...

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

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.

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

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

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

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

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

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.

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 )

FROM --platform=amd64 ruby:3.1.2-slim AS build

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

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

Can this be closed?

@yswallow Yes, I'm closing