From cd0bd7bf90e7e64a42b1efcee5a60cfdfc91d7a2 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 9 Jun 2012 13:00:56 +0000 Subject: [PATCH] Added new JTAG_ENABLE() macro for the AVR8 architecture. Fixed the JTAG_DISABLE() macro clearing all other bits in MCUSR when called. Moved the XPLAIN board specific bootloader entry condition code to the Application_Jump_Check() function of the DFU bootloader, added support for the original XPLAIN board to the CDC class bootloader. --- Bootloaders/CDC/BootloaderCDC.c | 21 +++++++++++++++++ Bootloaders/DFU/BootloaderDFU.c | 38 +++++++++++++++++------------- LUFA/Common/ArchitectureSpecific.h | 20 +++++++++++++++- LUFA/DoxygenPages/ChangeLog.txt | 4 +++- 4 files changed, 64 insertions(+), 19 deletions(-) diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index ef68e148c6..dcfa978e36 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -70,8 +70,29 @@ uint32_t MagicBootKey ATTR_NO_INIT; */ void Application_Jump_Check(void) { + bool JumpToApplication = false; + + #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) + /* Disable JTAG debugging */ + JTAG_DISABLE(); + + /* Enable pull-up on the JTAG TCK pin so we can use it to select the mode */ + PORTF |= (1 << 4); + Delay_MS(10); + + /* If the TCK pin is not jumpered to ground, start the user application instead */ + JumpToApplication |= ((PINF & (1 << 4)) != 0); + + /* Re-enable JTAG debugging */ + JTAG_ENABLE(); + #endif + /* If the reset source was the bootloader and the key is correct, clear it and jump to the application */ if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY)) + JumpToApplication |= true; + + /* If a request has been made to jump to the user application, honor it */ + if (JumpToApplication) { /* Turn off the watchdog */ MCUSR &= ~(1<