master
c 29 lines 484 Bytes
Raw
1 /*
2 * linux-user semihosting console
3 *
4 * Copyright (c) 2024
5 * Written by Alex Bennée <alex.bennee@linaro.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #define SYS_READC 0x07
11
12 #include <stdio.h>
13 #include <stdint.h>
14 #include "semicall.h"
15
16 int main(void)
17 {
18 char c;
19
20 printf("Semihosting Console Test\n");
21 printf("hit X to exit:");
22
23 do {
24 c = __semi_call(SYS_READC, 0);
25 printf("got '%c'\n", c);
26 } while (c != 'X');
27
28 return 0;
29 }