From d70738eea6e5949ccc459030617f6b45692ddfc2 Mon Sep 17 00:00:00 2001 From: babbleberry Date: Mon, 22 Apr 2024 10:50:24 +0100 Subject: [PATCH] Updated to add -mstrict-align and use Apple Silicon gcc --- part10-multicore/Makefile.gcc | 4 ++-- part10-multicore/multicore.h | 8 ++++---- part11-breakout-smp/Makefile.gcc | 4 ++-- part11-breakout-smp/include/multicore.h | 8 ++++---- part12-wgt/include/multicore.h | 8 ++++---- part13-interrupts/Makefile.gcc | 4 ++-- part13-interrupts/include/multicore.h | 8 ++++---- part14-spi-ethernet/Makefile.gcc | 4 ++-- part14-spi-ethernet/include/multicore.h | 8 ++++---- part15-tcpip-webserver/Makefile.gcc | 4 ++-- part15-tcpip-webserver/include/multicore.h | 8 ++++---- part2-building/Makefile.gcc | 4 ++-- part3-helloworld/Makefile.gcc | 4 ++-- part4-miniuart/Makefile.gcc | 4 ++-- part5-framebuffer/Makefile.gcc | 4 ++-- part6-breakout/Makefile.gcc | 4 ++-- part7-bluetooth/Makefile.gcc | 4 ++-- part8-breakout-ble/Makefile.gcc | 4 ++-- part8-breakout-ble/Makefile.gcc.windows | 22 ---------------------- part9-sound/Makefile.gcc | 4 ++-- 20 files changed, 50 insertions(+), 72 deletions(-) delete mode 100644 part8-breakout-ble/Makefile.gcc.windows diff --git a/part10-multicore/Makefile.gcc b/part10-multicore/Makefile.gcc index 9fe0560..4acdd75 100644 --- a/part10-multicore/Makefile.gcc +++ b/part10-multicore/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part10-multicore/multicore.h b/part10-multicore/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part10-multicore/multicore.h +++ b/part10-multicore/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part11-breakout-smp/Makefile.gcc b/part11-breakout-smp/Makefile.gcc index 023aa68..cc845ee 100644 --- a/part11-breakout-smp/Makefile.gcc +++ b/part11-breakout-smp/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c lib/*.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part11-breakout-smp/include/multicore.h b/part11-breakout-smp/include/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part11-breakout-smp/include/multicore.h +++ b/part11-breakout-smp/include/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part12-wgt/include/multicore.h b/part12-wgt/include/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part12-wgt/include/multicore.h +++ b/part12-wgt/include/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part13-interrupts/Makefile.gcc b/part13-interrupts/Makefile.gcc index fa40d98..bb4ce8a 100644 --- a/part13-interrupts/Makefile.gcc +++ b/part13-interrupts/Makefile.gcc @@ -1,8 +1,8 @@ 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 +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part13-interrupts/include/multicore.h b/part13-interrupts/include/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part13-interrupts/include/multicore.h +++ b/part13-interrupts/include/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part14-spi-ethernet/Makefile.gcc b/part14-spi-ethernet/Makefile.gcc index d8316fd..94770c4 100644 --- a/part14-spi-ethernet/Makefile.gcc +++ b/part14-spi-ethernet/Makefile.gcc @@ -1,8 +1,8 @@ CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c) SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) -GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part14-spi-ethernet/include/multicore.h b/part14-spi-ethernet/include/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part14-spi-ethernet/include/multicore.h +++ b/part14-spi-ethernet/include/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part15-tcpip-webserver/Makefile.gcc b/part15-tcpip-webserver/Makefile.gcc index cb4b843..4674ebf 100644 --- a/part15-tcpip-webserver/Makefile.gcc +++ b/part15-tcpip-webserver/Makefile.gcc @@ -1,8 +1,8 @@ CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c) SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) -GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part15-tcpip-webserver/include/multicore.h b/part15-tcpip-webserver/include/multicore.h index 4c3dc0f..56d8cfb 100644 --- a/part15-tcpip-webserver/include/multicore.h +++ b/part15-tcpip-webserver/include/multicore.h @@ -1,7 +1,7 @@ -extern unsigned int spin_cpu0; -extern unsigned int spin_cpu1; -extern unsigned int spin_cpu2; -extern unsigned int spin_cpu3; +extern unsigned long spin_cpu0; +extern unsigned long spin_cpu1; +extern unsigned long spin_cpu2; +extern unsigned long spin_cpu3; void start_core1(void (*func)(void)); void start_core2(void (*func)(void)); diff --git a/part2-building/Makefile.gcc b/part2-building/Makefile.gcc index ae02b77..f1cfea7 100644 --- a/part2-building/Makefile.gcc +++ b/part2-building/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part3-helloworld/Makefile.gcc b/part3-helloworld/Makefile.gcc index ae02b77..f1cfea7 100644 --- a/part3-helloworld/Makefile.gcc +++ b/part3-helloworld/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part4-miniuart/Makefile.gcc b/part4-miniuart/Makefile.gcc index ae02b77..f1cfea7 100644 --- a/part4-miniuart/Makefile.gcc +++ b/part4-miniuart/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part5-framebuffer/Makefile.gcc b/part5-framebuffer/Makefile.gcc index ae02b77..f1cfea7 100644 --- a/part5-framebuffer/Makefile.gcc +++ b/part5-framebuffer/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part6-breakout/Makefile.gcc b/part6-breakout/Makefile.gcc index ae02b77..f1cfea7 100644 --- a/part6-breakout/Makefile.gcc +++ b/part6-breakout/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part7-bluetooth/Makefile.gcc b/part7-bluetooth/Makefile.gcc index a22d069..373731d 100644 --- a/part7-bluetooth/Makefile.gcc +++ b/part7-bluetooth/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part8-breakout-ble/Makefile.gcc b/part8-breakout-ble/Makefile.gcc index a22d069..373731d 100644 --- a/part8-breakout-ble/Makefile.gcc +++ b/part8-breakout-ble/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img diff --git a/part8-breakout-ble/Makefile.gcc.windows b/part8-breakout-ble/Makefile.gcc.windows deleted file mode 100644 index ac37e4a..0000000 --- a/part8-breakout-ble/Makefile.gcc.windows +++ /dev/null @@ -1,22 +0,0 @@ -CFILES = $(wildcard *.c) -OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ..\..\gcc-arm-10.2-2020.11-mingw-w64-i686-aarch64-none-elf\bin - -all: clean kernel8.img - -boot.o: boot.S - $(GCCPATH)\aarch64-none-elf-gcc $(GCCFLAGS) -c boot.S -o boot.o - -BCM4345C0.o : BCM4345C0.hcd - $(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.o $(OFILES) BCM4345C0.o - $(GCCPATH)\aarch64-none-elf-ld -nostdlib boot.o $(OFILES) BCM4345C0.o -T link.ld -o kernel8.elf - $(GCCPATH)\aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img - -clean: - del kernel8.elf *.o *.img diff --git a/part9-sound/Makefile.gcc b/part9-sound/Makefile.gcc index 9fe0560..4acdd75 100644 --- a/part9-sound/Makefile.gcc +++ b/part9-sound/Makefile.gcc @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) -GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles -mstrict-align +GCCPATH = ../../arm-gnu-toolchain-13.2.Rel1-darwin-arm64-aarch64-none-elf/bin all: clean kernel8.img