mirror of
https://github.com/brain-hackers/lab
synced 2024-12-22 20:20:04 +09:00
commit
84b99e95d7
33
x1/selftester/Makefile
Normal file
33
x1/selftester/Makefile
Normal file
@ -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 $< $@
|
9
x1/selftester/selftester.c
Normal file
9
x1/selftester/selftester.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <libbrain.h>
|
||||||
|
|
||||||
|
int main(void *arg)
|
||||||
|
{
|
||||||
|
typedef void (*FUNC_POINTER)();
|
||||||
|
FUNC_POINTER func = (FUNC_POINTER)0x60198000;
|
||||||
|
func();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user