cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Python script to generate class in C++ project inside a STM32CubeIDE

Vergnani_ElEn
Associate

I created a python script with GUI, generating a class inside a .cpp and .h files. I put those files inside a worlspace project folder. But I want to importa that files inside a IDE project directly in Python script. There are some way to do that.

5 REPLIES 5
Andrew Neil
Super User

CubeIDE is built on Eclipse.

You'd need to dig into Eclipse documentation for details of the project file structure, syntax, etc.

.project and .cproject  are XML files - so you can view & edit them using your favourite XML editor. Or just a text editor.

At a quick look, I don't see file names in there - there are folder names, but not filenames.

So maybe just putting your files into appropriate folders is sufficient?

You'd probably need to ask this on an Eclipse forum...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Andrew Neil wrote:

So maybe just putting your files into appropriate folders is sufficient?


You could try it: Just add a file, and then see what (if anything) changes in any of the Eclipse metadata files ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Pavel A.
Super User

After adding source files to an Eclipse managed project folder without Eclipse knowing it, you need to refresh the project. This causes Eclipse to re-scan the source folders and pick up the new files.

To refresh the project, hit F5 in the Eclipse GUI. So, user intervention will be needed. It may be possible to ask Eclipse to refresh but I don't know how. Alternatively you can update the .cproject file with your tool, but if Eclipse has this project loaded, this will cause conflict and a manual action again. 


@Pavel A. wrote:

 Alternatively you can update the .cproject file


As far as I can see, the .cproject file doesn't list the source files?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Thanks for correcting. The managed builder indeed does not keep the list of source files in the .cproject.

But it caches the result of scanning/refreshing somewhere. Likely under  "${WorkspaceDirPath}/.metadata/.plugins/org.eclipse.cdt.core/${ProjName}...

Explicitly linked files (the "virtual filesystem" ) are in .project ; section <linkedResources>

Usually when I run headless build in CI environment, it starts in a clean workspace so Eclipse has to scan and find all files. Not sure when it decides to refresh if the project is already open in the IDE.