Skip to main content
KMew
Senior III
October 4, 2022
Solved

STM32CubeIDE: Different File Structure

  • October 4, 2022
  • 10 replies
  • 15675 views

I am using the STM32H7B3I-EVAL, which includes a touch screen that uses the TouchGFX application. I am trying to do its tutorials, which includes modifying the code in the STM32CubeIDE. However, when I do, the file structure is different in my computer's file explorer compared to what is shown in the STM32CubeIDE project explorer.

For example, the TouchGFX folder in my File Explorer is not present in the IDE project explorer.

What causes this and what can be done to fix it?

0693W00000UnLQNQA3.png 

0693W00000UnLQhQAN.png

This topic has been closed for replies.
Best answer by RomainR.

Hello @KMew (Community Member)

Here below my answer to your previous questions:

"The level I'm looking at (ADC_Display) does not match what's in the project explorer. "

Again, that's is normal because STM32CubeIDE as a configuration view of it's root folder that is STM32CubeIDE\

"I went into one of the subfolders (ADC_Display/STM32CubeIDE) and I found a matching file directory!" 

Yes and that is what I already explain to you yesterday and just above.

"Now, it still poses an issue because this project folder is missing things like the header files and such. Does this information help at all? The .project and .cproject should be in the ADC_Display folder, not ADC_Display/STM32CubeIDE folder, correct?"

No your project generated has no issue. All sources and header file are located on folder above \STM32CubeIDE, like ..\Core or ..\TouchGFX.

Yes these informations are mandatory and STM32CubeIDE is able to found them because the path of the project are correctly configured (see following picture)

These folder path configuration are also into the .cproject file.

0693W00000UnZNwQAN.pngI confim again there is no issue in your generated project.

Best regards

Romain

10 replies

RomainR.
ST Employee
October 5, 2022

Hello @KMueh.1 (Community Member)

The representation of directories in STM32CubeIDE is specific to the way the project was created. This view of your project structure is totally dependent on the Eclipse project in a specific workspace.

You should note that the files in an eclipse project can be physically local to the project, but also linked (belonging to another path) 

Maybe this resource could be useful for you:

https://www.eclipse.org/escet/use/projects.html

Also the project you are working on is standard to the STM32CubeMX structure when generating a project.

Best regards,

Romain

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 5, 2022

Hello Romain,

Thank you for your reply.

I find this strange, as I was previously working with this project and the files/folders were visible in the project explorer. I only came back to it recently to try and modify it with my own code. The only thing I changed is that I took it off a company Dropbox and put it in my local folders. Would that change how the project explorer displays the folders at all?

I'm asking because this project was created by the TouchGFX compiler. I tested it with another test project, compiling it the same way in TouchGFX and I can see the file structure there.

RomainR.
ST Employee
October 5, 2022

Were you able to exclude your Drivers directory ?

Thank you to mark my post as answered.

Best regards,

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 5, 2022

Hello Romain,

Thank you for the reply, but I can't mark it as answered as my problem is still not resolved.

There's something I clearly don't understand about how these projects define the files for the workspace. I had a previously working project folder. I imported it to another folder (because I wanted to organize my work), and now the previous project folder does not work at all.

I need a solution that I can understand as to why the project explorer is so incomplete and why it's now causing my projects to not build.

RomainR.
ST Employee
October 6, 2022

Hello @KMueh.1 (Community Member)

I'm sorry, do not take into account my previous post I got the wrong subject.

For your problem it is clear that when you imported your original project into a new location you probably broke the project links. How did you do this import, manually ?

Can you check in the STM32CubeIDE folder (from your file explorer) that it contains the files:

.cproject and .project? 

It is also strange that all your directories are in the same directory as the .metadata which is used for the configuration of the Eclipse workspace?

You indicate that the project was created with TouchGFX. Here is what I would do in your place:

- I create and generate a new TouchGFX project with the same name as your initial project (same board). 

- Before opening it with STM32CubeIDE, you manually copy all the directories and source files from your initial project (except Debug) and you must keep the same folder organization.

You should then obtain the same structure of your project.

Best regards,

Romain

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 6, 2022

Hello Romain,

To answer your questions:

  1. I did import it manually. I copy and pasted the entire folder (including the .metadata) into a new folder.
  2. I looked in the folders and I only see .project. I do not see .cproject anywhere.

Also, I tried creating a new TouchGFX project and I'm running into a similar problem as before. The project explorer files are incomplete. It is only showing the files in the .ioc executable. Why can I not see Core, Drivers, EWARM, gcc, MDK-ARM, Middlewares, STM32CubeIDE, TouchGFX?

My folder directories are shown in the picture and my workspace is set to Master_Control/Software/Display.

0693W00000UnVvfQAF.png0693W00000UnVvkQAF.png

RomainR.
ST Employee
October 6, 2022

If .cproject is missing, indeed it can't work well.

STM32CubeIDE needs both .project and .cproject.

In your question:

"Also, I tried creating a new TouchGFX project and I'm running into a similar problem as before. The project explorer files are incomplete. It is only showing the files in the .ioc executable. Why can I not see Core, Drivers, EWARM, gcc, MDK-ARM, Middlewares, STM32CubeIDE, TouchGFX?"

In your new TouchGFX screen capture, the project is not incomplete, it is just folding.

