Name: Yuan Chi
Setup environment: 2019 MacBook Air 13-inch, MacOS Monterey 12.6
Processor: 1.6 GHz Intel Core i5
Memory: 8 GB 2133 MHz LPDDR3
$ /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
Cd Document
Mdkir 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
https://code.visualstudio.com/download
Type Cmd+shift+X and search for "CMake Tools";
Click on the entry in the list;
Click on the install button;
Navigate to the pico-examples directory;
Create a .vscode directory and add a file called settings.json;
Copy these lines to settings.json;
{
"cmake.environment": {
"PICO_SDK_PATH": "../../pico-sdk"
},
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
Click on the Cog Wheel at the bottom of the navigation bar on the left-hand side of the interface and select "Settings";
Click on the "Extensions" and "CMake Tools configuration";
Scroll down to " Cmake: Generator: and enter " Unix Makefiles" into the box;
Go to the File menu and click on "Add Folder to Workspace..." and navigate to pico-examples repo and click "Okay";
Select "GCC for arm-none-eabi" for compiler";
Solution:
Setting an environment variable through CMake tools in VSCode;
Cd into pico-examples and create a build directory:
$ cd pico-examples
$ mkdir build
$ cd build
Set the Pico_SDK_PATH (If clone pico-sdk and pico-examples repositories into the same directory side-by-side):
$ export PICO_SDK_PATH=../../pico-sdk
Prepare cmake build directory by running cmake..:
$ cmake ..
Change directory into the "hello_world" directory inside the "pico-examples/build" tree, and run make:
$ cd hello_world
$ make -j4
Amongst other targets, we have now built:
• serial/hello_serial.elf, which is used by the debugger
• serial/hello_serial.uf2, which can be dragged onto the RP2040 USB Mass Storage Device (UART serial binary)
• usb/hello_usb.elf, which is used by the debugger
• usb/hello_usb.uf2, which can be dragged onto the RP2040 USB Mass Storage Device (USB serial binary)
Where hello_serial directs stdio to UART0 on pins GP0 and GP1, and hello_usb directs stdio to USB CDC serial.
Connect the laptop to Raspberry Pi using a micro-USB cable;
Hold down the "root" button and press "reset" button at the same time;
Push "hello_usb.uf2" in Raspberry Pi;
Enter the console:
$ ls /dev/tty.*
$ screen /dev/tty.board_name 115200