From: Stephan Baerwolf Date: Tue, 13 Nov 2012 17:07:03 +0000 (+0100) Subject: save some more memory in case "BOOTLOADER_CAN_EXIT" is deactivated X-Git-Tag: v0.9~8 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/2ca9a19cd19c152ec45d920994a4c64c94d4b3f5?ds=sidebyside save some more memory in case "BOOTLOADER_CAN_EXIT" is deactivated Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 2b94da4..a54adab 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -215,10 +215,12 @@ static inline void bootLoaderInit(void) MCUCSR = 0; /* clear all reset flags for next time */ } +#if BOOTLOADER_CAN_EXIT static inline void bootLoaderExit(void) { PIN_PORT(JUMPER_PORT) = 0; /* undo bootLoaderInit() changes */ } +#endif #define bootLoaderCondition() ((PIN_PIN(JUMPER_PORT) & (1 << PIN(JUMPER_PORT, JUMPER_BIT))) == 0) diff --git a/firmware/main.c b/firmware/main.c index c80ab7d..fe5d09f 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -41,12 +41,13 @@ #include - -static void leaveBootloader() __attribute__((__noreturn__)); - #include "bootloaderconfig.h" #include "usbdrv/usbdrv.c" +#if BOOTLOADER_CAN_EXIT +static void leaveBootloader() __attribute__((__noreturn__)); +#endif + #ifndef BOOTLOADER_ADDRESS #error need to know the bootloaders flash address! #endif @@ -177,6 +178,7 @@ static const uchar signatureBytes[4] = { /* ------------------------------------------------------------------------ */ +#if BOOTLOADER_CAN_EXIT static void (*nullVector)(void) __attribute__((__noreturn__)); static void leaveBootloader() @@ -197,6 +199,7 @@ static void leaveBootloader() */ nullVector(); } +#endif /* ------------------------------------------------------------------------ */ @@ -430,7 +433,9 @@ int __attribute__((noreturn)) main(void) }while (1); /* main event loop */ #endif } +#if BOOTLOADER_CAN_EXIT leaveBootloader(); +#endif } /* ------------------------------------------------------------------------ */