ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations. For more information, visit the ccache homepage.

For our purposes, we'll cover how to integrate ccache with the Blackfin toolchain so as to speed up rebuilds of things like the kernel or the uClinux distribution.

Since the ccache is automatically invalidated when the compiler itself is updated, it can often be useful to maintain a cache for each major version. For example, a cache for the 2006R1 toolchain, the 2006R2 toolchain, and the 2007R1 toolchain can be quite useful when having to switch between them thus preventing cache thrashing. You can accomplish this by changing the CCACHE_DIR environment variable.

export CCACHE_DIR="$HOME/.ccache-bfin/2007R1"

You can also control the size of individual caches by using ccache -M.