With MDK Version 4.72A 3 passes are done with crossmodule optimization enabled:
Build target 'STM32F100V8' Clean started - Project: 'STM32_VL_2xCPU' deleting intermediate output files for target 'STM32F100V8' compiling system_stm32f10x.c... compiling core_cm3.c... ..... ..... compiling stm32f10x_crc.c... linking... Program Size: Code=22928 RO-data=1580 RW-data=144 ZI-data=2440 ".\RVMDK\STM32_VL_DUAL\STM32_VL_DUAL.axf" - 0 Errors, 0 Warning(s).
*** Performing Cross-Module-Optimization: compiling system_stm32f10x.c... ..... ..... compiling stm32f10x_crc.c... linking... Program Size: Code=16268 RO-data=1620 RW-data=144 ZI-data=2440 >>>> unnecessary third round, not seen in MDK Version 4.70 compiling system_stm32f10x.c... compiling core_cm3.c... ..... ..... compiling stm32f10x_crc.c... linking... Program Size: Code=16268 RO-data=1620 RW-data=144 ZI-data=2440
everything is ok, it just seems an extra waste of time.
Cross module optimization (CMO) has changed since 4.70: iterations are performed until no changes in code/const/data sizes occur or a max. of 5 passes have been executed.
From your example, the initial rebuild-step gives:
Program Size: Code=22928 RO-data=1580 RW-data=144 ZI-data=2440
the first CMO iteration:
Program Size: Code=16268 RO-data=1620 RW-data=144 ZI-data=2440
the second CMO iteration:
The second CMO iteration does not yield a gain compared to to the first CMO, the iteration process is completed.
You have to pass it to see what's in it, to paraphrase Nancy Pelosi
Thank you for this information, it makes sense.
Werner
I have not used this optimisation until recently. We could squeeze the STM32 Y-Modem serial Bootloader to <4k using it, instead of 8k without.
So, clearly, not a "waste of time" at all! - quite a worthwhile result!
:-)