From 810a06903a018c1fb466377e27b450c6bbcae2c7 Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Wed, 9 Jan 2019 23:06:29 +0100 Subject: [PATCH 1/2] sys: stdio_null: add null driver --- Makefile.dep | 2 +- sys/stdio_null/Makefile | 5 ++++ sys/stdio_null/stdio_null.c | 53 +++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 sys/stdio_null/Makefile create mode 100644 sys/stdio_null/stdio_null.c diff --git a/Makefile.dep b/Makefile.dep index 6ebede633f..ed92ed9dc0 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -403,7 +403,7 @@ ifneq (,$(filter newlib,$(USEMODULE))) ifeq (,$(filter newlib_syscalls_%,$(USEMODULE))) USEMODULE += newlib_syscalls_default endif - ifeq (,$(filter stdio_rtt stdio_cdc_acm,$(USEMODULE))) + ifeq (,$(filter stdio_cdc_acm stdio_null stdio_rtt,$(USEMODULE))) USEMODULE += stdio_uart endif endif diff --git a/sys/stdio_null/Makefile b/sys/stdio_null/Makefile new file mode 100644 index 0000000000..ee28b8423d --- /dev/null +++ b/sys/stdio_null/Makefile @@ -0,0 +1,5 @@ +ifeq ($(DEVELHELP),1) + $(warning STDIO disabled via stdio_null, but DEVELHELP enabled) +endif + +include $(RIOTBASE)/Makefile.base diff --git a/sys/stdio_null/stdio_null.c b/sys/stdio_null/stdio_null.c new file mode 100644 index 0000000000..2f55deac4c --- /dev/null +++ b/sys/stdio_null/stdio_null.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2019 Bas Stottelaar + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup sys + * @{ + * + * @file + * @brief STDIO null driver + * + * This file provides a null driver for STDIO that does not depend on anything. + * + * @author Bas Stottelaar + * + * @} + */ + +#include "stdio_base.h" + +#if MODULE_VFS +#include "vfs.h" +#endif + +#define ENABLE_DEBUG 0 +#include "debug.h" + +void stdio_init(void) +{ +#if MODULE_VFS + vfs_bind_stdio(); +#endif +} + +ssize_t stdio_read(void* buffer, size_t count) +{ + (void) buffer; + (void) count; + + return 0; +} + +ssize_t stdio_write(const void* buffer, size_t len) +{ + (void) buffer; + (void) len; + + return 0; +} From 05bdab80e04ee6a704c84d42addad1006ce6698f Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Tue, 19 Nov 2019 18:27:57 +0100 Subject: [PATCH 2/2] tests: minimal: use stdio_null --- tests/minimal/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/minimal/Makefile b/tests/minimal/Makefile index 9bb62e0d41..83ace9d96d 100644 --- a/tests/minimal/Makefile +++ b/tests/minimal/Makefile @@ -5,4 +5,6 @@ CFLAGS += -DNDEBUG -DLOG_LEVEL=LOG_NONE DISABLE_MODULE += auto_init +USEMODULE += stdio_null + include $(RIOTBASE)/Makefile.include