attiny10 test

This commit is contained in:
Artemis Tosini 2024-03-26 03:03:54 +00:00
parent 4356a11d56
commit 78667968a8
Signed by: artemist
GPG key ID: ADFFE553DCBB831E
5 changed files with 32 additions and 0 deletions

1
C/attiny10-test/.envrc Normal file
View file

@ -0,0 +1 @@
use flake ../..#avr

2
C/attiny10-test/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*.o
*.elf

12
C/attiny10-test/Makefile Normal file
View 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
View 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);
}
}

View file

@ -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;
}); });