@@ -52,17 +52,34 @@ set_status()
5252#
5353# Sources a pre-compiled GCC installation from AWS, installing the archive by
5454# extracting and prepending the executable directory to PATH.
55+ # Ccache is enabled for `arm-none-eabi-`.
5556#
5657# Note: Expects 'deps_url' and 'deps_dir' to already be defined.
5758#
58- _install_gcc ()
59+ _install_gcc_and_ccache ()
5960{
61+ # Enable Ccache in Travis
62+ ccache -o compiler_check=content
63+ ccache -M 1G
64+ pushd /usr/lib/ccache
65+ sudo ln -s ../../bin/ccache arm-none-eabi-gcc
66+ sudo ln -s ../../bin/ccache arm-none-eabi-g++
67+ export " PATH=/usr/lib/ccache:${PATH} "
68+ popd
69+
70+ # Legacy Mbed build tool passes a new time stamp in commmand line argument
71+ # every time mbed-os is built. This causes ccache cache miss. But there is a
72+ # provision to read the time stamp from environment variable
73+ # (MBED_BUILD_TIMESTAMP). Setting this variable to a fixed value improves
74+ # ccache cache hits.
75+ export " MBED_BUILD_TIMESTAMP=0"
76+
6077 # Ignore shellcheck warnings: Variables defined in .travis.yml
6178 # shellcheck disable=SC2154
6279 local url=" ${deps_url} /gcc9-linux.tar.bz2"
6380
6481 # shellcheck disable=SC2154
65- local gcc_path=" ${deps_dir} /gcc/gcc-arm-none-eabi-9-2019-q4-major/ "
82+ local gcc_path=" ${deps_dir} /gcc/gcc-arm-none-eabi-9-2019-q4-major"
6683
6784 local archive=" gcc.tar.bz2"
6885
@@ -82,7 +99,7 @@ _install_gcc()
8299 fi
83100
84101 info " Installing 'gcc'"
85- export " PATH=${gcc_path} /bin :${PATH} "
102+ export " PATH=${PATH} :${gcc_path} /bin "
86103}
87104
88105
@@ -184,7 +201,7 @@ source_pkg()
184201 ;;
185202
186203 " gcc" )
187- _install_gcc \
204+ _install_gcc_and_ccache \
188205 || die " Installation failed"
189206 ;;
190207
0 commit comments