1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

doc/ccache: move to “Advanced build system tricks”

This commit is contained in:
Martine Lenders 2024-12-06 12:28:22 +01:00
parent 113b5c55e3
commit 1b86fe3ea1
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80
3 changed files with 81 additions and 81 deletions

View File

@ -878,7 +878,6 @@ INPUT = ../../doc.txt \
src/build-in-docker.md \
../../tests/README.md \
src/dev-best-practices.md \
src/ccache.md \
src/comparing-build-sizes.md \
src/static-vs-dynamic-memory.md \
src/build-system-basics.md \

View File

@ -39,6 +39,87 @@ You can configure your own files that will be parsed by the build system main
* Define your custom targets
* Override default targets
Speed-up builds with ccache {#ccache}
===========================
[`ccache`](https://ccache.samba.org/) is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.
Usually, the initial build takes a little (5% - 20%) longer, but repeated builds are up to ten times faster.
Using `ccache` is safe, as `ccache` tries very hard to not mess up things and falls back to a normal compile if it cannot ensure correct output.
There's one drawback: without further tweaking, `gcc` stops emitting colored output.
Setup
-----
- Install using the package manager of your distribution, e.g., on Ubuntu or Debian:
~~~~~~~~~~~~~~~~~~~
# sudo apt-get install ccache
~~~~~~~~~~~~~~~~~~~
- Set `CCACHE` variable to `ccache`:
~~~~~~~~~~~~~~~~~~~
# export CCACHE=ccache
~~~~~~~~~~~~~~~~~~~
- (Optionally) add the above export line to your `~/.profile`
Result
------
Build without `ccache`:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m12.321s
user 0m10.317s
sys 0m1.170s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~
First build with `ccache` enabled:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m15.462s
user 0m12.410s
sys 0m1.597s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~
Subsequent build with `ccache` enabled:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m2.157s
user 0m1.213s
sys 0m0.327s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~
Analyze dependency resolution {#analyze-depedency-resolution}
=============================

View File

@ -1,80 +0,0 @@
Introduction
============
[`ccache`](https://ccache.samba.org/) is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.
Usually, the initial build takes a little (5% - 20%) longer, but repeated builds are up to ten times faster.
Using `ccache` is safe, as `ccache` tries very hard to not mess up things and falls back to a normal compile if it cannot ensure correct output.
There's one drawback: without further tweaking, `gcc` stops emitting colored output.
Setup
-----
- Install using the package manager of your distribution, e.g., on Ubuntu or Debian:
~~~~~~~~~~~~~~~~~~~
# sudo apt-get install ccache
~~~~~~~~~~~~~~~~~~~
- Set `CCACHE` variable to `ccache`:
~~~~~~~~~~~~~~~~~~~
# export CCACHE=ccache
~~~~~~~~~~~~~~~~~~~
- (Optionally) add the above export line to your `~/.profile`
Result
------
Build without `ccache`:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m12.321s
user 0m10.317s
sys 0m1.170s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~
First build with `ccache` enabled:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m15.462s
user 0m12.410s
sys 0m1.597s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~
Subsequent build with `ccache` enabled:
~~~~~~~~~~~~~~~~~~~
[kaspar@booze default (master)]$ time BOARD=samr21-xpro make clean all
Building application "default" for "samr21-xpro" with MCU "samd21".
[...]
text data bss dec hex filename
37016 180 6008 43204 a8c4 /home/kaspar/src/riot/examples/default/bin/samr21-xpro/default.elf
real 0m2.157s
user 0m1.213s
sys 0m0.327s
[kaspar@booze default (master)]$
~~~~~~~~~~~~~~~~~~~