From 11ee5ff2cf3a34db652e8750450f8c30c075200a Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sun, 9 Feb 2020 12:52:52 +0100 Subject: [PATCH] stdio_semihosting: Add shell-based test application --- tests/sys_stdio_semihosting/Makefile | 10 ++++++++ tests/sys_stdio_semihosting/README.md | 13 ++++++++++ tests/sys_stdio_semihosting/main.c | 35 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 tests/sys_stdio_semihosting/Makefile create mode 100644 tests/sys_stdio_semihosting/README.md create mode 100644 tests/sys_stdio_semihosting/main.c diff --git a/tests/sys_stdio_semihosting/Makefile b/tests/sys_stdio_semihosting/Makefile new file mode 100644 index 0000000000..43c6328b18 --- /dev/null +++ b/tests/sys_stdio_semihosting/Makefile @@ -0,0 +1,10 @@ +include ../Makefile.tests_common + +USEMODULE += stdio_semihosting +USEMODULE += shell +USEMODULE += shell_commands +USEMODULE += ps + +RIOT_TERMINAL = semihosting + +include $(RIOTBASE)/Makefile.include diff --git a/tests/sys_stdio_semihosting/README.md b/tests/sys_stdio_semihosting/README.md new file mode 100644 index 0000000000..c8b2262119 --- /dev/null +++ b/tests/sys_stdio_semihosting/README.md @@ -0,0 +1,13 @@ +# Semihosting STDIO test + +This test aims to test ARM semihosting based STDIO on RIOT. The test is manual, +starting a debugger on the CI for automated test is not supported. + +## Usage + +1. Flash the test on a board with an ARM-based MCU. +2. Use `make term RIOT_TERMINAL=semihosting` to start a debug session with + semihosting enabled. +3. Restart the microcontroller via the debug session. + +The shell prompt should be available in the GDB session. diff --git a/tests/sys_stdio_semihosting/main.c b/tests/sys_stdio_semihosting/main.c new file mode 100644 index 0000000000..5a8518c3aa --- /dev/null +++ b/tests/sys_stdio_semihosting/main.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2020 Koen Zandberg + * + * 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 tests + * @{ + * + * @file + * @brief STDIO Semihosting test application using simple shell + * interaction + * + * @author Koen Zandberg + * + * @} + */ + +#include + +#include "shell.h" +#include "shell_commands.h" + +int main(void) +{ + puts("STDIO semihosting test application"); + + char line_buf[SHELL_DEFAULT_BUFSIZE]; + shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); + + return 0; +}