Raspberry Pico: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 1: Line 1:
=Introduction=
=Introduction=
==Set up Environment Variables==
Here are ones I use. I believe the build system rely on PICO_SDK_PATH and PICO_TOOLCHAIN_PATH
<syntaxhighlight lang="bash">
# Set up base directory
export PICO_ROOT=/home/$USER/dev/pico
export PICO_SDK_PATH=$PICO_ROOT/pico-sdk
export PICO_TOOLCHAIN_PATH=$PICO_ROOT/gcc-arm-none-eabi-10-2020-q4-major/bin
</syntaxhighlight>
==Get the compiler==
This is how I got started.<br>
This is how I got started.<br>
Unzip and get the latest compiler from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads<br>
Unzip and get the latest compiler from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads<br>
<br>
<br>
Cloned the sdk
I then extract it to $PICO_ROOT
==Clone the SDK==
Get the SDK
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Set up directory
export PICO_ROOT=/home/$USER/dev/pico
cd $PICO_ROOT
cd $PICO_ROOT
# Clone SDK
git clone --recurse-submodules https://github.com/raspberrypi/pico-sdk.git
git clone --recurse-submodules https://github.com/raspberrypi/pico-sdk.git
git clone https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk.git
git clone https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk.git
</syntaxhighlight>
==Make the sample==
It using CMake so we goto the source make a build directory and make. This should produce a file pico_micro_ros_example.uf2
<syntaxhighlight lang="bash">
cd $PICO_ROOT
cd micro_ros_raspberrypi_pico_sdk


# Set up the environment variables, PICO_TOOLCHAIN_PATH being the where you extracted the compiler.
export PICO_SDK_PATH=$PICO_ROOT/pico-sdk
export PICO_TOOLCHAIN_PATH=$PICO_ROOT/gcc-arm-none-eabi-10-2020-q4-major/bin
# Go to test project
mkdir $PICO_ROOT/micro_ros_raspberrypi_pico_sdk
mkdir build
mkdir build
cd build
cd build
cmake ..
cmake ..
make
make
</syntaxhighlight>
==Copy to device==
So plug in the PICO holding down the boot button
<syntaxhighlight lang="bash">
cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2
</syntaxhighlight>
==Install the micro ros agent==
<syntaxhighlight lang="bash">
sudo snap install micro-ros-agent
sudo snap set micro-ros-agent daemon=true
</syntaxhighlight>
</syntaxhighlight>

Revision as of 02:01, 2 July 2021

Introduction

Set up Environment Variables

Here are ones I use. I believe the build system rely on PICO_SDK_PATH and PICO_TOOLCHAIN_PATH

# Set up base directory
export PICO_ROOT=/home/$USER/dev/pico
export PICO_SDK_PATH=$PICO_ROOT/pico-sdk
export PICO_TOOLCHAIN_PATH=$PICO_ROOT/gcc-arm-none-eabi-10-2020-q4-major/bin

Get the compiler

This is how I got started.
Unzip and get the latest compiler from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

I then extract it to $PICO_ROOT

Clone the SDK

Get the SDK

cd $PICO_ROOT
git clone --recurse-submodules https://github.com/raspberrypi/pico-sdk.git
git clone https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk.git

Make the sample

It using CMake so we goto the source make a build directory and make. This should produce a file pico_micro_ros_example.uf2

cd $PICO_ROOT
cd micro_ros_raspberrypi_pico_sdk

mkdir build
cd build
cmake ..
make

Copy to device

So plug in the PICO holding down the boot button

cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2

Install the micro ros agent

sudo snap install micro-ros-agent
sudo snap set micro-ros-agent daemon=true