From 04a58dfad4e2193c51825c9690a7600e9c834704 Mon Sep 17 00:00:00 2001 From: isometimes Date: Wed, 13 Oct 2021 10:33:40 +0100 Subject: [PATCH] Added Makefile.gcc to part13 --- part13-interrupts/Makefile.gcc | 20 ++++++++++++++++++++ part13-interrupts/boot/boot.S | 8 ++++---- part13-interrupts/{lib => kernel}/utils.S | 0 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 part13-interrupts/Makefile.gcc rename part13-interrupts/{lib => kernel}/utils.S (100%) diff --git a/part13-interrupts/Makefile.gcc b/part13-interrupts/Makefile.gcc new file mode 100644 index 0000000..fa40d98 --- /dev/null +++ b/part13-interrupts/Makefile.gcc @@ -0,0 +1,20 @@ +CFILES = $(wildcard *.c lib/*.c kernel/*.c) +SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) +OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles +GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin + +all: clean kernel8.img + +%.o: %.c + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ + +%.o: %.S + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ + +kernel8.img: $(OFILES) + $(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf + $(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img + +clean: + /bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true diff --git a/part13-interrupts/boot/boot.S b/part13-interrupts/boot/boot.S index 9ec5181..f644aee 100644 --- a/part13-interrupts/boot/boot.S +++ b/part13-interrupts/boot/boot.S @@ -87,22 +87,22 @@ el1_entry: .ltorg -.org 0x100 +.org 0x110 .globl spin_cpu0 spin_cpu0: .quad 0 -.org 0x108 +.org 0x118 .globl spin_cpu1 spin_cpu1: .quad 0 -.org 0x110 +.org 0x120 .globl spin_cpu2 spin_cpu2: .quad 0 -.org 0x118 +.org 0x128 .globl spin_cpu3 spin_cpu3: .quad 0 diff --git a/part13-interrupts/lib/utils.S b/part13-interrupts/kernel/utils.S similarity index 100% rename from part13-interrupts/lib/utils.S rename to part13-interrupts/kernel/utils.S