cancel
Showing results for 
Search instead for 
Did you mean: 

Rules for Project from makefile?

Andrew Neil
Evangelist III

So there is the menu option :

File > New > Makefile Project with Existing Code

With this structure:

Top----+----Folder----+---- makefile
                        |
                        +---- other files & folders
                        |
                        +----workspace

It doesn't work: after filling-in all the fields, then pressing 'Finish' in the import dialogue, nothing happens at all - no messages, and no project is created.

(Both CubeIDE v1.6.1 and v1.7.0)

But with this structure:

Top----+----Folder----+---- makefile
         |              |
         |              +---- other files & folders
         |
         +----workspace

It works.

So: what are the rules about where the workspace folder is allowed to be relative to the makefile?

Are there any other restrictions about any other file locations?

4 REPLIES 4
Pavel A.
Evangelist III

You can create a project in a way that pleases CubeIDE, then close it. move where you want and import it into your workspace.

Optionally tweak the make command - for example "make -C .."

IMHO the best is placing all stuff for a project in a subdirectory. Not in the same folder with the workspace .metadata,

The .project and .cproject can be in the same folder with the makefile.

The question is: what "pleases" CubeIDE ?

It seems that, if it is not "pleased", it will simply sulk and ignore the request.

:unamused_face:

Your 2nd variant seems to work, right?

mattias norlander
ST Employee

Have not played too much with this Eclipse/CDT feature.

The default behavior (if I remember well), is that the Makefile is expected to be at the root of the project your pointed out. Your structure#1, is probably not expected by Eclipse. Do you get any output in the .metadata/.log-file?

Where the project is located physically is not so important. It can be anywhere on any disc more or less. Does not have to be inside your workspace.

But I don't think having a workspace inside a project is a good idea. ... Or I missinterpret the figure above...

You could try to use CubeMX stand-alone and generate a project. NOT targetting CubeIDE. Instead the Project Manager should set toolchain = Makefile.

Then in CubeIDE use the File > New > Makefile project with existing Code. Select MCU ARM GCC and point the Existing Code Location, to the MX generated project.

Doing this will create a link from your workspace to wherever MX generated the project. In the MX create project folder CubeIDE will create the .project and .cproject files which turns the previous MX code folder into a CubeIDE project relying on the MX generated Makefile.

This is probably not your exact use case. But, it takes you 5-10min to set this up and then you have a working reference project to compare your project setting with when exploring what is going wrong in the setup above.

Pay special attention to the Project Properties > C?C++ Build > Builder Settings. Here you will see the build directory configured for the project

So if you get for example error message: make: *** No rule to make target 'all'. Stop. Then maybe the Makefile is not located in the folder set as Build directory.

Kind regards, Mattias