#=================================================================== # using C compilers for RaspberryPi Pico microcontroller images #=================================================================== After getting and unpacking the pico SDK and the cross-compiler for ARM, as detailed further below, the following can be done to compile a program for the Pico board. # environment BASE=/opt/rpi_pico_sdk export PICO_TOOLCHAIN_PATH=$BASE/arm-gnu-toolchain/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi export PICO_SDK_PATH=$BASE/pico-sdk # new build-dir BUILDPLACE=$HOME/build_pico mkdir -pv $BUILDPLACE cd $BUILDPLACE cp -v $BASE/pico-examples/{CMakeLists.txt,pico_sdk_import.cmake,pico_extras_import_optional.cmake,example_auto_set_url.cmake} . cp -av $BASE/pico-examples/blink . vi CMakeLists.txt # remove other projects than 'blink' .. e.g. hello world, and all in the list at the end mkdir build cd build cmake .. cd blink/ make -j4 # or into subdir and make for that one specifically #--------------------------------------------------------------- # to load to the microprocessor board # connect rpi pico board to computer by usb while holding its BOOTSEL button down, then release # this should cause it to start by presenting a ~130 MB usb storage device e.g. "/dev/sdb1" mount -t vfat -o rw /dev/sdb1 /mnt cp $BUILDPLACE/build/blink/blink.uf2 /mnt/ # now it will stop being like a usb storage device, and the unmount will (probably) happen automatically #--------------------------------------------------------------- #=================================================================== # about the initial file-getting and setup #=================================================================== BASE=/opt/rpi_pico_sdk mkdir $BASE cd $BASE #--------------------------------------------------------------- ## get the gnu ARM toolchain, version for running on our architecture (x86_64) mkdir arm-gnu-toolchain cd arm-gnu-toolchain wget 'https://developer.arm.com/-/media/Files/downloads/gnu/12.2.mpacbti-rel1/binrel/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi.tar.xz?rev=71e595a1f2b6457bab9242bc4a40db90&hash=41B9EE53CF6E77F7F0647767EC481951' -O arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi.tar.xz xzcat