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.
This commit is contained in:
Harald Welte
2017-03-04 19:17:27 +01:00
parent 7214b4747f
commit 1405100dff
4 changed files with 61 additions and 1 deletions

View File

@@ -157,7 +157,7 @@ void ResetException( void )
/* we are before the text segment has been relocated, so g_dfu is
* not initialized yet */
g_dfu = &_g_dfu;
if (g_dfu->magic != USB_DFU_MAGIC) {
if ((g_dfu->magic != USB_DFU_MAGIC) && !USBDFU_OverrideEnterDFU()) {
BootIntoApp();
/* Infinite loop */
while ( 1 ) ;