]> git.zerfleddert.de Git - rsbs2/commitdiff
first bits for AVR BMC firmware
authorMichael Gernoth <michael@gernoth.net>
Sun, 22 Aug 2010 10:10:14 +0000 (12:10 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sun, 22 Aug 2010 10:10:14 +0000 (12:10 +0200)
bmc/Makefile [new file with mode: 0644]
bmc/bmc.c [new file with mode: 0644]

diff --git a/bmc/Makefile b/bmc/Makefile
new file mode 100644 (file)
index 0000000..85ecb0b
--- /dev/null
@@ -0,0 +1,26 @@
+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
diff --git a/bmc/bmc.c b/bmc/bmc.c
new file mode 100644 (file)
index 0000000..06a3829
--- /dev/null
+++ b/bmc/bmc.c
@@ -0,0 +1,24 @@
+#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
Impressum, Datenschutz