AnsweredAssumed Answered

FLASH_ErasePage NOT WORK WITH BOOTLOADER

Question asked by karadag.veysel on Feb 20, 2013
Latest reply on Feb 25, 2013 by karadag.veysel
Hi , everyone ...

I have a problem when using stm32 flash routines. 

My problem is , when I change vector table  after bootloader starts,

FLASH_Status FLASH_ErasePage(u32 Page_Address)  function doesnt work and MCU is reset  for some reason. 

As I explain my code, my memory map like this,

----------0x08000000H ---------------
BOOTLOADER 
----------0x08002000H ---------------
USER APP.
----------0x08020000H ---------------
DATA STORAGE
----------0x08040000H ---------------

Bootloader is for copy from pages DATA STORAGE to USER APP.  ( Bootloader also check firmware version etc from storage area ) 

There was a two different scenario  with bootloader and without bootloader. 

1 - with out bootloader

    If I compile User App. for ( Vector Table OFSET is 0 and ROM1 START is 0x08000000 - 0x20000)

    I can write / read and erase flash page on data storage. Flash library and code works fine !

2  with bootloader
    If I compile User App. for  ( 0x08002000 ), Flash routines get fault and  MCU restart ( Vector Table OFSET is 2000 and ROM1 START is 0x08002000 - 0x20000 or 1E000)

    Bootloader works, and can use flash routines and jump USER APP.

    USER APP starts set vektor table ofset  to 0x2000h,

    APP. can read Flash page for some configuration. USART and timers works fine. 

    But When APP. has to be write something on flash. MCU restart itself. ( its stuck when using flash_FLASH_ErasePage (u32 page)  ) 

I don't understand, why FLASH firmware library made this error . 
Am I misses some pre-configuration for flash library? 
Also , I check page  with using  SMT32-STlink Utility , there wasnt any option byte configration for storage area 

I'm using Keil mVison 4 , User APP use RTX  and bootloader not.
.. I dont thinks this is about compiler. Its looks like interrupts and configuration. 

If somebody help me about that .. I will be very glad..

Best Regards.

Outcomes