cancel
Showing results for 
Search instead for 
Did you mean: 

if i will add any peripherals in existing code , existing code is disappear. new fresh code is generated

Muneeswaran Manokaran
Associate II

Hi,

I am using STM32CUBEIDE, project creation is simple. i modified that code and i add the more function. After i need to add another peripherals, so i use .ioc (stm32cubemx) add another peripherials , after save it ask create, when into my project modified code doesnot exist, new fresh code will appear. Can anyone tell me how to overcome this one.??

1 ACCEPTED SOLUTION

Accepted Solutions

​ @Community member​ has provided you right answer. You have to take care to USER CODE sections.

According your video you've get rid of some ... this is not supported. Each USER CODE section is having a BEGIN and a END ...

WHILE section is:

/* USER CODE BEGIN WHILE */

while (1)

{

/* USER CODE END WHILE */

section 3 is:

/* USER CODE BEGIN 3 */

}

/* USER CODE END 3 */

Your code addon is only supported between related BEGIN / END statements.

According your video your code is included ok between a BEGIN and a END BUT they are not related ... WHILE is not 3 counterpart ...

0693W000005D01PQAS.jpg 

Once your issue solved please mark such post as answered it will help community to access shortly to best material.

View solution in original post

4 REPLIES 4

I guess this is one of the downsides of auto code generation.

There should be a check-box item about how it replaces files.

You should be putting your code within USER CODE BLOCK constraints.

With tools that behaviour this way, you should generate into a sandbox project, and merge into your live one, and always have a backup / repository.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

hi,

thanks for answer. Can you explain step by step with details?. here, i attach video.

​ @Community member​ has provided you right answer. You have to take care to USER CODE sections.

According your video you've get rid of some ... this is not supported. Each USER CODE section is having a BEGIN and a END ...

WHILE section is:

/* USER CODE BEGIN WHILE */

while (1)

{

/* USER CODE END WHILE */

section 3 is:

/* USER CODE BEGIN 3 */

}

/* USER CODE END 3 */

Your code addon is only supported between related BEGIN / END statements.

According your video your code is included ok between a BEGIN and a END BUT they are not related ... WHILE is not 3 counterpart ...

0693W000005D01PQAS.jpg 

Once your issue solved please mark such post as answered it will help community to access shortly to best material.

Thanks sir... Its working... I didn't notice that once.. Thanks for saving my time