2021-10-11 11:14 AM
Hello
I am new to the CUBEIDE Universe and I guess this question has been asked a 1000 times but I can´t find an answer. I created a new project with cubeMX ( just a few GPIO outputs with LEDs) and build the C File. Then I wrote some defines and arrays. When I now edit the.ioc file because I want to change something, all my defines etc. are gone. Only my Code after while(1) stays. Is this a BUG oder did I something wrong. I wrote my #define right after the #include main.h.
Solved! Go to Solution.
2021-10-11 11:41 AM
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
for example you can place between BEGIN PD and END PD
2021-10-11 11:33 AM
Only code between /* USER CODE BEGIN ... */ and /* USER CODE END ... */ is preserved.
> I wrote my #define right after the #include main.h.
This is not within a user code section.
2021-10-11 11:41 AM
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
for example you can place between BEGIN PD and END PD
2021-10-11 08:12 PM
Overall, until version control tool can manage code blend within a source file, keep your code minimal here and call your functions placed in a source file YOU own and version control.
2021-10-14 11:02 PM
Thank you. This helps me a lot
2024-07-11 01:25 PM
I straight up just had it delete all my declarations BETWEEN the USER PV comment tags on a code regen refresh. So yeah, it can f**k you.
Back you stuff up, use version control, etc.. There are bugs in MX that can do that.