From 84c6ad9ac0ca657191489b5a646adb16659a8cd6 Mon Sep 17 00:00:00 2001 From: agh Date: Thu, 3 Dec 2020 15:32:43 +0100 Subject: [PATCH] add attiny2313 hello world --- attiny2313/Makefile | 9 +++++++++ attiny2313/hello.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 attiny2313/Makefile create mode 100644 attiny2313/hello.c diff --git a/attiny2313/Makefile b/attiny2313/Makefile new file mode 100755 index 0000000..5923a5f --- /dev/null +++ b/attiny2313/Makefile @@ -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 diff --git a/attiny2313/hello.c b/attiny2313/hello.c new file mode 100644 index 0000000..0703f5a --- /dev/null +++ b/attiny2313/hello.c @@ -0,0 +1,16 @@ +#define F_CPU 1000000UL + +#include +#include + +int main() { + uint8_t x = 0b00000001; + DDRB = 0b00000001; + PORTB = 0b00000000; + while (1) { + x = (!DDRB && (x)) || (DDRB && (!x)); + PORTB = x; + _delay_ms(1000); + } + return(0); +}