Editorial changes
parent
ed4508b07a
commit
12bb0422eb
|
|
@ -58,10 +58,9 @@ Since there is no ICSP header on the board, you have to program the ATtiny eithe
|
||||||
### If using the makefile (Linux/Mac)
|
### If using the makefile (Linux/Mac)
|
||||||
- Make sure you have installed [avr-gcc toolchain and avrdude](http://maxembedded.com/2015/06/setting-up-avr-gcc-toolchain-on-linux-and-mac-os-x/).
|
- Make sure you have installed [avr-gcc toolchain and avrdude](http://maxembedded.com/2015/06/setting-up-avr-gcc-toolchain-on-linux-and-mac-os-x/).
|
||||||
- Connect your programmer to your PC and to the ATtiny.
|
- Connect your programmer to your PC and to the ATtiny.
|
||||||
- Open the makefile and change the chip if you are not using ATtiny85 and the programmer if you are not using usbasp.
|
|
||||||
- Open a terminal.
|
- Open a terminal.
|
||||||
- Navigate to the folder with the makefile and the Arduino sketch.
|
- Navigate to the folder with the makefile and the Arduino sketch.
|
||||||
- Run "make install" to compile, burn the fuses and upload the firmware.
|
- Run `DEVICE=attiny85 PROGRMR=usbasp make install` to compile, burn the fuses and upload the firmware (change DEVICE and PROGRMR accordingly).
|
||||||
|
|
||||||
# Operating Instructions
|
# Operating Instructions
|
||||||
1. Connect the device between a power supply and a consumer.
|
1. Connect the device between a power supply and a consumer.
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,41 @@
|
||||||
|
# ===================================================================================
|
||||||
# Project: USB-Tester
|
# Project: USB-Tester
|
||||||
# Author: Stefan Wagner
|
# Author: Stefan Wagner
|
||||||
# Year: 2020
|
# Year: 2020
|
||||||
# URL: https://github.com/wagiminator
|
# URL: https://github.com/wagiminator
|
||||||
#
|
# ===================================================================================
|
||||||
# Type "make help" in the command line.
|
# Type "make help" in the command line.
|
||||||
|
# ===================================================================================
|
||||||
|
|
||||||
# Input and Output File Names
|
# Input and Output File Names
|
||||||
SKETCH = USB_Tester.ino
|
SKETCH = USB_Tester.ino
|
||||||
TARGET = usb_tester
|
TARGET = usb_tester
|
||||||
|
|
||||||
# Microcontroller Options
|
# Microcontroller Settings
|
||||||
DEVICE = attiny85
|
DEVICE ?= attiny85
|
||||||
CLOCK = 1000000
|
CLOCK = 1000000
|
||||||
PROGRMR = usbasp
|
|
||||||
LFUSE = 0x62
|
LFUSE = 0x62
|
||||||
HFUSE = 0xD5
|
HFUSE = 0xD5
|
||||||
EFUSE = 0xFF
|
EFUSE = 0xFF
|
||||||
|
|
||||||
# Commands
|
# Programmer Settings
|
||||||
|
PROGRMR ?= usbasp
|
||||||
|
|
||||||
|
# Toolchain
|
||||||
|
CC = avr-gcc
|
||||||
|
OBJCOPY = avr-objcopy
|
||||||
|
OBJDUMP = avr-objdump
|
||||||
|
AVRSIZE = avr-size
|
||||||
AVRDUDE = avrdude -c $(PROGRMR) -p $(DEVICE)
|
AVRDUDE = avrdude -c $(PROGRMR) -p $(DEVICE)
|
||||||
COMPILE = avr-gcc -Wall -Os -flto -mmcu=$(DEVICE) -DF_CPU=$(CLOCK) -x c++ $(SKETCH)
|
CLEAN = rm -f *.lst *.obj *.cof *.list *.map *.eep.hex *.o *.s *.d
|
||||||
CLEAN = rm -f *.lst *.obj *.cof *.list *.map *.eep.hex *.o *.s
|
|
||||||
|
# Compiler Flags
|
||||||
|
CFLAGS = -Wall -Os -flto -mmcu=$(DEVICE) -DF_CPU=$(CLOCK) -x c++
|
||||||
|
|
||||||
# Symbolic Targets
|
# Symbolic Targets
|
||||||
help:
|
help:
|
||||||
@echo "Use the following commands:"
|
@echo "Use the following commands:"
|
||||||
@echo "make all compile and build $(TARGET).bin/.hex/.asm for $(DEVICE)"
|
@echo "make all compile and build $(TARGET).elf/.bin/.hex/.asm for $(DEVICE)"
|
||||||
@echo "make hex compile and build $(TARGET).hex for $(DEVICE)"
|
@echo "make hex compile and build $(TARGET).hex for $(DEVICE)"
|
||||||
@echo "make asm compile and disassemble to $(TARGET).asm for $(DEVICE)"
|
@echo "make asm compile and disassemble to $(TARGET).asm for $(DEVICE)"
|
||||||
@echo "make bin compile and build $(TARGET).bin for $(DEVICE)"
|
@echo "make bin compile and build $(TARGET).bin for $(DEVICE)"
|
||||||
|
|
@ -34,18 +44,22 @@ help:
|
||||||
@echo "make install compile, upload and burn fuses for $(DEVICE)"
|
@echo "make install compile, upload and burn fuses for $(DEVICE)"
|
||||||
@echo "make clean remove all build files"
|
@echo "make clean remove all build files"
|
||||||
|
|
||||||
all: buildbin buildhex buildasm removetemp size
|
all: buildelf buildbin buildhex buildasm removetemp size
|
||||||
|
|
||||||
bin: buildbin removetemp size
|
elf: buildelf removetemp size
|
||||||
|
|
||||||
hex: buildbin buildhex removetemp size removebin
|
bin: buildelf buildbin removetemp size removeelf
|
||||||
|
|
||||||
asm: buildbin buildasm removetemp size removebin
|
hex: buildelf buildhex removetemp size removeelf
|
||||||
|
|
||||||
|
asm: buildelf buildasm removetemp size removeelf
|
||||||
|
|
||||||
|
flash: upload fuses
|
||||||
|
|
||||||
install: upload fuses
|
install: upload fuses
|
||||||
|
|
||||||
upload: hex
|
upload: hex
|
||||||
@echo "Uploading to $(DEVICE) ..."
|
@echo "Uploading $(TARGET).hex to $(DEVICE) using $(PROGRMR) ..."
|
||||||
@$(AVRDUDE) -U flash:w:$(TARGET).hex:i
|
@$(AVRDUDE) -U flash:w:$(TARGET).hex:i
|
||||||
|
|
||||||
fuses:
|
fuses:
|
||||||
|
|
@ -55,28 +69,34 @@ fuses:
|
||||||
clean:
|
clean:
|
||||||
@echo "Cleaning all up ..."
|
@echo "Cleaning all up ..."
|
||||||
@$(CLEAN)
|
@$(CLEAN)
|
||||||
@rm -f $(TARGET).bin $(TARGET).hex $(TARGET).asm
|
@rm -f $(TARGET).elf $(TARGET).bin $(TARGET).hex $(TARGET).asm
|
||||||
|
|
||||||
|
buildelf:
|
||||||
|
@echo "Compiling $(SKETCH) for $(DEVICE) @ $(CLOCK)Hz ..."
|
||||||
|
@$(CC) $(CFLAGS) $(SKETCH) -o $(TARGET).elf
|
||||||
|
|
||||||
buildbin:
|
buildbin:
|
||||||
@echo "Building $(TARGET).bin for $(DEVICE) @ $(CLOCK)Hz ..."
|
@echo "Building $(TARGET).bin ..."
|
||||||
@$(COMPILE) -o $(TARGET).bin
|
@$(OBJCOPY) -O binary -R .eeprom $(TARGET).elf $(TARGET).bin
|
||||||
|
|
||||||
buildhex:
|
buildhex:
|
||||||
@echo "Building $(TARGET).hex ..."
|
@echo "Building $(TARGET).hex ..."
|
||||||
@avr-objcopy -j .text -j .data -O ihex $(TARGET).bin $(TARGET).hex
|
@$(OBJCOPY) -j .text -j .data -O ihex $(TARGET).elf $(TARGET).hex
|
||||||
|
|
||||||
buildasm:
|
buildasm:
|
||||||
@echo "Disassembling to $(TARGET).asm ..."
|
@echo "Disassembling to $(TARGET).asm ..."
|
||||||
@avr-objdump -d $(TARGET).bin > $(TARGET).asm
|
@$(OBJDUMP) -d $(TARGET).elf > $(TARGET).asm
|
||||||
|
|
||||||
size:
|
size:
|
||||||
@echo "FLASH: $(shell avr-size -d $(TARGET).bin | awk '/[0-9]/ {print $$1 + $$2}') bytes"
|
@echo "------------------"
|
||||||
@echo "SRAM: $(shell avr-size -d $(TARGET).bin | awk '/[0-9]/ {print $$2 + $$3}') bytes"
|
@echo "FLASH: $(shell $(AVRSIZE) -d $(TARGET).elf | awk '/[0-9]/ {print $$1 + $$2}') bytes"
|
||||||
|
@echo "SRAM: $(shell $(AVRSIZE) -d $(TARGET).elf | awk '/[0-9]/ {print $$2 + $$3}') bytes"
|
||||||
|
@echo "------------------"
|
||||||
|
|
||||||
removetemp:
|
removetemp:
|
||||||
@echo "Removing temporary files ..."
|
@echo "Removing temporary files ..."
|
||||||
@$(CLEAN)
|
@$(CLEAN)
|
||||||
|
|
||||||
removebin:
|
removeelf:
|
||||||
@echo "Removing $(TARGET).bin ..."
|
@echo "Removing $(TARGET).elf ..."
|
||||||
@rm -f $(TARGET).bin
|
@rm -f $(TARGET).elf
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue