For all of you maintaining you own toolchain for work and guilty pleasures
I come with good news. How about taking 14GB of your toolchain and making them
disappear?
Since I received my pine time developer kit I have been working with
a multi lib toolchain. This means that I compiled GCC to be support
both Cortex M0 (armv6) and Cortex M4 (armv7).
This multilib toolchain is “baked” with Cross-Tools NG and the whole
process is quite easy. Select “multilib” from the menu, choose the
“rmprofile” as the one you want and there you go!
The problem is that the “rmprofile” provides support for armv6, armv7
and armv8. And every combination of Soft FP, Hard FP, single and double
precision. This combinatorial explosion leaves around a lot of bytes (about
20 GB of them) I would not have used as the hardware I target are
the nRF51822 (M0) and the nRF52832 (M4+hfp).
So after seeing my toolchain build fail another time because of resource
exhaustion (literally filled the partition!) I set to prune this combinatorial
madness.
And with some help I managed to take the whole armv8 support out of
the toolchain reducing to a mere 7 GB!
The process is actually quite easy, when GCC is compiled the profile
chosen specifies which combinations will be built by looking at the
makefile with the same name.
Each profile is stored in gcc/config
and looks like this
So if we were to take out the last part we would drop support for armv8 with FP
and then we can go on and take armv8 away from the first two line.
The patch is as follows and applying it was super easy. Cross-Tools will look up
local patches in the patches directory and you just have to put it under patches/gcc/your.gcc.version
to have it picked up at build time.
It also worked first try once I placed in the correct patch directory! So in the end
I have 14 GB less for two hours of waiting for GCC to compile, not bad at all!