2024-05-27 08:08 AM - last edited on 2024-05-27 08:55 AM by Tesla DeLorean
I have board using a STM32F756 that I need to update the firmware from internal flash. I am able to copy .bin file from an external flash to internal flash (Using QSPI). I do NOT want to execute the code from the external location. It is just a temporary storage space.
the below steps i followed:
Till step 3 everything is working fine but facing issue while jumping to internal flash address (where i have copied the bin file from external flash to internal flash )
here is the jumping code:
JumpAddress = *(__IO uint32_t*) (FLASH_STORAGE_3 + 4);
Jump_To_Application = (pFunction) JumpAddress;
__set_MSP(*(__IO uint32_t*) FLASH_STORAGE_3);
Jump_To_Application();
in .bin file (i have written blinky code) but it's not blinking it's always high
Could you please take a look and suggest what is the issue ??
Thanks
2024-05-27 08:19 AM
You skip info , how you build bin. Based on used IDE for place builds on nonstandart addr is required special changes. Primary interrupt table possition ...
2024-05-27 08:59 AM
Make sure the code is built properly for the new address, the vector table,and the settings of SCB->VTOR in SystemInit()
Personally I'd just let the code set the SP as the first thing it does in Reset_Handler.
Use the debugger, step the code, understand what it's doing, where it's going, why its failing. Add check-points so you can see how far it gets into the code, and where it goes.
Have workable HardFault_Handler() and Error_Handler() to you can identify quickly why/where it's getting into them from. Output actionable data, dying silently in a while(1) will tell you nothing.
2024-05-27 11:57 PM
Thanks @Tesla DeLorean for quick reply
Able to built properly for the new address and i have updated the SCB->VTOR in SystemInit()
SCB->VTOR = 0x08018000; but still facing the same issue, actually it's hitting the application code but it execute only one instruction ( able to turn on the LED but it's not going in off mode )
HAL_GPIO_WritePin(SYS_LED4_PORT, SYS_LED4_PIN, GPIO_PIN_SET);
HAL_Delay(1000);
HAL_GPIO_WritePin(SYS_LED4_PORT, SYS_LED4_PIN, GPIO_PIN_RESET);
HAL_Delay(1000);
2024-05-28 07:44 AM
In system xxx .c code exist lines
/* Configure the Vector Table location add offset address ------------------*/
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM1_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
then for your code required is define offset ...
/************************* Miscellaneous Configuration ************************/
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x00000000UL /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/******************************************************************************/
2024-05-28 08:43 AM
Have you disabled interrupts on the MCU, completely?
Is SysTick working?
How is the LED wired? If using a resistor to VCC, then a LOW on the pin will luminate.