From 214704a8678c9ce674b4aa21a6d4fab6bc2e1c5e Mon Sep 17 00:00:00 2001 From: Nelson <75115576+LabNelson@users.noreply.github.com> Date: Wed, 21 Feb 2024 10:55:01 +0100 Subject: [PATCH 1/4] Add files via upload created Makefile for gcc for part11-breakout-smp --- part11-breakout-smp/Makefile.gcc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 part11-breakout-smp/Makefile.gcc diff --git a/part11-breakout-smp/Makefile.gcc b/part11-breakout-smp/Makefile.gcc new file mode 100644 index 0000000..9c0526f --- /dev/null +++ b/part11-breakout-smp/Makefile.gcc @@ -0,0 +1,25 @@ +CFILES = $(wildcard *.c lib/*.c) +OFILES = $(CFILES:.c=.o) +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib +GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin + + +all: clean kernel8.img + +boot/boot.o: boot/boot.S + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c boot/boot.S -o boot/boot.o + +bin/BCM4345C0.o : bin/BCM4345C0.hcd + $(GCCPATH)/aarch64-none-elf-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@ + +bin/audio.o : bin/audio.bin + $(GCCPATH)/aarch64-none-elf-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@ + +%.o: %.c + $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@ + +kernel8.img: boot/boot.o $(OFILES) bin/BCM4345C0.o bin/audio.o + $(GCCPATH)/aarch64-none-elf-ld -nostdlib boot/boot.o $(OFILES) bin/BCM4345C0.o bin/audio.o -T boot/link.ld -o kernel8.elf + $(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img +clean: + /bin/rm kernel8.elf *.o bin/*.o boot/*.o *.img > /dev/null 2> /dev/null || true From fea167dab379e698060e7f3f509c9bf5b09d25dd Mon Sep 17 00:00:00 2001 From: babbleberry Date: Fri, 23 Feb 2024 22:21:52 +0000 Subject: [PATCH 2/4] Added nostartfiles to Makefile.gcc in part11 --- part11-breakout-smp/Makefile.gcc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/part11-breakout-smp/Makefile.gcc b/part11-breakout-smp/Makefile.gcc index 9c0526f..023aa68 100644 --- a/part11-breakout-smp/Makefile.gcc +++ b/part11-breakout-smp/Makefile.gcc @@ -1,9 +1,8 @@ CFILES = $(wildcard *.c lib/*.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin - all: clean kernel8.img boot/boot.o: boot/boot.S From b1c3dfc5d6019dafac50f8de6ad2b0d8d5bbb059 Mon Sep 17 00:00:00 2001 From: babbleberry Date: Fri, 23 Feb 2024 22:31:59 +0000 Subject: [PATCH 3/4] Removed reference to employer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e502673..82dc10e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Writing a "bare metal" operating system for Raspberry Pi 4 Introduction ------------ -As a tech CEO @RealVNC, I don't write code any more. And I've recently realised just how much I miss it. +As a tech CEO, I don't write code any more. And I've recently realised just how much I miss it. Currently in the throes of a nationwide "lockdown" due to Covid-19 (and having been spared my usual commute), I've found myself with more hours in the day. I have taken this time for myself and used it to fulfil a childhood ambition - to write a **bare metal** operating system that runs on commercial hardware. From 8277e48bc2e70ea70a2fa025efe6f5c45b88b252 Mon Sep 17 00:00:00 2001 From: Nelson Ehling Date: Wed, 20 Mar 2024 14:51:11 +0100 Subject: [PATCH 4/4] changed pull up pull down register mapping --- part10-multicore/io.c | 4 ++-- part11-breakout-smp/lib/io.c | 4 ++-- part12-wgt/lib/io.c | 4 ++-- part13-interrupts/lib/io.c | 4 ++-- part14-spi-ethernet/lib/io.c | 4 ++-- part4-miniuart/io.c | 4 ++-- part5-framebuffer/io.c | 4 ++-- part6-breakout/io.c | 4 ++-- part7-bluetooth/io.c | 4 ++-- part8-breakout-ble/io.c | 4 ++-- part9-sound/io.c | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/part10-multicore/io.c b/part10-multicore/io.c index a2a888d..b9ba71f 100644 --- a/part10-multicore/io.c +++ b/part10-multicore/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part11-breakout-smp/lib/io.c b/part11-breakout-smp/lib/io.c index 34a02aa..77e23eb 100644 --- a/part11-breakout-smp/lib/io.c +++ b/part11-breakout-smp/lib/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part12-wgt/lib/io.c b/part12-wgt/lib/io.c index 34a02aa..77e23eb 100644 --- a/part12-wgt/lib/io.c +++ b/part12-wgt/lib/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part13-interrupts/lib/io.c b/part13-interrupts/lib/io.c index 34a02aa..77e23eb 100644 --- a/part13-interrupts/lib/io.c +++ b/part13-interrupts/lib/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part14-spi-ethernet/lib/io.c b/part14-spi-ethernet/lib/io.c index 34a02aa..77e23eb 100644 --- a/part14-spi-ethernet/lib/io.c +++ b/part14-spi-ethernet/lib/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part4-miniuart/io.c b/part4-miniuart/io.c index 9561780..d7b2985 100644 --- a/part4-miniuart/io.c +++ b/part4-miniuart/io.c @@ -17,8 +17,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part5-framebuffer/io.c b/part5-framebuffer/io.c index e8af328..b58f996 100644 --- a/part5-framebuffer/io.c +++ b/part5-framebuffer/io.c @@ -18,8 +18,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part6-breakout/io.c b/part6-breakout/io.c index e06b64d..c5134ab 100644 --- a/part6-breakout/io.c +++ b/part6-breakout/io.c @@ -18,8 +18,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part7-bluetooth/io.c b/part7-bluetooth/io.c index 8a591b7..33b3962 100644 --- a/part7-bluetooth/io.c +++ b/part7-bluetooth/io.c @@ -18,8 +18,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part8-breakout-ble/io.c b/part8-breakout-ble/io.c index 8a591b7..33b3962 100644 --- a/part8-breakout-ble/io.c +++ b/part8-breakout-ble/io.c @@ -18,8 +18,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; } diff --git a/part9-sound/io.c b/part9-sound/io.c index a2a888d..b9ba71f 100644 --- a/part9-sound/io.c +++ b/part9-sound/io.c @@ -19,8 +19,8 @@ enum { enum { Pull_None = 0, - Pull_Down = 1, // Are down and up the right way around? - Pull_Up = 2 + Pull_Down = 2, + Pull_Up = 1 }; void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; }