From b4dc4c5b9a1e6df620a14d85f18721a0bcb17d83 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 23 Jun 2020 14:00:16 +1000 Subject: [PATCH] stm32/mboot: Use additional CFLAGS to compile string0.c. This is the same as a902b69dd51de0e3fe3bb6955296591d6a93abab but applied to mboot's Makefile. Signed-off-by: Damien George --- ports/stm32/mboot/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 79aa3316f9..a72b752ac9 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -57,6 +57,10 @@ CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 +# Standard C functions like memset need to be compiled with special flags so +# the compiler does not optimise these functions in terms of themselves. +CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto + CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -Werror -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA) CFLAGS += -D$(CMSIS_MCU) CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES)) @@ -84,6 +88,7 @@ else COPT += -Os -DNDEBUG endif +$(BUILD)/lib/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) LIB_SRC_C = \ lib/libc/string0.c \ lib/oofatfs/ff.c \