Skip to content
Permalink
Browse files

ERASE_CHIP in BL Makefile geaendert

  • Loading branch information...
RealMerlin committed Mar 7, 2019
1 parent 795bede commit d7bdb9fde7cd2cad048305339ee14d8f822c0212
Showing with 25 additions and 11 deletions.
  1. +25 −11 hcanbl/Makefile
@@ -21,27 +21,39 @@ ifeq ($(MCU),atmega644p)
# atmega644 (64kbytes flash = 0 bis FFFF)
# 0xF000 for firmware, 2048 words boot size
MT_BOOTLOADER_ADDRESS = F000
# JTAG-Enable: hfuse:w:0x90:m
AVRDUDE_FLASH = avrdude -c avrispmkII -p m644p -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" -U efuse:w:0xFC:m -U hfuse:w:0xD0:m -U lfuse:w:0xC7:m
# JTAG-Enable: hfuse:w:0x90:m
FUSES = -U efuse:w:0xFC:m -U hfuse:w:0xD0:m -U lfuse:w:0xC7:m
AVRDUDE_FLASH = avrdude -c avrispmkII -p m644p -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" $(FUSES)
AVRDUDE_READ_FLASH = avrdude -c avrispmkII -p m644p -P usb -U flash:r:flash.hex:r
AVRDUDE_ERASE_EEPROM = avrdude -c avrispmkII -p m644p -P usb -e
# Da beim EESAVE FUSEBIT der EEPROM auch bei einem Chip Erase nicht geloescht wird, aendern wir vor dem loeschen die fueses
AVRDUDE_ERASE_CHIP1 = avrdude -c avrispmkII -p m644p -P usb -U efuse:w:0xFC:m -U hfuse:w:0xD8:m -U lfuse:w:0xC7:m
AVRDUDE_ERASE_CHIP2 = avrdude -c avrispmkII -p m644p -P usb -e
AVRDUDE_ERASE_CHIP3 = avrdude -c avrispmkII -p m644p -P usb $(FUSES)
else ifeq ($(MCU),atmega328p)
# atmega328p (32kbytes flash = 0 bis 7FFF)
# 0x7000 for firmware (bytes boot size), 2048 words boot size
MT_BOOTLOADER_ADDRESS = 7000
AVRDUDE_READ_FUSES = avrdude -c avrispmkII -p $(MCU) -P usb
# JTAG-Enable (debugWIRE Enable): hfuse:w:0x88:m
AVRDUDE_FLASH = avrdude -c avrispmkII -p $(MCU) -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" -U efuse:w:0xFD:m -U hfuse:w:0xC8:m -U lfuse:w:0xFF:m
# JTAG-Enable (debugWIRE Enable): hfuse:w:0x80:m
FUSES = -U efuse:w:0xFD:m -U hfuse:w:0xC0:m -U lfuse:w:0xFF:m
AVRDUDE_FLASH = avrdude -c avrispmkII -p $(MCU) -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" $(FUSES)
AVRDUDE_READ_FLASH = avrdude -c avrispmkII -p $(MCU) -P usb -U flash:r:flash.hex:r
AVRDUDE_ERASE_EEPROM = avrdude -c avrispmkII -p $(MCU) -P usb -e
# Da beim EESAVE FUSEBIT der EEPROM auch bei einem Chip Erase nicht geloescht wird, aendern wir vor dem loeschen die fueses
AVRDUDE_ERASE_CHIP1 = avrdude -c avrispmkII -p $(MCU) -P usb -U efuse:w:0xfd:m -U hfuse:w:0xC8:m -U lfuse:w:0xff:m
AVRDUDE_ERASE_CHIP2 = avrdude -c avrispmkII -p $(MCU) -P usb -e
AVRDUDE_ERASE_CHIP3 = avrdude -c avrispmkII -p $(MCU) -P usb $(FUSES)
else
# atmega32 (32kbytes flash = 0 bis 7FFF)
# 0x7000 for firmware, 2048 words boot size
MT_BOOTLOADER_ADDRESS = 7000
# JTAG-Enable: hfuse:w:0x80:m -U
AVRDUDE_FLASH = avrdude -c avrispmkII -p m32 -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" -U hfuse:w:0xC0:m -U lfuse:w:0x0f:m
# JTAG-Enable: hfuse:w:0x80:m
FUSES = -U hfuse:w:0xC0:m -U lfuse:w:0x0f:m
AVRDUDE_FLASH = avrdude -c avrispmkII -p m32 -P usb -U flash:w:"hcanBL_$(MCU)/$(TARGET).hex" $(FUSES)
AVRDUDE_READ_FLASH = avrdude -c avrispmkII -p m32 -P usb -U flash:r:flash.hex:r
AVRDUDE_ERASE_EEPROM = avrdude -c avrispmkII -p m32 -P usb -e
# Da beim EESAVE FUSEBIT der EEPROM auch bei einem Chip Erase nicht geloescht wird, aendern wir vor dem loeschen die fueses
AVRDUDE_ERASE_CHIP1 = avrdude -c avrispmkII -p m32 -P usb -U hfuse:w:0xc8:m -U lfuse:w:0x0f:m
AVRDUDE_ERASE_CHIP2 = avrdude -c avrispmkII -p m32 -P usb -e
AVRDUDE_ERASE_CHIP3 = avrdude -c avrispmkII -p m32 -P usb $(FUSES)
endif


@@ -73,8 +85,10 @@ $(TARGET).out : $(OBJ)
flash:
$(AVRDUDE_FLASH)

erase_eeprom:
sudo $(AVRDUDE_ERASE_EEPROM)
erase_chip:
sudo $(AVRDUDE_ERASE_CHIP1)
sudo $(AVRDUDE_ERASE_CHIP2)
sudo $(AVRDUDE_ERASE_CHIP3)

# BL und FW lesen (alles was im flash-Speicher enthalten ist)
read_flash:

0 comments on commit d7bdb9f

Please sign in to comment.
You can’t perform that action at this time.