1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-19 03:23:49 +01:00
RIOT/pkg/mpaland-printf/patches/0002-RIOT-integration.patch
Marian Buschsieweke 7caf2066d8
pkg/mpaland-printf: fix overriding printf with printf_float
This makes sure that newlib's printf is correctly overridden by:

1. Adding wrappers for some more obscure printf() variants
2. Forcing a compilation failure when newlib's stdio is still linked in
   while mpaland-printf is used
3. Not adding `-u _printf_float` to the linker flags when mpaland-printf
   is used.
2025-04-26 15:28:17 +02:00

51 lines
1.2 KiB
Diff

From ca5d3c2e0488b1888299ed7eb81c4dc16b7ac8c6 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Date: Sat, 11 May 2024 17:51:01 +0200
Subject: [PATCH 2/4] RIOT integration
Use stdio_write() from stdio_base.h for output
---
printf.c | 8 ++++++++
printf.h | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/printf.c b/printf.c
index e6e18fa..d560d2b 100644
--- a/printf.c
+++ b/printf.c
@@ -34,6 +34,7 @@
#include <stdint.h>
#include "printf.h"
+#include "stdio_base.h"
// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
@@ -912,3 +913,10 @@ int fctprintf(void (*out)(char character, void* arg), void* arg, const char* for
va_end(va);
return ret;
}
+
+
+/* RIOT integration: Use stdio_write for output */
+static void _putchar(char character)
+{
+ stdio_write(&character, sizeof(character));
+}
diff --git a/printf.h b/printf.h
index 6075bc2..154930a 100644
--- a/printf.h
+++ b/printf.h
@@ -46,7 +46,7 @@ extern "C" {
* This function is declared here only. You have to write your custom implementation somewhere
* \param character Character to output
*/
-void _putchar(char character);
+static void _putchar(char character);
/**
--
2.43.0