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 <keithpac@amazon.com>
This commit is contained in:
Keith Packard 2023-03-02 13:01:35 -08:00 committed by Paul Bartell
parent 15826fe5cc
commit 82e8d335b8

View file

@ -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