2017-06-23 06:24 AM
Hey guys,
i just created a project for the STM32L4 Discovery Board with CubeMX (I'm using Atollic TrueStudio). I assume that CubeMX always generates the same structure, namely the folders 'Drivers', 'Inc', 'Src', 'startup' and 'Middlewares'. Is this assumption correct or is this structure only generated when using CubeMX with Atollic TrueStudio (e.g. I could have used Eclipse + OpenSTM32 instead)?
Now, where can I place my own source code and header files? Do I have to use the folders 'Src' and 'Inc'? I would prefer using my own structure, because I only want to port an already existing software to STM32.
Thanks in advance!
#atollic #cube #hal #cubemx #truestudio #source-file #header-file #mx #ownSolved! Go to Solution.
2017-06-30 08:49 AM
Thanks for your advice!
I also have little experience with TrueStudio, but I finally found a solution for my problem: I've already added the new folders to the compiler's include paths, but somehow TrueStudio didn't recognize them (in Project Properties -> C/C++ Build -> Tool Chain Editor)
I also had to add them to the 'Includes' Tab in Project Properties -> C/C++ General -> Paths and Symbols.
2017-06-23 04:57 PM
Hi, andreas,
Normally, in the generated files, you will see something like this:
/* USER CODE BEGIN Init */
/* USER CODE END Init */
you may insert your codes in between these lines.
Next time when you modify your ioc project and regenerates it, these parts would be kept.
If you put some codes somewhere not between these lines, the generated codes would probably erase your codes.
Also enable the backup functionality in the project settings
Good luck!
2017-06-27 06:59 AM
Thanks for your answer. I know this user-code-scheme, but my questions did not refer to editing the CubeMX generated source code (i'm sorry if my wording was ambiguous ). I want to know if it is possible to add additional header/source files or if I have to stick to the given structure and/or to the given CubeMX generated files.
2017-06-27 08:48 AM
Hi
Freund.Andreas
,You do not need to use 'Src' and 'Inc' Folders, but if you create a new folder on your project, you need to introduce it to your compiler to find your header files.
Bests,
Misagh
P.S: I have zero experience with TrueStudio, but in Keil you need to go to Project Option->C/C++ tab and add the directory in Include Paths Field to make sure the compiler will check it for your header files. Your compiler also may have the same process.
2017-06-30 08:49 AM
Thanks for your advice!
I also have little experience with TrueStudio, but I finally found a solution for my problem: I've already added the new folders to the compiler's include paths, but somehow TrueStudio didn't recognize them (in Project Properties -> C/C++ Build -> Tool Chain Editor)
I also had to add them to the 'Includes' Tab in Project Properties -> C/C++ General -> Paths and Symbols.