#ifndef __bootloaderconfig_h_included__
#define __bootloaderconfig_h_included__
-#include <avr/io.h>
+#include "../misc/iofixes.h"
/*
General Description:
* "B", the registers PORTB, PINB and DDRB will be used.
*/
#ifndef USB_CFG_INTPORT_BIT
- #if (defined(__AVR_ATmega640__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__))
+ #if (defined(__AVR_ATmega640__) || defined (__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__))
#define USB_CFG_INTPORT_BIT 0
#else
#define USB_CFG_INTPORT_BIT 2
*/
#ifdef CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE
+# if (BOOTLOADER_CAN_EXIT)
+# define BOOTLOADER_ALWAYSENTERPROGRAMMODE 1
+# else
+# define BOOTLOADER_ALWAYSENTERPROGRAMMODE 0
+# endif
+#else
+# define BOOTLOADER_ALWAYSENTERPROGRAMMODE 0
#endif
/*
* Ignore bootLoaderCondition() (BUT NOT bootLoaderConditionSimple())
* and always enter the program-mode.
* This is helpful to emulate behaviour of Arduino bootloaders
+ *
+ * However, this feature may be dangerous, since bootloader may never exit.
+ * So it is enabled, only if "CONFIG_NO__BOOTLOADER_CAN_EXIT" is disabled.
+ *
*/
#ifdef CONFIG_HAVE__BOOTLOADER_IGNOREPROGBUTTON
-# if ( (defined(CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE)) && (defined(BOOTLOADER_CAN_EXIT)) && (BOOTLOADER_LOOPCYCLES_TIMEOUT >= 8) )
+# if ( (BOOTLOADER_ALWAYSENTERPROGRAMMODE) && (defined(BOOTLOADER_CAN_EXIT)) && (BOOTLOADER_LOOPCYCLES_TIMEOUT >= 8) )
# define BOOTLOADER_IGNOREPROGBUTTON 1
# else
# define BOOTLOADER_IGNOREPROGBUTTON 0
* can be soldered otherwise.
*/
+#ifdef CONFIG_NO__BOOTLOADER_ADDITIONALDEVICEWAIT
+# define HAVE_BOOTLOADER_ADDITIONALMSDEVICEWAIT 0
+#else
+# define HAVE_BOOTLOADER_ADDITIONALMSDEVICEWAIT 50
+#endif
+/*
+ * When enabling "HAVE_BOOTLOADER_ADDITIONALMSDEVICEWAIT", then
+ * the bootloader will alway delay its bootup by the configured
+ * number of milliseconds.
+ * This gives the pullups additional time to charge up.
+ */
+
//#define SIGNATURE_BYTES 0x1e, 0x93, 0x07, 0 /* ATMega8 */
/* This macro defines the signature bytes returned by the emulated USBasp to
* the programmer software. They should match the actual device at least in
static volatile uint8_t __BOOTLOADERENTRY_FROMSOFTWARE__bootup_RAMEND_doesmatch __attribute__ ((section(".noinit")));
static volatile uint8_t __BOOTLOADERENTRY_FROMSOFTWARE__bootup_MCUCSR __attribute__ ((section(".noinit")));
-# ifdef CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE
+# if (BOOTLOADER_ALWAYSENTERPROGRAMMODE)
# define bootLoaderCondition() (true)
# else
static inline bool bootLoaderCondition(void)
}
# endif
#else
-# ifdef CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE
+# if (BOOTLOADER_ALWAYSENTERPROGRAMMODE)
# define bootLoaderCondition() (true)
# else
# define bootLoaderCondition bootLoaderConditionSimple