From 82e8d335b8816e26fed4ba4c7fef85ee85f6698c Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Mar 2023 13:01:35 -0800 Subject: [PATCH] Demo/CORTEX_M3_MPS2_QEMU_GCC: Add option to build with picolibc When built with PICOLIBC=1, selects picolibc as the C library by removing the newlib-nano linker flags and adding --specs=picolibc.specs to the compiler flags. This also selects the integer-only printf variant provided within picolibc to reduce flash use by adding -DPICOLIBC_INTEGER_PRINTF_SCANF. Signed-off-by: Keith Packard --- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile index 9b5f240b9..d4a48ebdb 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile @@ -66,7 +66,10 @@ endif DEFINES := -DQEMU_SOC_MPS2 -DHEAP3 -LDFLAGS = -T ./scripts/mps2_m3.ld -specs=nano.specs --specs=rdimon.specs -lc -lrdimon +LDFLAGS = -T ./scripts/mps2_m3.ld +ifneq ($(PICOLIBC), 1) +LDFLAGS += -specs=nano.specs --specs=rdimon.specs -lc -lrdimon +endif LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map LDFLAGS += -Wl,--gc-sections @@ -74,6 +77,9 @@ CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-dec CFLAGS += -Wno-builtin-declaration-mismatch -Werror CFLAGS += -Wall -Wextra CFLAGS += -ffunction-sections -fdata-sections +ifeq ($(PICOLIBC), 1) +CFLAGS += -specs=picolibc.specs -DPICOLIBC_INTEGER_PRINTF_SCANF +endif ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 -Og