CROSS_COMPILE ?= arm-none-eabi

AOPS = --warn --fatal-warnings -g
COPS = -Wall -Werror -g -O2 -nostdlib -nostartfiles -ffreestanding 

hw05.bin : hw05.s hw05_memmap
	$(CROSS_COMPILE)-as $(AOPS) hw05.s -o hw05.o
	$(CROSS_COMPILE)-ld hw05.o -T hw05_memmap -o hw05.elf
	$(CROSS_COMPILE)-objdump -D hw05.elf > hw05.list
	$(CROSS_COMPILE)-objcopy hw05.elf -O binary hw05.bin


# run with: qemu-system-arm -S -s -M versatilepb -daemonize -m 128M -d in_asm,cpu,exec -kernel hw05.bin
# gdb-multiarch --batch --command=hw05.gdb
#
# qemu-system-arm launches the bare metal ARM processor emulator (along with some other devices, like a UART interface, etc.)
# the -M versatilepb indicates a particular machine mode
# the -m 128M gives the processor access to 128MB RAM
# the program is hw04.bin
# the gdb-multiarch enables a GDB connection to the QEMU system for debugging purposes
#
# to see if the given program works, once running, it should have launched a QEMU console window, then press control+alt+3, which opens the UART port

