summaryrefslogtreecommitdiffhomepage
path: root/src/arm64/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm64/makefile')
-rw-r--r--src/arm64/makefile69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/arm64/makefile b/src/arm64/makefile
new file mode 100644
index 0000000..19f88f5
--- /dev/null
+++ b/src/arm64/makefile
@@ -0,0 +1,69 @@
+ #
+ # ========================================================
+ #
+ # CoreBoot
+ # Date Added: 08/11/2023
+ # Copyright 2024, ZKA Technologies, all rights reserved.
+ #
+ # ========================================================
+ #
+
+CC=arm-none-eabi-gcc
+AS=arm-none-eabi-as
+
+FIRMWARE=boot.rom
+
+FLAGS=-c -D__COMPILE_ARM64__ -I../../ -Wall -c -nostdlib -ffreestanding -fno-builtin \
+ -D__BSTRICT__ -D__BDEBUG__
+
+C_SRC=$(wildcard *.c) $(wildcard ../*.c) -c
+
+AS_FLAGS= -c -I../../
+
+LD=arm-none-eabi-ld
+OBJ=*.o
+FLAGS_LD= --script=script.lds -o core-boot.elf -nostdlib
+
+EMU=qemu-system-arm
+EMU_FLAGS=-M virt -cpu cortex-a15 -kernel $(FIRMWARE) -s \
+ -drive file=bootstg2.rom,format=raw
+
+WAIT=sleep 1
+
+.PHONY: all
+all: firmware-link
+ @echo "[CoreBoot] build done."
+
+.PHONY: firmware-link
+firmware-link: firmware-compile
+ $(LD) $(OBJ) $(FLAGS_LD)
+
+.PHONY: rom
+rom:
+ qemu-img create -f qcow2 epm.img 256M
+ qemu-img create -f raw boot.rom 512K
+ qemu-img create -f raw bootstg2.rom 64M
+ dd if=core-boot.elf of=boot.rom bs=1 seek=0 conv=notrunc
+
+# compile firmware
+.PHONY: firmware-compile
+firmware-compile:
+ $(CC) $(FLAGS) $(C_SRC)
+ $(AS) -march=armv7-a -mcpu=cortex-a15 arm64-start-context.S -o arm64-start-context.o
+ $(AS) -march=armv7-a -mcpu=cortex-a15 arm64-boot.S -o arm64-boot.o
+
+
+# launch qemu rule
+.PHONY: run
+run:
+ $(EMU) $(EMU_FLAGS)
+
+# launch qemu with attached debugger
+.PHONY: run-dbg
+run-dbg:
+ $(EMU) $(EMU_FLAGS)
+
+# remove object files
+.PHONY: clean
+clean:
+ rm -f $(wildcard *.o) $(wildcard *.elf) $(wildcard *.rom) $(wildcard *.epm)