2016-07-03 10:53 PM
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-isr2016-07-04 02:04 AM
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-2016-07-04 12:13 PM
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?2016-07-05 04:15 AM
Hi choi.henry,
Try to attach the generated .it file which allow me to indicate clearly for you . -Hannibal-