Break console io example out into own app

This commit is contained in:
Toby Jaffey 2025-12-08 10:35:42 +00:00
parent 40e8795f3f
commit 274f347d90
5 changed files with 44 additions and 10 deletions

View file

@ -4,6 +4,7 @@ all:
docker build -t ${DOCKER_IMAGE} .
(cd sketch && make)
(cd helloworld && make)
(cd conio && make)
(cd zig-mandel && make)
(cd zigtris && make)
(cd rust-hello && make)
@ -12,6 +13,7 @@ all:
clean:
(cd sketch && make clean)
(cd helloworld && make clean)
(cd conio && make clean)
(cd zig-mandel && make clean)
(cd zigtris && make clean)
(cd rust-hello && make clean)

27
apps/conio/Makefile Normal file
View file

@ -0,0 +1,27 @@
PROJECT:=conio
DOCKER_IMAGE=riscv-dev
DOCKER_CMD:=docker run --rm -v ${PWD}../../../:/data -w /data/apps/${PROJECT} ${DOCKER_IMAGE}
PREFIX:=${DOCKER_CMD} riscv64-unknown-elf-
CFLAGS+=-I../../common
CFLAGS+=-fno-stack-protector
CFLAGS+=-static-libgcc -fdata-sections -ffunction-sections
CFLAGS+=-g -Os -march=rv32ima_zicsr -mabi=ilp32 -static
LDFLAGS:= -T ../linker.ld -nostdlib -Wl,--gc-sections
LIBS:= #-lgcc # needed for softfp
SRCS=${PROJECT}.c ../crt0.S
all:
${PREFIX}gcc -o ${PROJECT}.elf ${CFLAGS} ${LDFLAGS} ${SRCS} ${LIBS}
$(PREFIX)objcopy ${PROJECT}.elf -O binary ${PROJECT}.bin
disasm: all
$(PREFIX)objdump -S -d -f ${PROJECT}.elf
test: all
../../host/host ${PWD}/${PROJECT}.bin
clean:
rm -f ${PROJECT}.o ${PROJECT}.elf ${PROJECT}.bin

15
apps/conio/conio.c Normal file
View file

@ -0,0 +1,15 @@
#define USE_MAIN
#include "uvm32_target.h"
void main(void) {
uint32_t c;
println("Press a key!");
while(c = getc()) {
if (c != 0xFFFFFFFF) {
print("Got: ");
printx(c);
println("");
}
}
}

View file

@ -5,15 +5,5 @@ void main(void) {
for (int i=0;i<10;i++) {
printd(i);
}
#if 0
uint32_t c;
while(c = getc()) {
if (c != 0xFFFFFFFF) {
print("Got: ");
printx(c);
println("");
}
}
#endif
}

BIN
precompiled/conio.bin Executable file

Binary file not shown.