cancel
Showing results for 
Search instead for 
Did you mean: 

How to put HAL ISR into SRAM?

hmc
Associate III
Posted on July 04, 2016 at 07:53

My current SRAM usage on STM32F042 is miniscule.  Since there doesn't appear to be a way to shut off parts of the SRAM for lower current usage (am I wrong?), the next best thing I can do to save power is to move frequently executed functions into SRAM.  I know how to do this with my own code, but since I am regenerating the CubeMx code frequently (still in active development), whatever I modify in the stm32f0xx_it.c will be overwritten.

Any suggestions?  Thanks for reading.

#cubemx-hal-isr
3 REPLIES 3
Walid FTITI_O
Senior II
Posted on July 04, 2016 at 11:04

Hi,

To avoid that your inputs are rewritten in the next CubeMx you regeneration , you ought to write your code in the user code parts with are between:

in file:

/* USER CODE BEGIN 1 */

/* USER CODE END */

or inside IRQ_handler functions :

/* USER CODE BEGIN IRQ_Handler */

/* USER CODE END  IRQ_Handler */

-Hannibal-

hmc
Associate III
Posted on July 04, 2016 at 21:13

Hi Hannibal, let's take a concrete example: SysTick_Handler, which is in the vector table.  This is what the CubeMx generated code looks like:

/**

* @brief This function handles System tick timer.

*/

void SysTick_Handler(void)

{

  /* USER CODE BEGIN SysTick_IRQn 0 */

  /* USER CODE END SysTick_IRQn 0 */

  HAL_IncTick();

  HAL_SYSTICK_IRQHandler();

  /* USER CODE BEGIN SysTick_IRQn 1 */

  /* USER CODE END SysTick_IRQn 1 */

}

I usually put the section attribute BEFORE the function declaration.  Where is the begin and end stub where I can put in the gcc attribute?

Walid FTITI_O
Senior II
Posted on July 05, 2016 at 13:15

Hi choi.henry,

Try to attach the generated .it file which allow me to indicate clearly for you .

-Hannibal-