Enchan1207 / rpi_pico_blink

C/C++でRaspberry Pi Picoのコードを書きたい

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Raspberry Pi PicoをC/C++で開発

Overview

C/C++でRaspberry Pi Picoのコードを書きたい

Usage

SDK preparation

SDK Setupにあるgetting started のChapter 2.The SDKを参考にSDKをインストールします。今回は ~/pico-sdk にリポジトリをクローンし、インストールしたものとします。

export PICO_SDK_PATH=~/pico-sdk をシェルのprofileに追加し、シェルを再起動します。

Build project

このリポジトリをクローンし、通常通りCMakeを構成して (mkdir build && cd build && cmake ..) ビルドします。 (ninja とか make とか)…
完了すると /build/src/rpi_pico_blink.uf2 が生成されます。これをRPi Picoに書き込みます。

Federation with VSCode (CMake Tools)

VSCodeのCMake拡張機能と連携する場合は、コマンドパレットを表示し cmake:edit user-local cmake kits と入力して確定します。 構成エディタが開きますので、以下の内容を追記します。

{
  "name": "Raspberry Pi Pico",
  "compilers": {
    "C": "/path/to/arm-none-eabi-gcc",
    "CXX": "/path/to/arm-none-eabi-g++"
  },
  "toolchainFile": "/<homedir>/pico-sdk/cmake/preload/toolchains/pico_arm_gcc.cmake",
  "environmentVariables": {
    "PICO_SDK_PATH": "/<homedir>/pico-sdk"
  },
  "isTrusted": true
}

ウィンドウ下のキット選択ボタンをクリックすると「Raspberry Pi Pico」が追加されているはずです。これを選択して「ビルド」をクリックすることで、Raspberry Pi Pico用にプロジェクトをビルドすることができるようになります。 また、この操作によりIntelliSenseが正しく構成され、補完が効くようになります。

License

This repository is published under MIT License.

About

C/C++でRaspberry Pi Picoのコードを書きたい

License:MIT License


Languages

Language:CMake 76.5%Language:C 23.5%