kentindell / canhack

The Yes We CAN project of Canis Labs
MIT License
344 stars 64 forks source link

Issue with build a firmware.uf2 on a Pi 4 #18

Open DanielR92 opened 2 years ago

DanielR92 commented 2 years ago

Hello all,

I have trouble to build a firmware.uf2.
In the readme on the step 4 to make the build in the path "ports/rp2"

It says to me: /home/canhack/micropython/ports/rp2 (da4b38e75*) # make
[ -d build-PICO ] || cmake -S . -B build-PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=PICO make -s -C build-PICO make[1]: Es wurden keine Ziele angegeben und keine „make“-Steuerdatei gefunden. Schluss. make[1]: No targets were specified and no make control file was found. Ending. make: *** [Makefile:19: all] Fehler 2

Can somebody help me, or upload a firmware.uf2 for me?

Thanks :)

kentindell commented 2 years ago

Firstly, I've not tried to build MicroPython on a Raspberry Pi before. In theory it should be fine but I've not done it.

The first step is to build the upstream MicroPython source before you apply the firmware patches. If that fails then the problem is with your build environment. What does that result in?

DanielR92 commented 2 years ago

Sorry but I am new in python. And have no Idea how to compile on the pico.

But I think the problem is my environment what do you say.

kentindell commented 2 years ago

The MicroPython firmware is now pretty large and complex. So the first step is to build a clean MicroPython firmware build.

Try following the instructions in the README here:

https://github.com/kentindell/canhack/blob/master/pico/micropython/README.txt

Get the MicroPython repo cloned, and use the v1.18 release. If you can get steps 1-4 in the README done then you can build the MicroPython firmware.

DanielR92 commented 2 years ago

I already did this steps. See first post. But thanks for help. :)

kentindell commented 2 years ago

So that's a 'stock' MicroPython build that failed? It works on Ubuntu and even macOS (subject to compiler tools) so I'm a bit surprised it fails on the RPi.

Are all the normal build-essential tools installed on the RPi?

kentindell commented 2 years ago

Hmm, someone else seems have problems with this but fixed it by changing Rapsbian's language to English:

https://github.com/micropython/micropython/issues/4755

And also problems if the path lengths are too long:

https://forum.micropython.org/viewtopic.php?p=63991#p63991

Some people seem to get along fine on the RPi4, and others don't..

DanielR92 commented 2 years ago

I will check that, thanks for the hint! :)

DanielR92 commented 2 years ago

Ok I have a big issue with that. Have somebody a already running compiled of firmware.uf2 for me? Thanks :)

kentindell commented 2 years ago

Does firmware-220511.uf2 not work for you?

DanielR92 commented 2 years ago

I think not, because when I put in the Pico it restart and in the console it show me: MicroPython v1.19.1 on 2022-06-18; Raspberry Pi Pico with RP2040 Type "help()" for more information.

from rp2 import * c = CAN() Traceback (most recent call last): File "", line 1, in NameError: name 'CAN' isn't defined

kentindell commented 2 years ago

That's not the firmware in the repo: that looks like you've got the stock firmware on it.

DanielR92 commented 2 years ago

I have a fresh pico unpacked it and take the "firmware-20220511.uf2" in the "BOOTSEL" drive. After that it restart and I have a stock firmware on it. After that I put the python src/can2/ into the Pico.

But its not running. A simple question, exist a Howto how to run it easy? :)

thanks for help