DFU: Introduce board/app-specific override for booting in DFU mode

Using the USBDFU_OverrideEnterDFU() function, a board/application can
define extra conditions when the system should boot in DFU mode, even if
it was not explicitly switched to DFU mode from the application.

The app/dfu/main.c uses this mechanism to boot into DFU mode if the
stack + reset vector addresses are not plausible (i.e. some random junk
appears to be flashed in the application partition) or if the user
places a jumper accross the RxD+TxD lines of the debug UART.  The idea
is that the system can be recovered by placing this jumper and then
re-installing the application from DFU.
diff --git a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu.h b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu.h
index 4af3e3b..87ac060 100644
--- a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu.h
+++ b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu.h
@@ -110,6 +110,7 @@
 				uint8_t *data, unsigned int len);
 extern int USBDFU_handle_upload(uint8_t altif, unsigned int offset,
 				uint8_t *data, unsigned int req_len);
+extern int USBDFU_OverrideEnterDFU(void);
 
 /* function to be called at end of EP0 handler during runtime */
 void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request);
diff --git a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c
index f9e2d8e..10f015b 100644
--- a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c
+++ b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c
@@ -472,6 +472,14 @@
 	NVIC_SystemReset();
 }
 
+/* A board can provide a function overriding this, enabling a
+ * board-specific 'boot into DFU' override, like a specific GPIO that
+ * needs to be pulled a certain way. */
+WEAK int USBDFU_OverrideEnterDFU(void)
+{
+	return 0;
+}
+
 void USBDCallbacks_RequestReceived(const USBGenericRequest *request)
 {
 	USBDFU_DFU_RequestHandler(request);