cancel
Showing results for 
Search instead for 
Did you mean: 

Firmware update - STM32F756 Internal / QSPI

Dushyantsingh
Associate II

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:

  1. Receive program code (compiled binary) over serial connection, and write to external flash (QSPI )
  2. Verify program data was received without errors (checksum)
  3. Copy program from external flash into MCU internal flash (FLASH_STORAGE_3  0x08018000)
  4. Reset MCU to run new code

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

5 REPLIES 5
MM..1
Chief II

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 ...

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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);

 

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. */
/******************************************************************************/

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..