2019-01-23 08:25 AM
Hi,
I need to write a bootloader which will load the new program from a USB memory stick.
Unfortunately I cannot use the ROM based DFU bootloader.
The bootloader would need to be held in FLASH and protected against update. Easy enough.
I believe that the CubeMx USB library uses interrupts however so I will need two vector table, know where the application vector table is and swap to it.
VTOR looks the ticket but am looking for a 'quick start' example illustration linker script changes.
I am using TrueStudio so that or a convertible project would be ideal.
Thanks
2019-01-23 09:11 AM
There should be assorted IAP (In Application Programming) examples under the F4 HAL trees.
Definitely a USB MSC Host IAP example for the STM32F4-DISCO board which would likely port.
2019-01-24 08:31 AM
Thanks. I found AN3990 but where is the software? Not in STM32Cube_FW_F4_V1.23.0...
2019-01-24 08:55 AM
This application example is prebuilt however. Section 2.3) says that I can relocate vectorr table using VECT_TAB_OFFSET in system_stm32f4xx.c (I have system_stm32f401xc.s). Neither do I have NVIC_SetVectorTable().
So I still need help with the application's start address & vector table voodoo.
2019-01-24 09:06 AM
The original one for the F4-DISCO was in the SPL/DSP
STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade
STM32F429I-Discovery_FW_V1.0.1\Projects\FW_upgrade
In HAL trees,
STM32Cube_FW_F4_V1.23.0\Projects\STM32F4-Discovery\Applications\FatFs\FatFs_USBDisk\readme.txt
STM32Cube_FW_F4_V1.23.0\Projects\STM32F429I-Discovery\Applications\USB_Host\FWupgrade_Standalone\readme.txt
2019-01-24 09:10 AM
For GNU/GCC
>>Relocate the vector table (define the VECT_TAB_SRAM in system_stm32f1xx.c)
The more efficient method is to let the Linker do the work and use the symbol for the vector table as built
extern void *g_pfnVectors;
SCB->VTOR = &g_pfnVectors;
void SystemInit(void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Reset the RCC clock configuration to the default reset state ------------*/
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/* Reset CFGR register */
RCC->CFGR = 0x00000000;
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset PLLCFGR register */
RCC->PLLCFGR = 0x24003010;
/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Disable all interrupts */
RCC->CIR = 0x00000000;
/* Configure the Vector Table location add offset address -------FIX THIS-----------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
}
2019-01-24 09:28 AM