2018-02-20 10:36 AM
I'm using the STM32CUBEMX which generates HAL code and keeps my code within defined comments. BUT, I need to define an __attribute statement BEFORE a HAL generated function header, but there is no /* USER CODE .. */ place to hold these statements so they get wiped with every STM32CUBEMX project update. Any solutions??
Many Thanks, Glenn
2018-02-20 01:08 PM
Its a bit of a sledgehammer approach, but it works in some cases;
And i apologized in advance to all those it really offends! LOL
Suppose you have something like this, and you want to change or add something in the 3 init calls;
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_TIM2_Init();
MX_TIM1_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
you can undefine a section of Cube Code between user code sections;
regenerating with Cube will leave your tweaks in place.
/* USER CODE BEGIN SysInit */
MX_GPIO_Init();
MX_TIM2_Init();
//add new thing here or add attribute to something
MX_TIM1_Init();
#ifdef nothing
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_TIM2_Init();
MX_TIM1_Init();
/* USER CODE BEGIN 2 */
#endif
/* USER CODE END 2 */
2018-02-20 03:21 PM
Where you have important work build from a sandbox and merge back in changes from a CubeMX build iteration. Or automate patching with a script as appropriate.
WinMerge, Araxis Merge