From: Michael Gernoth Date: Sun, 22 Aug 2010 10:10:14 +0000 (+0200) Subject: first bits for AVR BMC firmware X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/commitdiff_plain/d7bda89e596d43e5a9920269612f992e92d5ada3?ds=sidebyside first bits for AVR BMC firmware --- diff --git a/bmc/Makefile b/bmc/Makefile new file mode 100644 index 0000000..85ecb0b --- /dev/null +++ b/bmc/Makefile @@ -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 index 0000000..06a3829 --- /dev/null +++ b/bmc/bmc.c @@ -0,0 +1,24 @@ +#define F_CPU 1000000UL + +#include + +int main(void) +{ + uint8_t pb = 0x00; + int8_t dir = 1; + volatile uint16_t i; + + DDRB = 0xff; + + while(1) { + pb += dir; + PORTB = pb; + + for (i = 0; i < (pb<<5); i++) {} + + if ((pb == 0) || (pb == 0xff)) + dir = -dir; + } + + return 0; +}