LoginSignup
0
0

More than 3 years have passed since last update.

CLionでのesp32開発に必要な環境整備

Last updated at Posted at 2021-05-05

いろいろハマった(♦)のでメモを残したいと思います。

開発ボードを用意する

  1. USB に差し込んで、/devの下に usbmodemUSBtoUART などの名前が出ているか確認します。
  2. 表示がなければ、ドライバーがインストールされてない可能性があります。SILABSのチップが乗っているかどうか確認します。 image.png
  3. SILABSのチップがある場合、Silicon Labs のダウンロードページ から適宜にダウンロードし、インストールします。
  4. 再度USBに差し込んで、/dev/cu.SLAB_USBtoUART があると確認します。

PlatformIO Core をインストールする

必ず homebrew 経由でインストールします。

brew install platformio

PlatformIO 本家のインストール指示に従うと、インストールされるPlatformIO Coreがうまく認識されません♦。

インストールが終わったあと確認します。

$ which platformio
/usr/local/bin/platformio

Platformio プラグインを整備する

  1. CLionの設定画面(+,)を開き、左側から Plugins を選びます。
    スクリーンショット スクリーンショット 2021-05-05 20.27.28.png
  2. platformio で検索してインストールします(iniというプラグインが必要です。聞かれたら、合わせてインストールします)。
  3. CLionを再起動します
  4. 再起動した後、再び設定画面を開きます。
  5. 左側から Languages & Frameworks > PlatformIO を選びます。
    スクリーンショットimage.png
  6. platformio のインストール場所 /usr/local/bin/platformio を入力します。

プロジェクトを作成しビルドする

  1. メニューから File > New Project を選びます。
  2. 左側から PlatformIO を選びます。
  3. Espressif > Espressif ESP32 Dev Module > espidf を選びます(お持ちのボードに応じて適宜に選んでください)
    スクリーンショットimage.png
  4. [Create] を押します。 プロジェクト作成に5分ぐらい時間がかかります。作成終了後 src/main.c が作成されます
  5. platformio.ini を修正します。
    • platform = espressif32@1.11.2 (♦重要。新しい espidf は使えません)
    • upload_port = /dev/cu.SLAB_USBtoUART(Windowsの場合はCOMnnです)

platformio.ini 例

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32@1.11.2
board = esp32dev
framework = espidf
src_dir = src
upload_port = /dev/cu.SLAB_USBtoUART

ツールバーの「🔨ビルド」ボタンを押してビルドを開始します。

image.png

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0