Install dependency
sudo apt-get update
sudo apt-get install git cmake automake autoconf
sudo apt-get install texinfo libtool libftdi-dev libusb-1.0-0-dev minicom
sudo apt-get install build-essential gcc-arm-none-eabi gcc
sudo apt-get install g++ libstdc++-arm-none-eabi-newlib gdb-multiarch
Download c/C++ SDK
Raspberry Pi Foundation already provided a script for Linux and Raspberry Pi OS, which automatically install prerequisites and download C/C++ SDK.
mkdir ~/pi_pico
cd ~/pi_pico
git clone 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
git clone -b master https://github.com/raspberrypi/pico-extras.git
git clone -b master https://github.com/raspberrypi/pico-playground.git
Download and setup toolchain
cd ~/pi_pico
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
export path
Better way to create a script in ~/pi_pico and source before compilation
ROOT_PATH=~/pi_pico
export PICO_SDK_PATH=$ROOT_PATH/pico-sdk
export PICO_EXAMPLES_PATH=$ROOT_PATH/pico-examples
export PICO_EXTRAS_PATH=$ROOT_PATH/pico-extras
export PICO_PLAYGROUND_PATH=$ROOT_PATH/pico-playground
export PICO_PLATFORM=rp2040
export PICO_TOOLCHAIN_PATH=$ROOT_PATH/gcc-arm-none-eabi-10.3-2021.10/bin
if [ ! -d $ROOT_PATH/FreeRTOS-Kernel ]; then
echo "FreeRTOS-Kernel is not present"
else
export FREERTOS_KERNEL_PATH=$ROOT_PATH/FreeRTOS-Kernel
fi
if [ ! -f $ROOT_PATH/picotool/build/picotool ]; then
echo picotool is not present
elif [[ $PATH != *"$ROOT_PATH/picotool/build"* ]]; then
export PATH=$PATH:$ROOT_PATH/picotool/build
fi
so, paste above script into a file called setenv.sh and source before compilation
source setenv.sh
Download and Setup Picotool
cd ~/pi_pico
git clone -b master https://github.com/raspberrypi/picotool.git
cd picotool
mkdir build
cd build
cmake ../
make
Download and Setup Picoprobe
cd ~/pi_pico
git clone -b master https://github.com/raspberrypi/picoprobe.git
cd picoprobe
mkdir build
cd build
cmake ../
make
Download and Setup Compiler OpenOCD
This tool will be used for debugging pico, if you don't want to debug then skip this step
cd ~/pi_pico
git clone https://github.com/raspberrypi/openocd.git --branch rp2040 --depth=1
cd openocd
./bootstrap
./configure --enable-picoprobe --enable-ftdi --enable-sysfsgpio --enable-bcm2835gpio
make
Download FreeRTOS
cd ~/pi_pico
git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git
Add FreeRTOS to your application
©2023-2024 rculock.com