add attiny2313 hello world
This commit is contained in:
parent
b8b860c84d
commit
84c6ad9ac0
9
attiny2313/Makefile
Executable file
9
attiny2313/Makefile
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
#avr-gcc -std=c99 -Os -Wall -mmcu=attiny2313 -S -o hello.s hello.c
|
||||||
|
#avr-gcc -Os -Wall -mmcu=attiny2313 -c -o hello.o hello.s
|
||||||
|
#avr-gcc -Os -Wall -mmcu=attiny2313 -o hello.out hello.o
|
||||||
|
#avr-strip hello.out
|
||||||
|
|
||||||
|
avr-gcc -Os -std=c99 -Wall -mmcu=attiny2313 -o hello.out hello.c
|
||||||
|
avr-strip hello.out
|
||||||
16
attiny2313/hello.c
Normal file
16
attiny2313/hello.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#define F_CPU 1000000UL
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
uint8_t x = 0b00000001;
|
||||||
|
DDRB = 0b00000001;
|
||||||
|
PORTB = 0b00000000;
|
||||||
|
while (1) {
|
||||||
|
x = (!DDRB && (x)) || (DDRB && (!x));
|
||||||
|
PORTB = x;
|
||||||
|
_delay_ms(1000);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user