Add assignment files

main
Michael Hayes 12 years ago
parent 22ec7e2416
commit be4e83bad5

@ -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

@ -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

@ -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

@ -0,0 +1,14 @@
#include "system.h"
int main (void)
{
system_init ();
while (1)
{
}
}
Loading…
Cancel
Save