From d19415666981d7d319a341deeef18bb2d755660f Mon Sep 17 00:00:00 2001 From: pepepper Date: Thu, 23 Dec 2021 17:54:46 +0900 Subject: [PATCH] selftest mode caller --- x1/selftester/Makefile | 33 +++++++++++++++++++++++++++++++++ x1/selftester/selftester.c | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 x1/selftester/Makefile create mode 100644 x1/selftester/selftester.c diff --git a/x1/selftester/Makefile b/x1/selftester/Makefile new file mode 100644 index 0000000..acd33d5 --- /dev/null +++ b/x1/selftester/Makefile @@ -0,0 +1,33 @@ +CROSS_COMPILE := arm-linux-gnueabihf- +AS := $(CROSS_COMPILE)as +CC := $(CROSS_COMPILE)gcc +LD := $(CROSS_COMPILE)ld +OBJCOPY := $(CROSS_COMPILE)objcopy + +TARGET := AppMain +OBJS := ../linkerscript/crt0.o selftester.o + +LIBS := ../linkerscript/libbrain/libbrain.a + +ASFLAGS := -W +CFLAGS := -Wall -ffreestanding -fomit-frame-pointer -Os -I../linkerscript/libbrain +LDFLAGS := -T ../linkerscript/x1.ld + +.PHONY: +all: $(TARGET).bin + +.PHONY: +clean: + -rm -f $(TARGET).bin $(TARGET).elf $(OBJS) + +%.o: %.s + $(AS) $(ASFLAGS) $< -o $@ + +%.o: %.c + $(CC) -c $(CFLAGS) $< + +$(TARGET).elf: $(OBJS) + $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ + +$(TARGET).bin: $(TARGET).elf + $(OBJCOPY) -O binary $< $@ diff --git a/x1/selftester/selftester.c b/x1/selftester/selftester.c new file mode 100644 index 0000000..2eeb2ad --- /dev/null +++ b/x1/selftester/selftester.c @@ -0,0 +1,9 @@ +#include + +int main(void *arg) +{ + typedef void (*FUNC_POINTER)(); + FUNC_POINTER func = (FUNC_POINTER)0x60198000; + func(); + return 0; +}