7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

arduino で ccache (ESP32, M5StickC等 編)

Last updated at Posted at 2020-01-21

概要

arduinoでbuildしているとなんで?というぐらい遅い、、、というわけで、ccacheを有効にします。

https://nagayasu-shinya.com/arduino-ccacche/
などを参考にしましたが、ESP32で有効になりませんでしたので、有効の仕方です。

準備

$ brew update
$ brew install ccache

$ ls /usr/local/bin/ccache
$ mkdir /var/tmp/arduino

$ ccache -M 10G
$ ccache -s
cache directory                     /Users/xxxx/.ccache
primary config                      /Users/xxxx/.ccache/ccache.conf
secondary config      (readonly)    /usr/local/Cellar/ccache/3.7.7/etc/ccache.conf
cache hit (direct)                     0
cache hit (preprocessed)               0
cache miss                             0
cache hit rate                      0.00 %
cleanups performed                     0
files in cache                         0
cache size                           0.0 kB
max cache size                      10.0 GB

設定編

  1. arduino を 立ち上げる
  2. file - preference で preference.txtをクリックして、ファイルを開く
  3. arduino を 閉じる
  4. 2のファイルにbuild.path=/var/tmp/arduinoを追加する
  5. /Users/xxxx/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/platform.txtなどを開く
## Compile c files
recipe.c.o.pattern=/usr/local/bin/ccache "{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Compile c++ files
recipe.cpp.o.pattern=/usr/local/bin/ccache "{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

のように、recipe.co.o.patternとrecipe.cpp.o.patternにccacheを追加する
$PATHに見つからないとか言われますので、とりあえず、絶対パスにしたら動きました。

$ /usr/local/bin/ccache -s
cache directory                     /Users/xxxx/.ccache
primary config                      /Users/xxx/.ccache/ccache.conf
secondary config      (readonly)    /usr/local/Cellar/ccache/3.7.7/etc/ccache.conf
stats updated                       Wed Jan 22 00:15:13 2020
cache hit (direct)                    11
cache hit (preprocessed)               0
cache miss                           140
cache hit rate                      7.28 %
called for preprocessing             250
cleanups performed                     0
files in cache                       420
cache size                         118.6 MB
max cache size                      10.0 GB

みたいに一応hitしているみたいです。

まだ遅いけど、改善はされました。

というか、preference.txtには、build.cache=onみたいにも書かれているのになぜフルビルドするんでしょうね・・・・

7
4
1

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
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?