--- /dev/null
+CC=avr-gcc
+CFLAGS=-mmcu=atmega16 -g
+OBJCOPY=avr-objcopy
+PROG=dragon_jtag
+PORT=usb
+PMCU=m16
+
+all: bmc.bin
+
+bmc: bmc.o
+
+bmc.bin: bmc
+ $(OBJCOPY) -j .text -j .data -O binary $^ $@
+
+flash: bmc.bin
+ avrdude -v -c $(PROG) -P $(PORT) -p $(PMCU) -U flash:w:$^
+
+debug: bmc bmc.bin
+ setsid avarice -g -D :4242
+ -avr-gdb -ex 'target remote localhost:4242' bmc
+ -pkill avarice
+
+clean:
+ -rm -f *.o bmc bmc.bin
+
+.PHONY: all clean flash debug
--- /dev/null
+#define F_CPU 1000000UL\r
+\r
+#include <avr/io.h>\r
+\r
+int main(void)\r
+{\r
+ uint8_t pb = 0x00;\r
+ int8_t dir = 1;\r
+ volatile uint16_t i;\r
+\r
+ DDRB = 0xff;\r
+\r
+ while(1) {\r
+ pb += dir;\r
+ PORTB = pb;\r
+\r
+ for (i = 0; i < (pb<<5); i++) {}\r
+\r
+ if ((pb == 0) || (pb == 0xff))\r
+ dir = -dir;\r
+ }\r
+\r
+ return 0;\r
+}\r