cancel
Showing results for 
Search instead for 
Did you mean: 

How to move interrupt vector from FLASH to RAM when using STM32F427?

CLiao.1
Associate II

Hi, I developed boot loader on STM32F427. When I try to erase FLASH, that will trigger HW watch dog(tick by interrupt timer) to reset our develop board. I search solution by google, many people say should move interrupt vector and IRQ handler program from FLASH to RAM. Do there have document describe how to implement it? I already followed "Use STM32F3/STM32G4 CCM SRAM with IAR™ EWARM, Keil® MDK-ARM and GNU-based toolchains"(AN4296), but it don't work.

BR,

Cloud

5 REPLIES 5
berendi
Principal

Check the following

  • The function erasing the flash itself is relocated to RAM
  • All enabled interrupt handlers are relocated to flash
  • No relocated function calls anything in flash.
  • They don't use any const variables, or otherwise reference flash contents.

Check every possible program line, function call, macro, variable.

Use memcpy(), make sure the RAM address is 512-byte aligned, and set the SCB->VTOR to the new base address.

Watch that addresses in the vector table don't point to erased areas of Flash or will call tree dependencies on same.​

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

Hi Berendi,

boot loader flash region: 0x08000000 ~ 0x0803FFFF

AP flash region: 0x08040000~0x0807FFFF

Boot loader only erase/write AP FLASH address. When boot loader erase AP section, there will stop around 3 seconds .

Hi Clive1,

Do you mean copy IVT from FLASH to RAM at main function and set SCB->VTOR to IVT address in RAM?

BR,

Cloud

CLiao.1
Associate II

After adding below code in system_stm32f4xx.c, the IVT put in RAM.

memcpy((void*)0x20000000,(void const*)0x08000000,0x1FF); // Move Vector Table from FLASH to RAM

SCB->VTOR = 0x20000000; // Point at RAM copy