@@ -52,17 +52,34 @@ set_status()
52
52
#
53
53
# Sources a pre-compiled GCC installation from AWS, installing the archive by
54
54
# extracting and prepending the executable directory to PATH.
55
+ # Ccache is enabled for `arm-none-eabi-`.
55
56
#
56
57
# Note: Expects 'deps_url' and 'deps_dir' to already be defined.
57
58
#
58
- _install_gcc ()
59
+ _install_gcc_and_ccache ()
59
60
{
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
+
60
77
# Ignore shellcheck warnings: Variables defined in .travis.yml
61
78
# shellcheck disable=SC2154
62
79
local url=" ${deps_url} /gcc9-linux.tar.bz2"
63
80
64
81
# 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"
66
83
67
84
local archive=" gcc.tar.bz2"
68
85
@@ -82,7 +99,7 @@ _install_gcc()
82
99
fi
83
100
84
101
info " Installing 'gcc'"
85
- export " PATH=${gcc_path} /bin :${PATH} "
102
+ export " PATH=${PATH} :${gcc_path} /bin "
86
103
}
87
104
88
105
@@ -184,7 +201,7 @@ source_pkg()
184
201
;;
185
202
186
203
" gcc" )
187
- _install_gcc \
204
+ _install_gcc_and_ccache \
188
205
|| die " Installation failed"
189
206
;;
190
207
0 commit comments