+
+       #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+       /* Disable JTAG debugging */
+       MCUCR |= (1 << JTD);
+       MCUCR |= (1 << JTD);
+
+       /* 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 */
+       RunBootloader = (!(PINF & (1 << 4)));
+
+       /* Re-enable JTAG debugging */
+       MCUCR &= ~(1 << JTD);
+       MCUCR &= ~(1 << JTD);
+       #endif
+
+       /* Turn on first LED on the board to indicate that the bootloader has started */
+       LEDs_SetAllLEDs(LEDS_LED1);
+