Browse Source

init. works.

master
heck 3 years ago
parent
commit
6bd429ede5
  1. 25
      Makefile
  2. 2
      README.md
  3. 18
      led.c

25
Makefile

@ -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

2
README.md

@ -1,2 +1,2 @@
# 32u4-seq

18
led.c

@ -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…
Cancel
Save