# where the updating firmware should be located (starting address)
FLASHADDRESS = 0x0000
+# some MCU independend defines...
+#...will be extended within MCU dependend configuration below...
+DEFINES = -DCONFIG_NO__CHIP_ERASE -DCONFIG_NO__ONDEMAND_PAGEERASE
+
# some MCUs with small BLS (bootloader section) need to deactivate some
# features in order to fit into BLS.
# If this option is enabled, also essential features may become deactivated
# you may also want to UNprogram SUT1 to get a SLOWER bootup (lfuse then would be 0x3f)
FUSEOPT_8 = -U lfuse:w:0x1f:m -U hfuse:w:0xc0:m
BOOTLOADER_ADDRESS_8 = 0x1800
+DEFINES_8 = -DCONFIG_NO__BOOTLOADER_CAN_EXIT -DCONFIG_NO__PRECISESLEEP
#untested (WARNING: may destroy ISP ability!)
#please mail tests-reports to matrixstorm@gmx.de:
FUSEOPT_32 = -U lfuse:w:0x1f:m -U hfuse:w:0xc0:m
BOOTLOADER_ADDRESS_32 = 0x7000
+DEFINES_32 = #-DEMPTY
+
+
FUSEOPT_88 = -U lfuse:w:0xd7:m -U hfuse:w:0xd4:m -U efuse:w:0xf8:m
BOOTLOADER_ADDRESS_88 = 0x1800
+DEFINES_88 = -DCONFIG_NO__HAVE_READ_LOCK_FUSE
+
+
FUSEOPT_164 = -U lfuse:w:0xd7:m -U hfuse:w:0xd0:m -U efuse:w:0xfc:m
BOOTLOADER_ADDRESS_164 = 0x3800
+DEFINES_164 = -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__BOOTLOADER_CAN_EXIT
+
+
FUSEOPT_168 = $(FUSEOPT_88)
BOOTLOADER_ADDRESS_168 = 0x3800
+ifeq ($(DANGEROUS), 1)
+DEFINES_168 = -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__NEED_WATCHDOG
+else
+DEFINES_168 = -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__BOOTLOADER_CAN_EXIT
+endif
+
+
FUSEOPT_324 = $(FUSEOPT_164)
BOOTLOADER_ADDRESS_324 = 0x7000
+DEFINES_324 = #-DEMPTY
+
+
FUSEOPT_328 = -U lfuse:w:0xd7:m -U hfuse:w:0xd0:m -U efuse:w:0xfc:m
BOOTLOADER_ADDRESS_328 = 0x7000
+DEFINES_328 = #-DEMPTY
+
+
FUSEOPT_644 = $(FUSEOPT_324)
BOOTLOADER_ADDRESS_644 = 0xE000
+DEFINES_644 = #-DEMPTY
+
+
FUSEOPT_128 = -U lfuse:w:0x1f:m -U hfuse:w:0xc0:m -U efuse:w:0xfd:m
BOOTLOADER_ADDRESS_128 = 0x1E000
+DEFINES_128 = #-DEMPTY
+
+
FUSEOPT_1284 = $(FUSEOPT_644)
BOOTLOADER_ADDRESS_1284 = 0x1E000
+DEFINES_1284 = #-DEMPTY
+
+
-ifeq ($(DANGEROUS), 1)
- CHOOSEFLASHSAVE = -DCONFIG_NO__NEED_WATCHDOG
-else
- CHOOSEFLASHSAVE = -DCONFIG_NO__BOOTLOADER_CAN_EXIT
-endif
#autoselect logic
-DEFINES = #-DDEBUG_LEVEL=2
ifeq ($(DEVICE), atmega8)
FUSEOPT = $(FUSEOPT_8)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_8)
MCUARCH = avr4
+ DEFINES += $(DEFINES_8)
else ifeq ($(DEVICE), atmega32)
FUSEOPT = $(FUSEOPT_32)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_32)
MCUARCH = avr5
+ DEFINES += $(DEFINES_32)
else ifeq ($(DEVICE), atmega88)
FUSEOPT = $(FUSEOPT_88)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_88)
MCUARCH = avr4
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE
+ DEFINES += $(DEFINES_88)
else ifeq ($(DEVICE), atmega88a)
FUSEOPT = $(FUSEOPT_88)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_88)
MCUARCH = avr4
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE
+ DEFINES += $(DEFINES_88)
else ifeq ($(DEVICE), atmega88p)
FUSEOPT = $(FUSEOPT_88)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_88)
MCUARCH = avr4
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE
+ DEFINES += $(DEFINES_88)
else ifeq ($(DEVICE), atmega88pa)
FUSEOPT = $(FUSEOPT_88)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_88)
MCUARCH = avr4
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE
+ DEFINES += $(DEFINES_88)
else ifeq ($(DEVICE), atmega164a)
FUSEOPT = $(FUSEOPT_164)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_164)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__BOOTLOADER_CAN_EXIT
+ DEFINES += $(DEFINES_164)
else ifeq ($(DEVICE), atmega164p)
FUSEOPT = $(FUSEOPT_164)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_164)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__BOOTLOADER_CAN_EXIT
+ DEFINES += $(DEFINES_164)
else ifeq ($(DEVICE), atmega164pa)
FUSEOPT = $(FUSEOPT_164)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_164)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE -DCONFIG_NO__BOOTLOADER_CAN_EXIT
+ DEFINES += $(DEFINES_164)
else ifeq ($(DEVICE), atmega168)
FUSEOPT = $(FUSEOPT_168)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_168)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE $(CHOOSEFLASHSAVE)
+ DEFINES += $(DEFINES_168)
else ifeq ($(DEVICE), atmega168a)
FUSEOPT = $(FUSEOPT_168)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_168)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE $(CHOOSEFLASHSAVE)
+ DEFINES += $(DEFINES_168)
else ifeq ($(DEVICE), atmega168p)
FUSEOPT = $(FUSEOPT_168)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_168)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE $(CHOOSEFLASHSAVE)
+ DEFINES += $(DEFINES_168)
else ifeq ($(DEVICE), atmega168pa)
FUSEOPT = $(FUSEOPT_168)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_168)
MCUARCH = avr5
- DEFINES += -DCONFIG_NO__HAVE_READ_LOCK_FUSE $(CHOOSEFLASHSAVE)
+ DEFINES += $(DEFINES_168)
else ifeq ($(DEVICE), atmega324a)
FUSEOPT = $(FUSEOPT_324)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_324)
MCUARCH = avr5
+ DEFINES += $(DEFINES_324)
else ifeq ($(DEVICE), atmega324p)
FUSEOPT = $(FUSEOPT_324)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_324)
MCUARCH = avr5
+ DEFINES += $(DEFINES_324)
else ifeq ($(DEVICE), atmega324pa)
FUSEOPT = $(FUSEOPT_324)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_324)
MCUARCH = avr5
+ DEFINES += $(DEFINES_324)
else ifeq ($(DEVICE), atmega328)
FUSEOPT = $(FUSEOPT_328)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_328)
MCUARCH = avr5
+ DEFINES += $(DEFINES_328)
else ifeq ($(DEVICE), atmega328p)
FUSEOPT = $(FUSEOPT_328)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_328)
MCUARCH = avr5
+ DEFINES += $(DEFINES_328)
else ifeq ($(DEVICE), atmega644)
FUSEOPT = $(FUSEOPT_644)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_644)
MCUARCH = avr5
+ DEFINES += $(DEFINES_644)
else ifeq ($(DEVICE), atmega644a)
FUSEOPT = $(FUSEOPT_644)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_644)
MCUARCH = avr5
+ DEFINES += $(DEFINES_644)
else ifeq ($(DEVICE), atmega644p)
FUSEOPT = $(FUSEOPT_644)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_644)
MCUARCH = avr5
+ DEFINES += $(DEFINES_644)
else ifeq ($(DEVICE), atmega644pa)
FUSEOPT = $(FUSEOPT_644)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_644)
MCUARCH = avr5
+ DEFINES += $(DEFINES_644)
else ifeq ($(DEVICE), atmega128)
FUSEOPT = $(FUSEOPT_128)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_128)
MCUARCH = avr51
+ DEFINES += $(DEFINES_128)
else ifeq ($(DEVICE), atmega1284)
FUSEOPT = $(FUSEOPT_1284)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_1284)
MCUARCH = avr51
+ DEFINES += $(DEFINES_1284)
else ifeq ($(DEVICE), atmega1284p)
FUSEOPT = $(FUSEOPT_1284)
BOOTLOADER_ADDRESS = $(BOOTLOADER_ADDRESS_1284)
MCUARCH = avr51
+ DEFINES += $(DEFINES_1284)
else
FUSEOPT = unknown
endif
* WITH REQUESTING A MAGIC YOU AGREE TO PUBLISHED YOUR DATA SEND WITHIN THE REQUEST
*/
-#define HAVE_EEPROM_PAGED_ACCESS 1
+#ifndef CONFIG_NO__EEPROM_PAGED_ACCESS
+# define HAVE_EEPROM_PAGED_ACCESS 1
+#else
+# define HAVE_EEPROM_PAGED_ACCESS 0
+#endif
/* If HAVE_EEPROM_PAGED_ACCESS is defined to 1, page mode access to EEPROM is
* compiled in. Whether page mode or byte mode access is used by AVRDUDE
* depends on the target device. Page mode is only used if the device supports
* it, e.g. for the ATMega88, 168 etc. You can save quite a bit of memory by
* disabling page mode EEPROM access. Costs ~ 138 bytes.
*/
-#define HAVE_EEPROM_BYTE_ACCESS 1
+
+#ifndef CONFIG_NO__EEPROM_BYTE_ACCESS
+# define HAVE_EEPROM_BYTE_ACCESS 1
+#else
+# define HAVE_EEPROM_BYTE_ACCESS 0
+#endif
/* If HAVE_EEPROM_BYTE_ACCESS is defined to 1, byte mode access to EEPROM is
* compiled in. Byte mode is only used if the device (as identified by its
* signature) does not support page mode for EEPROM. It is required for
*/
#ifndef CONFIG_NO__BOOTLOADER_CAN_EXIT
- #define BOOTLOADER_CAN_EXIT 1
+# define BOOTLOADER_CAN_EXIT 1
#else
- #define BOOTLOADER_CAN_EXIT 0
+# define BOOTLOADER_CAN_EXIT 0
#endif
/* If this macro is defined to 1, the boot loader will exit shortly after the
* programmer closes the connection to the device. Costs extra bytes.
*/
-#define HAVE_CHIP_ERASE 0
+#ifndef CONFIG_NO__CHIP_ERASE
+# define HAVE_CHIP_ERASE 1
+#else
+# define HAVE_CHIP_ERASE 0
+#endif
/* If this macro is defined to 1, the boot loader implements the Chip Erase
* ISP command. Otherwise pages are erased on demand before they are written.
*/
+#ifndef CONFIG_NO__ONDEMAND_PAGEERASE
+# define HAVE_ONDEMAND_PAGEERASE 1
+#else
+# define HAVE_ONDEMAND_PAGEERASE 0
+#endif
+/* Even if "HAVE_CHIP_ERASE" is avtivated - enabling the "HAVE_ONDEMAND_PAGEERASE"-
+ * feature the bootloader will erase pages on demand short before writing new data
+ * to it.
+ * If pages are not erase before reprogram (for example because user call avrdude -D)
+ * then data may become inconsistent since writing only allow to unset bits in the flash.
+ * This feature may prevent this...
+ */
#ifndef CONFIG_NO__NEED_WATCHDOG
- #define NEED_WATCHDOG 1
+# define NEED_WATCHDOG 1
#else
- #define NEED_WATCHDOG 0
+# define NEED_WATCHDOG 0
#endif
/* ATTANTION: This macro MUST BE 1, if the MCU has reset enabled watchdog (WDTON is 0).
* If this macro is defined to 1, the bootloader implements an additional "wdt_disable()"
*/
#ifndef CONFIG_NO__PRECISESLEEP
- #define HAVE_UNPRECISEWAIT 0
+# define HAVE_UNPRECISEWAIT 0
#else
- #define HAVE_UNPRECISEWAIT 1
+# define HAVE_UNPRECISEWAIT 1
#endif
/* This macro enables hand-optimized assembler code
* instead to use _sleep_ms for delaying USB enumeration.
* Therefore it is very small, which saves some PROGMEM bytes!
*/
-#define HAVE_FLASH_BYTE_READACCESS 1
+#ifndef CONFIG_NO__FLASH_BYTE_READACCESS
+# define HAVE_FLASH_BYTE_READACCESS 1
+#else
+# define HAVE_FLASH_BYTE_READACCESS 0
+#endif
/* If HAVE_FLASH_BYTE_READACCESS is defined to 1, byte mode access to FLASH is
* compiled in. Byte mode sometimes might be used by some programming softwares
* (avrdude in terminal mode). Without this feature the device would return "0"