Create a Python script to generate class in C++ project inside a STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-06 3:26 AM
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.
- Labels:
-
STM32CubeIDE
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-06 3:43 AM - edited ‎2025-06-06 4:04 AM
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 designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-06 4:03 AM
@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 designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-06 1:01 PM - edited ‎2025-06-07 10:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-07 12:03 AM
@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 designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-06-07 9:56 AM - edited ‎2025-06-07 10:06 AM
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.
