diff --git a/assignment/README b/assignment/README new file mode 100644 index 0000000..78e2265 --- /dev/null +++ b/assignment/README @@ -0,0 +1,16 @@ +Use this directory for your final game and its module(s). Only the +files in this directory will be marked. + +Ensure you use the git add command to add your files to the git +repository. For example, + +git add module.c + +Then use the git commit command to add the file contents + +git commit -m "Added file" module.c + +The use the git push command to copy the changes to the remote git server + +git push + diff --git a/assignment/final/Makefile b/assignment/final/Makefile new file mode 100644 index 0000000..54a8871 --- /dev/null +++ b/assignment/final/Makefile @@ -0,0 +1,45 @@ +# File: Makefile +# Author: M. P. Hayes, UCECE +# Date: 12 Sep 2010 +# Descr: Makefile for game + +# Definitions. +CC = avr-gcc +CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g -I. -I../../utils -I../../fonts -I../../drivers -I../../drivers/avr +OBJCOPY = avr-objcopy +SIZE = avr-size +DEL = rm + + +# Default target. +all: game.out + + +# Compile: create object files from C source files. +game.o: game.c ../../drivers/avr/system.h + $(CC) -c $(CFLAGS) $< -o $@ + +system.o: ../../drivers/avr/system.c ../../drivers/avr/system.h + $(CC) -c $(CFLAGS) $< -o $@ + + + +# Link: create ELF output file from object files. +game.out: game.o system.o + $(CC) $(CFLAGS) $^ -o $@ -lm + $(SIZE) $@ + + +# Target: clean project. +.PHONY: clean +clean: + -$(DEL) *.o *.out *.hex + + +# Target: program project. +.PHONY: program +program: game.out + $(OBJCOPY) -O ihex game.out game.hex + dfu-programmer atmega32u2 erase; dfu-programmer atmega32u2 flash game.hex; dfu-programmer atmega32u2 start + + diff --git a/assignment/final/Makefile.test b/assignment/final/Makefile.test new file mode 100644 index 0000000..a9f722a --- /dev/null +++ b/assignment/final/Makefile.test @@ -0,0 +1,43 @@ +# File: Makefile +# Author: M. P. Hayes, UCECE +# Date: 11 Sep 2010 +# Descr: Makefile for game + +CC = gcc +CFLAGS = -Wall -Wstrict-prototypes -Wextra -g -I. -I../../utils -I../../drivers -I../../drivers/test + +DEL = rm + + +# Default target. +all: game + + +# Compile: create object files from C source files. +game-test.o: game.c ../../drivers/test/system.h + $(CC) -c $(CFLAGS) $< -o $@ + +mgetkey-test.o: ../../drivers/test/mgetkey.c ../../drivers/test/mgetkey.h + $(CC) -c $(CFLAGS) $< -o $@ + +pio-test.o: ../../drivers/test/pio.c + $(CC) -c $(CFLAGS) $< -o $@ + +system-test.o: ../../drivers/test/system.c ../../drivers/test/avrtest.h ../../drivers/test/mgetkey.h ../../drivers/test/pio.h ../../drivers/test/system.h + $(CC) -c $(CFLAGS) $< -o $@ + + + + +# Link: create executable file from object files. +game: game-test.o mgetkey-test.o pio-test.o system-test.o + $(CC) $(CFLAGS) $^ -o $@ -lrt + + +# Clean: delete derived files. +.PHONY: clean +clean: + -$(DEL) game game-test.o mgetkey-test.o pio-test.o system-test.o + + + diff --git a/assignment/final/game.c b/assignment/final/game.c new file mode 100644 index 0000000..67b9be5 --- /dev/null +++ b/assignment/final/game.c @@ -0,0 +1,14 @@ +#include "system.h" + +int main (void) +{ + system_init (); + + + while (1) + { + + + + } +}