2022-06-06 02:45 AM
Problem:
The project contains core code c files as link in the project. It makes adding new files in common location ridiculously complicated and slow.
(Path: PROJECT/CM7/Core)
Workaround:
I remove the links to core files, I add a links to Core/Src and Core/Inc directories, works as charm. Now I can add files to those directories.
The catch:
Each time IOC file is changed, the IDE creates those links again and they must be manually deleted.
Where IS the folder structure and instructions to create those links?
There is similar problem with TouchGFX files (and the virtual folder structure is even crazier), but saving changes in IOC doesn't rebuild that structure.
2022-06-06 02:57 AM
Leave default folder structure as it is, let Cube and TouchGFX manage it as they want. But add a new link to your own code folder (and another one for includes, if you want, but it is not necessary)
Like this:
Project
- [Core]
+ - main.c (link to file)
. . .
- [TouchGFX]
+ - MainView.cpp (link to file)
. . .
- [MyCode] (link to folder)
+ - mycode.c
. . .
2022-06-06 03:36 AM
@ktrofimo you need to post as a 'Code snippet' for the formatting to work; eg,
2022-06-06 03:41 AM
That's what I tried to do in the first place, however, the compiler tried to compile the same files twice. That's the reason I deleted the original links. It's weird, because physically the files are not duplicated. Just in one virtual directory I had links to files, in another - the link was to physical directory. BTW, I've just launched TouchGFX designer and it removed all my C++ files from the Cube project. They are still on the disk, but the IDE links are broken.
I checked the build scripts, and as I expected, they contain physical paths, not the links. I don't quite understand how it works.
2022-06-06 03:46 AM
@Adam �?yskawa "launched TouchGFX designer and it removed all my C++ files from the Cube project"
Does TouchGFX support C++ ?
2022-06-06 04:06 AM
It is written in C++
2023-01-04 01:21 AM
How to create a SMT32cubeIDE project with TouchGFX functionality that has similar folder structure to a touchGFX project created in STM32cubeIDE from scratch:
1. Create a dummy project from TouchGFX designer for your discovery board. Put in the GUI just a box. Generate code.Then, close the TouchGFX designer.
2. Somewhere in your PC create a Folder with the name of the project you wish to create, let’s say “base�?.
3. Open the .ioc file of the project created with TouchGFX designer with CubeMX. Open with CubeMX and not from STM32cubeIDE. Go to File->Save Project As.. and save the project in the folder you have created in Step 2. CubeMX names automatically the new project (i.e. the new .ioc file) with the same name as the folder you will save it in, so the file that will be produced is base.ioc. Then go to the tab “Project Manager�? and select Project->Toolchain/IDE STM32CubeIDE and “tick Generate Under Root�?. Save the project. Press “Generate Code�?. Close CubeMX.
4. Open with Windows explorer the folder of the project that was created with TouchGFX and in a new window open the project that you created in Step 3 (we will call it “base project�? from now on) .
a) One-by-one copy the following folders from the folder of the TouchGFX Designer project to the folder of base project so that they overwrite the existing folders: “Core�?, “Drivers�?, “Middlewares�?.
b) Go to the folder “TouchGFX�? of the TouchGFX Designer project and copy one-by-one all the folders contained in it to the folder “TouchGFX�? of base project.
c) Go to the folder “STMCubeIDE�? of the TouchGFX Designer project. Copy the two .ld files to the root folder of the base project so that they overwrite the existing files.
d) Go to the folder “STMCubeIDE\Application\Startup�? of the TouchGFX Designer project and copy the .c file to the “Core\Startup�? folder of the base project so that it overwrites the existing file.
e) Go to the folder “STMCubeIDE\Application\User�? of the TouchGFX Designer project and copy the .c files to the “Core\Src�? folder of the base project so that they overwrite the existing files.
5. Import the base project to STM32CubeIDE. Expand the project in the project explorer and click on the file “ApplicationTemplate.touchgfx.part�? to open the TouchGFX designer. Then, choose “Black UI�? and create a simple GUI just using a box and Text. Generate code and close TouchGFX.
6. In the STM32CubeIDE, click on the ioc file and then Generate code.
7. Build all. Some errors will be produced, because the compiler cannot find the .h files of the BSP. Go to the project name, right click and then go to properties to add the include paths for these header files. Unlike other IDEs, the files added to the project explorer are not included automatically to the compiler’s paths and so this must be done manually. Instructions for this are available online. Here is a rough way to do it. Properties->C/C++ Build->Settings->MCU GCC Compiler -> Include path. Add the path to the header file that the compiler couldn’t find. And also Properties->C/C++ Build->Settings->MCU GCC Compiler -> Include path. Add the path to the header file that the compiler couldn’t find. They are in the folder �?Drivers/BSP/Components�? of the base project. It is also best to change the #includes in the code from a path e.g. #include “Components/ili9341.h�? to just the filename #include “ili9341.h�?
8. You are Done!! You can use project base as a starting point for your TouchGFX projects.