2021-02-23 04:26 AM
STM32 CubeIDE v1.5.1; Build: 9029_20201210_1234 (UTC)
The same Eclipse Project as:
https://community.st.com/s/question/0D53W00000Y2lIsSAJ/cant-usecreate-debug-config-for-oss7-stack
It is a 'C' Project, but the CubeIDE defines __cplusplus:
Which, as you can see, messes-up the codes checks to see if C++ is being used!
If I manually delete that definition, all is fine.
The problem does not happen when opening the project in a "normal" Eclipse Neon 3.
So why is CubeIDE adding this?
2021-02-24 04:19 AM
Looked at your links but was still not able to find the project. Could you provide direct link to download project?
Q1: If you open the .project-file in the original project (before importing it into CubeIDE). Does it contain the node: <nature>org.eclipse.cdt.core.ccnature</nature> ??
Q2: If you import the project into CubeIDE. Now open the .project-file, does it now contain the ccnature node?
If CubeIDE for some reason adds C++ to the project file, then it sounds like a bug. If it is part of the original content, then I would guess this is expected?!
If ccnature. then the C++ compiler is also setup for the project, and then the C++ compiler would set up the symbol "__cplusplus=201402L", assuming you are using -std=gnu++14.
Need som more info/answers...
2021-02-25 01:08 AM
You're right: it's not supplied as a "ready to go" project - you have to create the project by running CMake.
I'll take a look at the ccnature thing, and make a project to upload...
2021-02-25 02:32 AM
OK, the freshly-created Eclipse Project contains:
<natures>
<nature>org.eclipse.cdt.make.core.makeNature</nature>
<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
So, yes: it does contain a "ccnature" - and also a "cnature"
I just opened this in CubeIDE by double-clicking the .project - and this time it has not defined __cplusplus !
Projects attached:
2021-03-01 09:01 AM
I am not sure that the approach is good to start with. CMake does have some support to generate Eclipse project. But to my understanding this part of CMake is not well-maintained. If I do a quick google on "CMake generate Eclipse projects" most search hits are a decade old...
It may be more safe to have CMake generate only a makefile and create a CubeIDE project that uses this "CMake managed makefile" to build your resources. Removes one layer of complexity, maybe at the cost of adding another ;)
This approach should be possible in CubeIDE 1.6.0. First as always make back-up of your project....
Then try this:
Is this a better way forward? It may have both pros and cons. We are always interested in feedback...
Made some edits to clarify the process after reading @Pavel A. post. Will see if i can setup a virtual Ubuntu machine in home office to re-produce.
2021-03-02 09:14 AM
Hi @mattias norlander
Your advise unfortunately does not work here on Ubuntu...
We have an existing makefile project.
Checked "Generate Makefiles automatically".
But this does not enable " MCU Settings"
Please advise ? Is this working only on Windows or only for newly created makefile projects?
Thanks,
Pavel
2021-03-02 06:32 PM
Answering my own question...
* The trick to specify the MCU requires to create a new CubeIDE makefile project, as in the Mattias' post above.
* Folks who have any other Eclipse makefile - based projects, can take them and *** **** up their *** ****.
* The binary should be located under the project directory. Could not make the GUI recognize any build variables or linked resource paths to specify the binary to debug.
Anyway this is definitely a progress.
Thanks!
-- pa
Update:
Re. point #2 about existing makefile projects: there still is a way to salvage them.
Create a new dummy makefile project in CubeIDE and specify the correct MCU as explained above in Mattias' post.
Build the dummy project to produce an .elf file, create a debug launch config for it.
Then transplant the real .elf created by the real makefile onto the dummy project:
On the Startup tab, add the real elf. Specify for it download and load symbols. but not build. The green arrow should point to this real file.
For the dummy .elf, uncheck load and load symbols.
Now, you should be able to debug it.
2021-03-09 10:10 AM
So I installed Cube 1.6.0, used CMake to create a makefile project, then proceeded with the steps @mattias norlander gave.
This does give me a project that I can build from the CubeIDE, and I can create a debug config and start a debug session.
But the debugger doesn't find the source files, and adding things to the 'Source' tab doesn't help.
Even if I put in a fully-specified file + path name, the debugger will say it can't find the file - with that exact same path + name!
Possibly related to this, stepping seems flaky - I guess the source file I think I'm looking at isn't what/where the debugger thinks it's looking?
2021-03-11 05:25 AM
I tried adding a 'Source Folder' to the project:
Note the '>' indicating that it can be expanded & has stuff beneath.
But, after I added the Debug Configuration, the 'Source Folder' became empty:
Note how the '>' has gone - there is now nothing to expand!
So, instead, I tried a just a 'Folder' - not a 'Source Folder' - and used the 'Advanced' options to point to the source files location:
Which gives
and I could add that as a 'Workspace Folder' to the Debug Config:
and that does seem to enable the debugger to find the source files.
Perhaps someone could explain the difference between a 'Folder' and a 'Source Folder' ?
2021-03-11 05:31 AM
perhaps I should add that the structure of the OSS-7 tree is like this:
OSS7 ---+--- cubewsp << folder for the CubeIDE Workspace
|
+--- src ----+--- stack ... << the stack source tree
|
+--- build << the makefiles created by CMake
so the source files are not "beneath" the makefiles - they are in a tree alongside them