aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 11 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index caa0154..ff9c22d 100644
--- a/Makefile
+++ b/Makefile
@@ -2,44 +2,28 @@ CFLAGS=-mcpu=cortex-a7 -ffreestanding -std=gnu11 -Wall -Wextra -I.
ELFFLAGS=-ffreestanding -O2 -nostdlib -lgcc -I.
-all : kernel7.img
-
-kernel.o : kernel.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
+ARM_OBJECTS=kernel.o paging.o demo_functionality.o PL0_test.o uart.o loader_stage1.o loader_stage2.o
-paging.o : paging.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-
-demo_functionality.o : demo_functionality.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
+all : kernel7.img
-PL0_test.o : PL0_test.c
+%.o : %.c
arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-PL_0_test.elf : PL0_test.o uart.o
- arm-none-eabi-gcc -T PL0_test.ld -o $@ $(ELFFLAGS) $^
+%.o : %.S
+ arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@
-PL_0_test.img : PL_0_test.elf
+%.img : %.elf
arm-none-eabi-objcopy $^ -O binary $@
-PL_0_test_embeddable.o : PL_0_test.img
+%_embeddable.o : %.img
arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata $^ $@
-uart.o : uart.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-
-boot.o : boot.S
- arm-none-eabi-as -mcpu=cortex-a7 $^ -o $@
+PL_0_test.elf : PL0_test.o uart.o
+ arm-none-eabi-gcc -T PL0_test.ld -o $@ $(ELFFLAGS) $^
kernel.elf : boot.o kernel.o uart.o PL_0_test_embeddable.o demo_functionality.o paging.o
arm-none-eabi-gcc -T linker.ld -o $@ $(ELFFLAGS) $^
-kernel7.img : kernel.elf
- arm-none-eabi-objcopy $^ -O binary $@
-
-loader_stage2.o : loader_stage2.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-
loader_stage2.elf : loader_stage2.o uart.o
arm-none-eabi-gcc -T loader_stage2.ld -o $@ $(ELFFLAGS) $^
@@ -47,25 +31,17 @@ loader_stage2.img : loader_stage2.elf
arm-none-eabi-objcopy $^ -O binary $@
test -n "$$(find $@ -size -16384c)" || exit -1
-loader_stage2_embeddable.o : loader_stage2.img
- arm-none-eabi-objcopy -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata $^ $@
-
-loader_stage1.o : loader_stage1.c
- arm-none-eabi-gcc $(CFLAGS) -c $^ -o $@
-
loader.elf : boot.o loader_stage1.o loader_stage2_embeddable.o
arm-none-eabi-gcc -T loader_stage1.ld -o $@ $(ELFFLAGS) $^
-loader.img : loader.elf
- arm-none-eabi-objcopy $^ -O binary $@
qemu-elf : kernel.elf
qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $^
-qemu-bin : loader.elf kernel7.img pipe_image
+qemu-bin : loader.elf kernel.img pipe_image
./pipe_image --stdout | qemu-system-arm -m 256 -M raspi2 -serial stdio -kernel $<
-run-on-rpi : kernel7.img pipe_image
+run-on-rpi : kernel.img pipe_image
./pipe_image --stdout | socat FILE:/dev/ttyUSB0,b115200,raw -
sleep 1
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,-hupcl