From 6786715e037ba7490e6b4107b06616b96f3f1900 Mon Sep 17 00:00:00 2001 From: Dual Tachyon Date: Mon, 14 Aug 2023 12:00:08 +0100 Subject: [PATCH] Added external printf module. Don't use stdio.h, but use instead: #include "external/printf/printf.h" --- .gitmodules | 3 +++ Makefile | 2 ++ external/printf | 1 + printf_config.h | 3 +++ 4 files changed, 9 insertions(+) create mode 160000 external/printf create mode 100644 printf_config.h diff --git a/.gitmodules b/.gitmodules index 9113d32..fe93929 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/CMSIS_5"] path = external/CMSIS_5 url = https://github.com/ARM-software/CMSIS_5 +[submodule "external/printf"] + path = external/printf + url = https://github.com/mpaland/printf diff --git a/Makefile b/Makefile index a54597f..e18502c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ OBJS += init.o OBJS += overlay.o OBJS += $(LINK_OVERLAY).o OBJS += $(BLOB_OVERLAY).o +OBJS += external/printf/printf.o # Drivers OBJS += driver/adc.o @@ -60,6 +61,7 @@ SIZE = arm-none-eabi-size ASFLAGS = -mcpu=cortex-m0 CFLAGS = -O2 -Wall -Werror -mcpu=cortex-m0 -fno-builtin -MMD +CFLAGS += -DPRINTF_INCLUDE_CONFIG_H LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld OVERLAY_CFLAGS = $(CFLAGS) -fno-inline -fno-toplevel-reorder diff --git a/external/printf b/external/printf new file mode 160000 index 0000000..d3b9846 --- /dev/null +++ b/external/printf @@ -0,0 +1 @@ +Subproject commit d3b984684bb8a8bdc48cc7a1abecb93ce59bbe3e diff --git a/printf_config.h b/printf_config.h new file mode 100644 index 0000000..2518a26 --- /dev/null +++ b/printf_config.h @@ -0,0 +1,3 @@ +#define PRINTF_DISABLE_SUPPORT_LONG_LONG +#define PRINTF_DISABLE_SUPPORT_EXPONENTIAL +#define PRINTF_DISABLE_SUPPORT_PTRDIFF_T