Initial import

This commit is contained in:
Jan Philipp Timme 2019-03-09 12:50:49 +01:00
commit 420b7d6591
3 changed files with 37 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.hex
*.elf
*.o

17
blink.c Normal file
View File

@ -0,0 +1,17 @@
#include <avr/io.h>
#define F_CPU 20000000UL
#include <util/delay.h>
int main() {
DDRB |= 1;
while(1) {
PORTB |= 1;
_delay_ms(50);
PORTB &= ~1;
_delay_ms(950);
}
return 1;
}

16
buildandupload.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Cleanup
rm -vf *.o *.elf *.hex
# Compile
/home/jpt/arduino-1.8.8/hardware/tools/avr/bin/avr-gcc -c -mmcu=atmega328p blink.c
# Link
/home/jpt/arduino-1.8.8/hardware/tools/avr/bin/avr-gcc -g -mmcu=atmega328p blink.o -o blink.elf
# Convert hex
/home/jpt/arduino-1.8.8/hardware/tools/avr/bin/avr-objcopy -j .text -j .data -O ihex blink.elf blink.hex
# Upload
avrdude -P /dev/ttyUSB0 -c arduino -p m328p -b 19200 -U flash:w:blink.hex