-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New version, works with external pull-up.
- Loading branch information
Showing
2 changed files
with
388 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
CC=avr-gcc | ||
LD=avr-ld | ||
MCU_TARGET=attiny2313a | ||
DUDE_TARGET=attiny2313 | ||
AVRDUDE=avrdude | ||
PORT=/dev/ttyUSB0 | ||
override CFLAGS=-Wall -g -Os -mmcu=${MCU_TARGET} | ||
override LDFLAGS= | ||
|
||
%.o: %.c | ||
${CC} ${CFLAGS} -c $< | ||
|
||
%.elf: %.o | ||
${LD} ${LDFLAGS} -Map $@.map -o $@ $< /usr/lib/avr/lib/libc.a /usr/lib/avr/lib/avr25/crttn2313a.o | ||
|
||
%.lst: %.elf | ||
avr-objdump -h -S $< > $@ | ||
|
||
%.lst: %.o | ||
avr-objdump -h -S $< > $@ | ||
|
||
%.hex: %.elf | ||
avr-objcopy -j .text -j .data -O ihex $< $@ | ||
|
||
program-%: %.hex | ||
# Write code out | ||
${AVRDUDE} -p ${DUDE_TARGET} -P ${PORT} -U flash:w:$< | ||
|
||
clean: | ||
rm -f *.o *.elf *.elf.map *.lst *.hex | ||
|
||
# Project-specific | ||
install: program-paul_1 | ||
|
||
erase: | ||
${AVRDUDE} -p ${DUDE_TARGET} -P ${PORT} -e | ||
|
||
show-fuses: | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U lfuse:r:/dev/stdout:h | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U hfuse:r:/dev/stdout:h | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U efuse:r:/dev/stdout:h | ||
|
||
set-fuse: | ||
# Nothing to do here. | ||
|
||
clear-fuse: | ||
# Note: bit=1 means "unprogrammed", bit=0 means "programmed" | ||
|
||
# This is the default: internal 8MHz clock divided by 8 = 1MHz clock | ||
# Divide clock by 8 | ||
# |Output clock on CKOUT | ||
# ||SUT1 | ||
# |||SUT0 | ||
# ||||CKSEL3 | ||
# |||||CKSEL2 | ||
# ||||||CKSEL1 | ||
# |||||||CKSEL0 | ||
# |||||||| | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U lfuse:w:0b01100100:m | ||
|
||
# DebugWire | ||
# |EESAVE | ||
# ||SPIEN | ||
# |||WDTON | ||
# ||||BODLEVEL2 | ||
# |||||BODLEVEL1 | ||
# ||||||BODLEVEL0 | ||
# |||||||RSTDISBL | ||
# |||||||| | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U hfuse:w:0b11011111:m | ||
# Default: BOD disabled | ||
|
||
# SELFPRGEN | ||
# | | ||
${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -U efuse:w:0b11111111:m | ||
# Self Programming: disabled | ||
|
||
high-speed: | ||
echo sck 8.68 | ${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -t | ||
|
||
slow-speed: | ||
echo sck 276.7 | ${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -t -F | ||
|
||
voltage: | ||
echo vtarg 3.0 | ${AVRDUDE} -p ${DUDE_TARGET} -P /dev/ttyUSB0 -t -F | ||
|
||
all: slow-speed clear-fuse high-speed install set-fuse |
Oops, something went wrong.