In STM32CudeIDE project explorer window, you have to unfold the project to see all the files (the arrow on the left of the project name) Core, Drivers, TouchGFX and friend.....

Best regards

Romain

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 6, 2022

Hello,

What is the purpose of .cproject? When and how is it generated?

Also, sorry, I did have it folded, but I did mean that the folder structure is still not correct in there. It does not align with the folder structure in my file explorer.

0693W00000UnW2CQAV.png

RomainR.
ST Employee
October 6, 2022

.project and .cproject are generated by CubeMX or TouchGFX and they are part of the configuration files of the Eclipse project. their format is xml file.

You can open it with a modern text editor and see how they are structured and what information they provide.

This is your new TouchGFX project that you just created ?

Does it compile without errors ?

If yes, simply copy your user source codes from your original project. And you try to compile it.

Best regards,

romain

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 6, 2022

Hello Romain,

I'm sorry, but I'm still confused.

I am trying to figure out why my folder structure in the CubeIDE's project explorer does not match the folder structure I have in my file explorer. Every tutorial I've seen online for using TouchGFX or any other sample code has the two matching, but mine does not. When I look through the list, I can't find multiple different files too. For example, in that project explorer picture I sent, there are no header files in any of the folders. So clearly something is wrong and I don't understand what.

RomainR.
ST Employee
October 6, 2022

@KMew (Community Member)

As your whole project is folded, it is very difficult to answer and help you. 

Sorry I won't be able to help you more about what's happening on your computer !

I share with you a CubeIDE project created with TouchGFX where I aligned the IDE (on the left) view and my explorer view (on the right).

For me both structure are identical and all folder, source file and header are present.

And I do not understand why you do not have the same ?

Good luck

Best regards

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 6, 2022

Hello Romain,

I unfolded the folder in my previous response to do a comparison. I've copy and pasted how mine looks when I create a TouchGFX instance and hit "Generate Code."

This is how it looks, which you can clearly see the differences.

I am confused as to why yours constructs properly and mine does not. Could this be a workspace setting issue? I need to know a solution so I can actually follow tutorials and start learning STM32 programming.

I apologize if this is seeming difficult, but I am at a complete loss.

0693W00000UnWLsQAN.png

RomainR.
ST Employee
October 6, 2022

Here my last TouchGFX project generation usin last version 4.20.0 (the previous one was generated with TouchGXF 4.15)

I think the folder structure are different between IDE and file explorer because new version of TouchGFX generate a project that is compatible with 3 different IDE (IAR EWARM or ARM-KEIL and CubeIDE GCC)

This is not an issue, it's just a different view of the projectinside STM32CubeIDE folder.

0693W00000UnWUaQAN.png 

Do not be confused you don't have to worry about that, it doesn't change anything on your code.

Try to compile it and take a look into STM32CubeIDE folder it match with CubeIDE file structure.

0693W00000UnWV9QAN.png 

Best regards

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 6, 2022

Hello Romain,

I can compile it without issue. It shows what I intend to show. Yet when I look at the CubeIDE project explorer vs the file explorer, it's still different.

RomainR.
RomainR.Best answer
ST Employee
October 7, 2022

Hello @KMew (Community Member)

Here below my answer to your previous questions:

"The level I'm looking at (ADC_Display) does not match what's in the project explorer. "

Again, that's is normal because STM32CubeIDE as a configuration view of it's root folder that is STM32CubeIDE\

"I went into one of the subfolders (ADC_Display/STM32CubeIDE) and I found a matching file directory!" 

Yes and that is what I already explain to you yesterday and just above.

"Now, it still poses an issue because this project folder is missing things like the header files and such. Does this information help at all? The .project and .cproject should be in the ADC_Display folder, not ADC_Display/STM32CubeIDE folder, correct?"

No your project generated has no issue. All sources and header file are located on folder above \STM32CubeIDE, like ..\Core or ..\TouchGFX.

Yes these informations are mandatory and STM32CubeIDE is able to found them because the path of the project are correctly configured (see following picture)

These folder path configuration are also into the .cproject file.

0693W00000UnZNwQAN.pngI confim again there is no issue in your generated project.

Best regards

Romain

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 7, 2022

Hello Romain,

I apologize for the confusion that I have caused. Yes, I acknowledge that the code works. I was simply trying to find a way to have it show the entire folder generated (including the level above the STM32Cube folder) for ease of navigation and ease of adding a new .c or .h files.

If it's possible to show them in the Project Explorer, then I would be happy.

I do acknowledge that my original question has been answered.

RomainR.
ST Employee
October 7, 2022

Of course you can add the .c and .h sources you are developping, that's the purpose and it's designed for that. 

You can create a new directory, add files, and simply you can drag and drop it from the explorer to the CubeIDE project it will appears and add its path in the configuration I showed you above.

Don't worry, the important thing is that you can move forward in your project.

Good luck to you.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
KMew
KMewAuthor
Senior III
October 7, 2022

Hello Romain,

Yes, that makes sense. So if I wanted to modify the code that is in the ADC_Display/Core/Inc & ADC_Display/Core/Src folder (which is already part of the includes, I can drag both folders from the file explorer and modify it in the IDE?

Nikos Mich.
Associate II
January 4, 2023

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.