•
At the same level as the pico-examples folder, create a new folder, for example pico-examples-eclipse
•
Change directory to that folder
•
Set the path to the PICO_SDK_PATH
$ export PICO_SDK_PATH=<wherever>
•
On the command line enter:
$ cmake -G"Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../pico-examples
IMPORTANT
The SDK builds binaries for the Raspberry Pi Pico by default. To build a binary for a different board, pass the
-DPICO_BOARD=<board> option to CMake, replacing the <board> placeholder with the name of the board you’d like to
target. To build a binary for Pico 2, pass -DPICO_BOARD=pico2. To build a binary for Pico W, pass -DPICO_BOARD=pico_w. To
specify a Wi-Fi network and password that your Pico W should connect to, pass -DWIFI_SSID="Your Network"
-DWIFI_PASSWORD="Your Password".
This will create the Eclipse project files in our pico-examples-eclipse folder, using the source from the original CMake
tree.
You can now load your new project files into Eclipse using the Open project From File System option in the File menu.
Building
Right click on the project in the project explorer, and select Build. This will build all the examples.
OpenOCD
This example uses the OpenOCD system to communicate with a Raspberry Pi microcontroller. You will need to have
provided the 2-wire debug connections from the host device to the microcontroller prior to running the code. On a
Raspberry Pi, this can be done via GPIO connections, but on a laptop or desktop device, you need to use extra hardware
for this connection. One way is to use the Debug Probe.
Once OpenOCD is installed and the correct connection made, Eclipse needs to be set up to talk to OpenOCD when
programs are run. OpenOCD provides a GDB interface to Eclipse, and it is that interface that is used when debugging.
To set up the OpenOCD system, select Preferences from the Window menu.
Click on MCU arrow to expand the options and click on Global OpenOCD path.
For the executable, type in “openocd”. For the folder, select the location in the file system where you have cloned the
Pico OpenOCD fork from github.
Getting started with Raspberry Pi Pico-series
Use Eclipse 43