When compiling multiple times in a row, the cflags and ldflags grow.
This is caused by the copy-by-reference of self.base_flags (in toolchain_stm32.py).
Change in getBuilderCFLAGS() and getBuilderLDFLAGS :
flags = self.base_flags
to:
flags = []
flags += self.base_flags