Skip to content

Commit

Permalink
introduce new feature: BOOTLOADER_HIDDENEXITCOMMAND
Browse files Browse the repository at this point in the history
With this "BOOTLOADER_HIDDENEXITCOMMAND" feature, sending the RAW-ISP
command "11111111 xxxxxxxx xxxxxxxx xxxxxxxx" will cause the bootloader
to start the firmware as soon as the programming software disconnects.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
  • Loading branch information
baerwolf committed Sep 10, 2013
1 parent 00602ef commit 46cd9d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions firmware/bootloaderconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,18 @@ these macros are defined, the boot loader usees them.
* user intervention
*/

#ifdef CONFIG_NO__BOOTLOADER_HIDDENEXITCOMMAND
# define HAVE_BOOTLOADER_HIDDENEXITCOMMAND 0
#else
# define HAVE_BOOTLOADER_HIDDENEXITCOMMAND 0xff
#endif
/*
* When enabling "BOOTLOADER_HIDDENEXITCOMMAND", then
* sending the RAW-ISP command "0xff 0xXX 0xXX 0xXX"
* will cause the bootloader to start the firmware
* as soon as the programming software disconnects.
*/

//#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
Expand Down
17 changes: 17 additions & 0 deletions firmware/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,23 @@ defined (__AVR_ATmega2561__)
sei();
# endif
}
#endif
#if (HAVE_BOOTLOADER_HIDDENEXITCOMMAND)
# if ((HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0xac) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x20) && (HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x28) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x40) && (HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x48) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x4c) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0xa0) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0xc0) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x58) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x5c) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x30) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0xac) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x50) && (HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x58) && \
(HAVE_BOOTLOADER_HIDDENEXITCOMMAND != 0x38))
}else if(rq->wValue.bytes[0] == (HAVE_BOOTLOADER_HIDDENEXITCOMMAND)){ /* cause a bootLoaderExit at disconnect */
stayinloader = 0xf1; /* we need to be connected - so assume it */
# endif
#endif
}else{
/* ignore all others, return default value == 0 */
Expand Down

0 comments on commit 46cd9d4

Please sign in to comment.