1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-16 18:05:19 +02:00

uart/fw/: dummy firmware with build and programming process

This commit is contained in:
Werner Almesberger 2011-02-01 22:45:54 -03:00
parent 1826cc2d89
commit 979be291e3
2 changed files with 44 additions and 0 deletions

25
uart/fw/Makefile Normal file
View File

@ -0,0 +1,25 @@
CFLAGS = -g -Wall -Wshadow -Werror \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CHIP=atmega48
AVR_PREFIX = $(BIN_PATH) avr-
CC = $(AVR_PREFIX)gcc
OBJCOPY = $(AVR_PREFIX)objcopy
#OBJDUMP = $(AVR_PREFIX)objdump
.PHONY: all upload prog
all: uart.bin
%.elf: %.c
$(CC) -mmcu=$(CHIP) -Os -o $@ $<
%.bin: %.elf
$(OBJCOPY) -j .text -j .data -O binary $< $@
upload: uart.bin
scp uart.bin jlime:
prog:
ssh jlime avrdude -p atmega48 -c nanonote_uart -e -U flash:w:uart.bin:r

19
uart/fw/uart.c Normal file
View File

@ -0,0 +1,19 @@
#include <stdint.h>
#include <avr/io.h>
#define F_CPU 1000000UL
#include <util/delay.h>
#define LED 2 /* PD2 */
int main(void)
{
DDRD = 1 << LED;
while (1) {
PORTD ^= 1 << LED;
_delay_ms(50);
}
}