diff options
Diffstat (limited to 'asm/blink')
-rwxr-xr-x | asm/blink/avrdasm | 2 | ||||
-rw-r--r-- | asm/blink/blink.s | 12 | ||||
-rw-r--r-- | asm/blink/dat.h | 20 | ||||
-rw-r--r-- | asm/blink/makefile | 17 |
4 files changed, 51 insertions, 0 deletions
diff --git a/asm/blink/avrdasm b/asm/blink/avrdasm new file mode 100755 index 0000000..ea0707b --- /dev/null +++ b/asm/blink/avrdasm @@ -0,0 +1,2 @@ +#!/bin/sh +avr-objdump -D *.elf diff --git a/asm/blink/blink.s b/asm/blink/blink.s new file mode 100644 index 0000000..8577db3 --- /dev/null +++ b/asm/blink/blink.s @@ -0,0 +1,12 @@ +.include "dat.h" + +.globl main +main: + ldi r16, 1<<DDRB5 + ori r16, 1<<DDRB4 + ldi r17, 0<<PORTB5 + ldi r17, 1<<PORTB4 + out DDRB, r16 + out PORTB, r17 +halt: + rjmp halt diff --git a/asm/blink/dat.h b/asm/blink/dat.h new file mode 100644 index 0000000..d3783b6 --- /dev/null +++ b/asm/blink/dat.h @@ -0,0 +1,20 @@ +/* Data Registers */ +.equ PORTB, 0x05 +.equ PORTB0, 0 +.equ PORTB1, 1 +.equ PORTB2, 2 +.equ PORTB3, 3 +.equ PORTB4, 4 +.equ PORTB5, 5 +.equ PORTB6, 6 +.equ PORTB7, 7 +/* Data Direction Registers */ +.equ DDRB, 0x04 +.equ DDRB0, 0 +.equ DDRB1, 1 +.equ DDRB2, 2 +.equ DDRB3, 3 +.equ DDRB4, 4 +.equ DDRB5, 5 +.equ DDRB6, 6 +.equ DDRB7, 7 diff --git a/asm/blink/makefile b/asm/blink/makefile new file mode 100644 index 0000000..4790211 --- /dev/null +++ b/asm/blink/makefile @@ -0,0 +1,17 @@ +CC=avr-gcc +AS=avr-as + +PORT=/dev/ttyACM0 +TARG=blink + +all: build + +build: + $(AS) -mmcu=atmega328p -o $(TARG).elf $(TARG).s + avr-objcopy -j .text -j .data -O ihex $(TARG).elf $(TARG).hex + +burn: + avrdude -v -p atmega328p -c arduino -P $(PORT) -b 115200 -D -U flash:w:$(TARG).hex + +clean: + rm -f $(TARG).elf $(TARG).hex |