Guide for setting up C SDK and running hello_usb.c example for RP2040 on 2018 Macbook Pro (13-inch, i5) macOS Monterey (version 12.6)
Used the instructions in the guide https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf in section 9.1.1 for installing the toolchain Install homebrew and toolchain $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ brew install cmake $ brew tap ArmMbed/homebrew-formulae $ brew install arm-none-eabi-gcc
Note - This is not required for the C SDK setup but helps if you want to modify/create your own code. I had this program installed already but you can install it from https://code.visualstudio.com/download
The guide gives us steps how to run the pico examples mentioned at this repository https://github.com/raspberrypi/pico-examples After installing the toolchain follow step 3 in the guide
$ cd ~/ $ mkdir pico $ cd pico
$ git clone -b master https://github.com/raspberrypi/pico-sdk.git $ cd pico-sdk $ git submodule update --init $ cd .. $ git clone -b master https://github.com/raspberrypi/pico-examples.git
$ cd pico-examples $ mkdir build $ cd build
$ export PICO_SDK_PATH=../../pico-sdk $ cmake ..
This will create a build directory inside pico-examples with the necessary cmake files
go to directrory hello_world (this is where usb -> hello_usb.c code is)
$ cd hello_world $ make -j4
This will create a bunch of files in usb and serial folders (.elf, .uf2 files etc) .uf2 file is the one that can be drag and dropped on the USB mountable RP2040
This step is important because we need to put the board into storage mode. To do this we can connect the board through a usb port. Hold down the boot button and press reset button. You can now see the board as RPI/RP2 device. Drag and drop the .uf2 file on the RPI/RP2 board. The board will unmount(eject) itself and start running the code.
I used screen as the serial console so I will put instructions to connect to that. First find your device name by using the following command
$ ls /dev/tty.*
For example my board looks like this
then use the following command to connect to the serial console at 115200 baud rate $ screen /dev/tty.usbmodem144101 115200