attiny10 test
This commit is contained in:
parent
4356a11d56
commit
78667968a8
1
C/attiny10-test/.envrc
Normal file
1
C/attiny10-test/.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake ../..#avr
|
2
C/attiny10-test/.gitignore
vendored
Normal file
2
C/attiny10-test/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.o
|
||||||
|
*.elf
|
12
C/attiny10-test/Makefile
Normal file
12
C/attiny10-test/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
AVRDUDE ?= avrdude -p t10 -c atmelice_tpi
|
||||||
|
CC = avr-gcc
|
||||||
|
CFLAGS = -mmcu=attiny10 -Wall -std=c11 -Os -DF_CPU=1000000 -L$(LIBC)/avr/lib/avrtiny -B$(LIBC)/avr/lib/avrtiny
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
|
main.elf: main.o
|
||||||
|
$(CC) $(CFLAGS) main.o -o main.elf
|
||||||
|
|
||||||
|
flash: main.elf
|
||||||
|
$(AVRDUDE) -U flash:w:main.elf:e
|
10
C/attiny10-test/main.c
Normal file
10
C/attiny10-test/main.c
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
DDRB = 1 << 2;
|
||||||
|
while(1) {
|
||||||
|
PORTB ^= 1 << 2;
|
||||||
|
_delay_ms(500);
|
||||||
|
}
|
||||||
|
}
|
|
@ -82,7 +82,14 @@
|
||||||
];
|
];
|
||||||
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
|
||||||
};
|
};
|
||||||
|
devShells.avr = with pkgs; pkgsCross.avr.mkShell {
|
||||||
|
packages = [
|
||||||
|
avrdude
|
||||||
|
gnumake
|
||||||
|
];
|
||||||
|
|
||||||
|
LIBC = pkgsCross.avr.avrlibc;
|
||||||
|
};
|
||||||
devShells.typst = with pkgs; mkShell { packages = [ typst ]; };
|
devShells.typst = with pkgs; mkShell { packages = [ typst ]; };
|
||||||
formatter = pkgs.nixfmt;
|
formatter = pkgs.nixfmt;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue