
3 changed files with 44 additions and 1 deletions
@ -0,0 +1,25 @@ |
|||
|
|||
|
|||
|
|||
MMCU=atmega32u4 |
|||
MMCU_DUDE=m32u4 |
|||
.PHONY: all clean |
|||
|
|||
all: flash |
|||
|
|||
compile: |
|||
avr-gcc -g -Os -mmcu=$(MMCU) -c led.c |
|||
|
|||
link: compile |
|||
avr-gcc -g -mmcu=$(MMCU) -o led.elf led.o |
|||
|
|||
assemble: link |
|||
avr-objcopy -j .text -j .data -O ihex led.elf led.hex |
|||
|
|||
flash: assemble |
|||
avrdude -p $(MMCU_DUDE) -c stk500 -P /dev/cu.usbserial-1220 -U flash:w:led.hex:i |
|||
|
|||
clean: |
|||
rm *.o |
|||
rm *.elf |
|||
rm *.hex |
@ -1,2 +1,2 @@ |
|||
# 32u4-seq |
|||
|
|||
|
|||
|
@ -0,0 +1,18 @@ |
|||
#ifndef F_CPU |
|||
#define F_CPU 16000000UL // or whatever may be your frequency
|
|||
#endif |
|||
|
|||
#include <avr/io.h> |
|||
//#include <avr/uart.h>
|
|||
#include <util/delay.h> // for _delay_ms() |
|||
|
|||
int main(void) { |
|||
DDRD = 0xff; |
|||
while (1) { |
|||
PORTD = 0xff; |
|||
_delay_ms(100); |
|||
|
|||
PORTD = 0x00; |
|||
_delay_ms(100); |
|||
} |
|||
} |
Loading…
Reference in new issue