From: Stephan Baerwolf Date: Thu, 12 Sep 2013 13:37:45 +0000 (+0200) Subject: BUGfix: enable "CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" not always X-Git-Tag: testing-head~15 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/c9d01094d3f21852e88d155fa4704e5580a2063d BUGfix: enable "CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" not always The feature "CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE" may be dangerous, since bootloader may never exit ("CONFIG_NO__BOOTLOADER_CAN_EXIT"). So the feature only is enabled, if "CONFIG_NO__BOOTLOADER_CAN_EXIT" is disabled. Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 9eb07c9..d4ce8ec 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -360,15 +360,26 @@ these macros are defined, the boot loader usees them. */ #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 @@ -463,7 +474,7 @@ static inline void bootLoaderExit(void) 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) @@ -479,7 +490,7 @@ static inline bool bootLoaderCondition(void) } # endif #else -# ifdef CONFIG_HAVE__BOOTLOADER_ALWAYSENTERPROGRAMMODE +# if (BOOTLOADER_ALWAYSENTERPROGRAMMODE) # define bootLoaderCondition() (true) # else # define bootLoaderCondition bootLoaderConditionSimple