mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-22 16:28:32 +03:00
DFU: use central DFU override check
TRACE_INFO will also provide the DFU start reason, but TRACE_INFO (TRACE_LEVEL >= 4) should only be used for debugging. WARNING: With TRACE_LEVEL >= 4 the DFU binary is over the maximum of 16 kiB allocated for the DFU bootloader. Thus make combined will not boot the main application because its start if after the expecte 16 kiB address; and flashing using DFU will overwrite the DFU bootloader itself. Change-Id: I82323e0f76c03f67df7dc8f2b6783166cc25f3aa
This commit is contained in:
@@ -159,26 +159,12 @@ void ResetException( void )
|
||||
|
||||
|
||||
#if defined(BOARD_USB_DFU) && defined(APPLICATION_dfu)
|
||||
/* 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) && !USBDFU_OverrideEnterDFU()) {
|
||||
/* start application if valid
|
||||
* the application starts with the vector table
|
||||
* the first entry in the vector table is the initial stack pointer (SP) address
|
||||
* the stack will be placed in RAM, which begins at 0x2000 0000
|
||||
* there is up to 48 KB of RAM (0xc000)
|
||||
* since the stack grown "downwards" it should start at the end of the RAM: max 0x2000 c000
|
||||
* if the SP is not in this range (e.g. flash has been erased) there is no valid application
|
||||
* the second entry in the vector table is the reset address, corresponding to the application start
|
||||
*/
|
||||
if (((*((uint32_t*)(IFLASH_ADDR+BOARD_DFU_BOOT_SIZE)))&0xFFFF0000)==0x20000000) {
|
||||
UART_Exit();
|
||||
__disable_irq();
|
||||
BootIntoApp();
|
||||
/* Infinite loop */
|
||||
while ( 1 ) ;
|
||||
}
|
||||
if (!USBDFU_OverrideEnterDFU()) {
|
||||
UART_Exit();
|
||||
__disable_irq();
|
||||
BootIntoApp();
|
||||
/* Infinite loop */
|
||||
while ( 1 ) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user