With Device OS 2.0.0 you’ll need to modify the Workbench Makefile to add the COMPILE_LTO=y option to the options for building the user firmware binary. For example, for the compile and flash target:
# Compile and flash the user part
flash-user: dfu preprocess
$(call print_stage,FLASHING APPLICATION)
cd "$(value DEVICE_OS_PATH)/main" && make all program-dfu COMPILE_LTO=y
$(call print_success,FLASHED SUCCESSFULLY)
This only works with 2.0.0-rc and later. Make sure you Clean application after changing the value. This will also increase the time spent in the link phase, but it will make the binary smaller.
I think this will be in the particle tool chain folder. OS 2.0.0 just released a few days ago so I was thinking of giving this a shot sometime next week.
Tool chain folder in windows is probably in the path:
It seems that location is correct. I implemented the changes suggested. However, the binary size of my app didn’t changed after all. On the other hand the size of the binary reduced a couple of kB after I migrated from 1.5.2 to 2.0.0.