AnsweredAssumed Answered

stm32f3 moving ISR vector

Question asked by oziom.dominik on Sep 3, 2015
Latest reply on Sep 10, 2015 by oziom.dominik
I'm using flash memory in my project so in order the interrupts to work properly I have to move the ISR vector to SRAM or else the flash will stall the interrupts during its work.
My working environment is CubeMX and System Workbench for stm32. 
The question is: how to do this?
After I have generated my project configuration I found a file system_stm32f3xx.c.

In this file there are lines:



/*!< Uncomment the following line if you need to relocate your vector Table in
     Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET  0x0 /*!< Vector Table base offset field.
                                  This value must be a multiple of 0x200. */
/**
.
.
.
.
#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
}

So I just have to uncomment this line and I will get what I want?

Second question is about using extern "C" phrase.
I did it on my timer interrupt definition lets say it looked like that:


extern "C" void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
   if (htim->Instance==TIM3)
      {
      licznik=licznik+1;
      }
}


but the compiler says it's a syntax error. Am I using it in a wrong way or maybe I need a library to use this phrase.


Last question is about moving my code do SRAM. I browsed through a few topics, tried looking into manual but still don't know how to do it. Can anyone advise me in this matter?

Regards

Outcomes