mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-19 23:08:34 +03:00
DFU: fix transitions between runtime and DFU mode
we now always go through a processor reset to avoid any state that might be persistent/left-over during the switch.
This commit is contained in:
@@ -125,6 +125,7 @@ IntFunc exception_table[] = {
|
||||
};
|
||||
|
||||
#if defined(BOARD_USB_DFU) && defined(APPLICATION_dfu)
|
||||
#include "usb/device/dfu/dfu.h"
|
||||
static void BootIntoApp(void)
|
||||
{
|
||||
unsigned int *pSrc;
|
||||
@@ -134,7 +135,7 @@ static void BootIntoApp(void)
|
||||
SCB->VTOR = ((unsigned int)(pSrc)) | (0x0 << 7);
|
||||
appReset = pSrc[1];
|
||||
|
||||
printf("Booting into App from %p, PC=%p\r\n", pSrc, appReset);
|
||||
g_dfu->state = DFU_STATE_appIDLE;
|
||||
|
||||
appReset();
|
||||
}
|
||||
@@ -153,8 +154,11 @@ void ResetException( void )
|
||||
|
||||
|
||||
#if defined(BOARD_USB_DFU) && defined(APPLICATION_dfu)
|
||||
if (*(unsigned long *)IRAM_ADDR != 0xDFDFDFDF)
|
||||
if (g_dfu->magic != USB_DFU_MAGIC) {
|
||||
BootIntoApp();
|
||||
/* Infinite loop */
|
||||
while ( 1 ) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the relocate segment */
|
||||
|
||||
Reference in New Issue
Block a user