diagdummy Simple dummy app for diagnostics and debugging

This commit is contained in:
2025-09-20 12:25:02 +02:00
parent a8005917eb
commit a24b1fc677
5 changed files with 56 additions and 0 deletions

2
user/diagdummy/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.o
diagdummy

24
user/diagdummy/Makefile Normal file
View File

@ -0,0 +1,24 @@
include $(ROOT)/mk/grabsrc.mk
include ../Makefile.inc
.PHONY: all clean
TARGET := diagdummy
LDFLAGS += -L$(ROOT)/ulib -l:libulib.a
SRCFILES := $(call GRABSRC, .)
CFILES := $(call GET_CFILES, $(SRCFILES))
OBJ := $(call GET_OBJ, $(SRCFILES))
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
all: $(TARGET)
$(TARGET): $(OBJ)
$(LD) $^ $(LDFLAGS) -o $@
echo $$(realpath $(TARGET)) >> $(FILES)
clean:
rm -f $(OBJ) $(TARGET)

7
user/diagdummy/block.c Normal file
View File

@ -0,0 +1,7 @@
#include <ulib.h>
void diagdummy_block(void) {
uprintf("blocking...\n");
while(1) {
}
}

6
user/diagdummy/block.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef DIAGDUMMY_BLOCK_H_
#define DIAGDUMMY_BLOCK_H_
void diagdummy_block(void);
#endif // DIAGDUMMY_BLOCK_H_

View File

@ -0,0 +1,17 @@
#include <ulib.h>
#include "block.h"
void main(void) {
if (argslen() == 0) {
uprintf("diagdummy: no arguments\n");
quit();
}
char *cmd = args()[0];
if (string_strcmp(cmd, "block") == 0) {
diagdummy_block();
} else {
uprintf("diagdummy: unknown cmd %s\n", cmd);
}
}