From d5b64f4c8d40fb6868fef2336ff25d7132195712 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Fri, 12 Feb 2021 12:45:11 +0000 Subject: [PATCH] Tested part7 with -O2 optimisation in Makefile --- part7-bluetooth/Makefile | 2 +- part7-bluetooth/bt.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/part7-bluetooth/Makefile b/part7-bluetooth/Makefile index 44bd023..143c51b 100644 --- a/part7-bluetooth/Makefile +++ b/part7-bluetooth/Makefile @@ -1,7 +1,7 @@ CFILES = $(wildcard *.c) OFILES = $(CFILES:.c=.o) LLVMPATH = /opt/homebrew/opt/llvm/bin -GCCFLAGS = -Wall -O0 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd +GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd all: clean kernel8.img diff --git a/part7-bluetooth/bt.c b/part7-bluetooth/bt.c index 7d148fe..800f5b4 100644 --- a/part7-bluetooth/bt.c +++ b/part7-bluetooth/bt.c @@ -1,7 +1,7 @@ #include "io.h" #include "fb.h" -unsigned char *params = (unsigned char *)SAFE_ADDRESS; +volatile unsigned char *params = (unsigned char *)SAFE_ADDRESS; // UART0 @@ -93,7 +93,7 @@ enum { unsigned char empty[] = {}; -int hciCommandBytes(unsigned char *opcodebytes, unsigned char *data, unsigned char length) +int hciCommandBytes(volatile unsigned char *opcodebytes, volatile unsigned char *data, unsigned char length) { unsigned char c=0; @@ -130,7 +130,7 @@ int hciCommandBytes(unsigned char *opcodebytes, unsigned char *data, unsigned ch return 0; } -int hciCommand(unsigned short ogf, unsigned short ocf, unsigned char *data, unsigned char length) +int hciCommand(unsigned short ogf, unsigned short ocf, volatile unsigned char *data, unsigned char length) { unsigned short opcode = ogf << 10 | ocf; unsigned char opcodebytes[2] = { lo(opcode), hi(opcode) };