Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit c0b444adb788112e69f555733fe9a4155a3a6bf6 @esmil esmil committed Jul 17, 2010
Showing with 1,320 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +63 −0 Makefile
  3. +451 −0 arduino_code/arduino_code.cpp.hex
  4. +358 −0 arduino_code/arduino_code.pde
  5. +443 −0 door.c
@@ -0,0 +1,5 @@
+# Lines that start with '#' are comments.
+*.o
+*.elf
+*.hex
+*.lss
@@ -0,0 +1,63 @@
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+AVRDUDE = avrdude
+STTY = stty
+SED = sed
+
+NAME = door
+
+MCU = atmega328p
+F_CPU = 16000000UL
+FORMAT = ihex
+PORT = /dev/ttyUSB0
+BAUD_RATE = 57600
+PROGRAMMER = arduino
+ARDUINO_HEADERS = ..
+CFLAGS = -Os -g -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
+ -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \
+ -Wall -Wextra -pedantic -I$(ARDUINO_HEADERS)
+
+.PHONY: all list tty
+.PRECIOUS: %.o %.elf
+
+all: $(NAME).hex
+
+%.o: %.c %.h
+ @echo ' CC $@'
+ @$(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.c
+ @echo ' CC $@'
+ @$(CC) $(CFLAGS) -c $< -o $@
+
+%.elf: %.o
+ @echo ' LD $@'
+ @$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
+
+%.hex: %.elf
+ @echo ' OBJCOPY $@'
+ @$(OBJCOPY) -O $(FORMAT) -R .eeprom -S $< $@ && \
+ echo " $$((0x$$($(OBJDUMP) -h $@ | \
+ $(SED) -n '6{s/^ 0 \.sec1 //;s/ .*//;p}'))) bytes"
+
+# Create extended listing file from ELF output file.
+%.lss: %.elf
+ @echo ' OBJDUMP > $@'
+ @$(OBJDUMP) -h -S $< > $@
+
+upload: $(NAME).hex
+ @$(AVRDUDE) -vD -c$(PROGRAMMER) -b$(BAUD_RATE) -p$(MCU) -P$(PORT) -Uflash:w:$<:i
+
+list: $(NAME).lss
+
+tty:
+ @echo ' STTY -F$(PORT) cs8 parenb -parodd raw -echo 9600'
+ @$(STTY) -F$(PORT) cs8 parenb -parodd raw -echo 9600
+
+tty2:
+ @echo ' STTY -F$(PORT) cs8 -parenb raw -echo 9600'
+ @$(STTY) -F$(PORT) cs8 -parenb raw -echo 9600
+
+clean:
+ rm -f *.o *.elf *.hex *.lss
Oops, something went wrong.

0 comments on commit c0b444a

Please sign in to comment.