Skip to main content
Muneeswaran Manokaran
Associate II
November 28, 2020
Solved

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

  • November 28, 2020
  • 1 reply
  • 1583 views

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.??

This topic has been closed for replies.
Best answer by Cartu38 OpenDev

​ @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.

1 reply

Tesla DeLorean
Guru
November 28, 2020

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Muneeswaran Manokaran
Associate II
November 29, 2020

hi,

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

Cartu38 OpenDev
Cartu38 OpenDevBest answer
Graduate II
November 29, 2020

​ @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.