Panda381 / PicoLibSDK

Alternative extended C/C++ SDK library for Raspberry Pico and RP2040.
26 stars 7 forks source link

Compiling on macOS? #4

Closed shreeve closed 7 months ago

shreeve commented 7 months ago

This project looks really incredible! Great job!

I am on macOS and would like to compile and test this out.

I followed the readme for Linux and made the shell scripts executable and I was able to compile the example in PicoLibSDK/Pico/USB/Hello.

The compilation died right at the end, because I don't have the LoaderCrc executable on macOS. Here's the message:

... lots of compilation output here ...

CC ../../../_devices/picopad/picopad_led.c
CC ../../../_devices/picopad/picopad_init.c
CC ../../../_devices/picopad/picopad_ss.c
C++ src/main.cpp
ld build/Hello.elf
bin Hello.bin
hex Hello.hex
lst Hello.lst
sym Hello.sym
siz Hello.siz
uf2 Hello.uf2

   text    data     bss     dec     hex filename
  61524       0  156684  218208   35460 build/Hello.elf
../../../_c1.sh: line 94: ../../../_tools/PicoPadLoaderCrc/LoaderCrc: No such file or directory
ERROR!
09:20:26 PicoLibSDK/Pico/USB/Hello> ....

However, in the generated files, I do see that there is build/Hello.elf file and also a ./Hello.uf2 file. I assume that the .uf2 file is missing CRC information, which would normalled be added by LoaderCrc. I tried the following:

Do you have any suggestions on other ways I could get the compiled Hello example to my Pico?

Thanks!

Panda381 commented 7 months ago

The listing shows that the program is compiled for the PicoPad device and not for the Pico (according to the lines .._devices/picopad..). The PicoPad device uses a checksum because of the program loader from the SD card, which verifies that the program is correctly loaded in memory. This checksum is not needed for the Pico device. If you want to compile a program for Pico, you must specify pico as a parameter of the c.sh startup script (see c.bat). Another option is to modify the _setup.sh configuration script for the default device - in "case" set the parameters for the default case *) according to the variant for "pico" - in this case the compilation always takes place for "pico" and there is no need to specify the parameter in c.sh.

I would like to point out that the USB library in PicoLibSDK is very different from the USB library in the original SDK. On the one hand it is faster, it works in a different way. But on the other hand, it doesn't include as many devices as the original SDK - for example, the USB Hub handling is missing for now.

shreeve commented 7 months ago

@Panda381 - Excellent! I made a few updates, per your message and it works! Thank you!