2015-09-03 05:57 AM
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? Regards2015-09-10 07:05 AM
My problem was so simple that I feel stupid.
I was trying to save data to flash from page 4 to 127 but there is surely some code saved on the first few pages so I guess I was just overwriting this code and this is why my interrupts didn't work properly. I started to save my data from a little further page and now everything works fine. Thanks Clive for the time you spent on my problem.