stm32/boards: Enable LTO by default on boards with smaller flash size.

Signed-off-by: Angus Gratton <gus@projectgus.com>
This commit is contained in:
Angus Gratton 2022-06-24 12:04:47 +10:00 committed by Damien George
parent 5568c324ba
commit dd77dbd4f7
6 changed files with 32 additions and 0 deletions

View File

@ -68,6 +68,23 @@ can be built via:
For more information about mboot see mboot/README.md.
### Link Time Optimization
Link Time Optimization (LTO) reduces the firmware binary size when enabled
(typically 2-3% smaller). However it may make build time longer, particularly on
older GCC versions.
Currently LTO is enabled by default for some smaller STM32 boards with less
flash, but disabled on other boards.
To enable LTO, pass `LTO=1` on the command line:
$ make BOARD=boardname LTO=1
To disable LTO, pass `LTO=0` in the same way.
Note that `make clean BOARD=boardname` will be needed before changing the `LTO`
setting of a firmware that is already built.
### Flashing the Firmware using DFU mode

View File

@ -9,3 +9,6 @@ MICROPY_VFS_FAT = 0
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
# LTO reduces final binary size, may be slower to build depending on gcc version and hardware
LTO ?= 1

View File

@ -9,3 +9,6 @@ MICROPY_VFS_LFS1 ?= 1
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
# LTO reduces final binary size, may be slower to build depending on gcc version and hardware
LTO ?= 1

View File

@ -2,3 +2,6 @@ MCU_SERIES = g0
CMSIS_MCU = STM32G0B1xx
AF_FILE = boards/stm32g0b1_af.csv
LD_FILES = boards/stm32g0b1xe.ld boards/common_basic.ld
# LTO reduces final binary size, may be slower to build depending on gcc version and hardware
LTO ?= 1

View File

@ -8,3 +8,6 @@ MICROPY_VFS_FAT = 0
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
# LTO reduces final binary size, may be slower to build depending on gcc version and hardware
LTO ?= 1

View File

@ -10,3 +10,6 @@ MICROPY_VFS_LFS1 ?= 1
# Don't include default frozen modules because MCU is tight on flash space
FROZEN_MANIFEST ?=
# LTO reduces final binary size, may be slower to build depending on gcc version and hardware
LTO ?= 1