cancel
Showing results for 
Search instead for 
Did you mean: 

Keep user codes

Posted on February 19, 2018 at 12:13

How can one keep the custom codes in a subroutine where there is no by default a special place for it?

For instance I'm using 

MX_TIM1_Init(void)

in which there is no dedicated space for my codes such as

/* USER CODE BEGIN MX_TIM1_Init*/ 

or something like this.

I tried to put it in different way by naming it as 

/* USER CODE BEGIN MX_TIM1_Init*/ , 

/* USER CODE BEGIN 10*/   etc

.

Bit still my codes are being deleted after a restart.

4 REPLIES 4
Houda GHABRI
ST Employee
Posted on April 20, 2018 at 17:04

Hi,

Can you tell me please  where you want exactly to add the new user section, and why the existing ones are not enough?

Regards,

Houda

Posted on April 20, 2018 at 17:18

You might try to edit that without formatting.

More generally the request would be for automated tools to leave whatever regions of the file are that are explicitly marked with BEGIN/END USER regions alone. The user shouldn't need a 'why', and the tool shouldn't have inflexibility in how it imports/merges boiler plate code.

Automated tools might want to identify and log area of user inserted code if it is not marked properly, or place it within comments. Code being damaged/destroyed is a high frequency complaint in the forum, the tools should 'do no harm' where at all possible.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 20, 2018 at 17:39

But then, why can't we wish a complete AI tool that writes the code for us? It's close ...

Posted on April 20, 2018 at 17:50

People have been promising this for at least 3 decades, and I'm frankly still waiting for my kitchen of the future and my flying car..

I'm just asking for a robot that doesn't indiscriminately stomp on stuff, or purposefully for that matter.

The goal of automation is not to duplicate defects into everything.

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