WIP: Introduce USB DFU code from my at91lib DFU port

This commit is contained in:
Harald Welte
2017-02-26 17:00:43 +01:00
parent aa3b867abb
commit 7ed6f3bc37
11 changed files with 1104 additions and 11 deletions

View File

@@ -125,6 +125,19 @@ IntFunc exception_table[] = {
IrqHandlerNotUsed /* 35 not used */
};
#if defined (BOARD_USB_DFU) && !defined(dfu)
static void BootIntoApp(void)
{
unsigned int *pSrc;
void (*appReset)(void);
pSrc = (unsigned int *) ((unsigned char *)IFLASH_ADDR + BOARD_DFU_BOOT_SIZE);
SCB->VTOR = ((unsigned int)(pSrc)) | (0x0 << 7);
appReset = pSrc[1];
appReset();
}
#endif
/**
* \brief This is the code that gets called on processor reset.
* To initialize the device, and call the main() routine.
@@ -136,6 +149,11 @@ void ResetException( void )
/* Low level Initialize */
LowLevelInit() ;
#if defined (BOARD_USB_DFU) && !defined(dfu)
if (*(unsigned long *)IRAM_ADDR != 0xDFDFDFDF)
BootIntoApp();
#endif
/* Initialize the relocate segment */
pSrc = &_etext ;
pDest = &_srelocate ;
@@ -169,6 +187,9 @@ void ResetException( void )
/* Branch to main function */
main() ;
/* App should have disabled interrupts during the transition */
__enable_irq();
/* Infinite loop */
while ( 1 ) ;
}