using myapp eclipse esp-idf configuration as template - adding project folder

DL88AI88
Posts: 29
Joined: Mon Aug 29, 2016 8:26 am

using myapp eclipse esp-idf configuration as template - adding project folder

Postby DL88AI88 » Sun Mar 19, 2017 2:47 pm

Hi there,

I followed the instructions to install esp-idf, eclipse and myapp as a template for creating new projects.
The build process works correctly. No error.
So, in order to create a new project, I just copy "myapp" and paste it with a new name in eclipse.
Again the build process works without any complain in the new app.
Now, I want to alter this new project and add some subfolders in eclipse under its folder called main.
I created additional source and header files in main folder and added two subfolder underneath main folder.

I edited the "makefile" by adding two lines:
COMPONENT_ADD_INCLUDEDIRS := components/include
include $(IDF_PATH)/make/project.mk

Underneath main folder I edited component.mk by adding two lines:
COMPONENT_ADD_INCLUDEDIRS := . subfolder1_of_main subfolder2_of_main
COMPONENT_SRCDIRS := $(COMPONENT_ADD_INCLUDEDIRS)

Now, when I start build process again I don't get any errors from CDT Build Console
but all subfolders and all newly added header and source files in the main folder are marked with a blue question mark.
How can I get eclipse/esp-idf to find the new files and subdirectories?

Thanks for any hint in advance.

Best regards

DL88AI88

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby ESP_Angus » Mon Mar 20, 2017 2:44 am

I think IDF is not finding the new component, so it isn't being compiled in. Hence Eclipe hasn't indexed the files and marks them with the question mark.
I created additional source and header files in main folder and added two subfolder underneath main folder.
From IDF's point of view, "main" is a component. It is special because it's the only component that doesn't live under the "components" folder. You can add a "components" directory in your project's main directory (the directory with the Makefile) and add project-specific components to individual directories under there.

Consult the example project layout (and associated info) in the documentation for more details:
http://esp-idf.readthedocs.io/en/latest ... le-project

Alternatively, if you want the source files to be part of the "main" component then you can add source directories under "main", and add the directories via the COMPONENT_SRCDIRS & COMPONENT_ADD_INCLUDEDIRS variables in the existing main/component.mk (see documentation page linked above). Both approaches will work, it depends on how you want to structure your code.

Angus

DL88AI88
Posts: 29
Joined: Mon Aug 29, 2016 8:26 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby DL88AI88 » Mon Mar 20, 2017 6:38 am

I followed exactly your proposed way and as to the mentioned link.
That is why I edited component.mk underneath main folder by adding two lines:

COMPONENT_ADD_INCLUDEDIRS := . subfolder1_of_main subfolder2_of_main
COMPONENT_SRCDIRS := $(COMPONENT_ADD_INCLUDEDIRS)

This should point to the structure like so:

- myProject/ - Makefile
- sdkconfig
....
- main/ - main.c
- added_src1.c
- added_src2.c
- added_headerfile1.h
- added_headerfile2.h
- subfolder1_of_main/
- subfolder2_of_main/
- component.mk
- build/

What am I missing?

Best regards

DL88AI88

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby ESP_Angus » Mon Mar 20, 2017 8:28 am

Sorry, you're right. I totally misread your first post.

Are these files being compiled as part of the build? You can verify by modifying one of the files, choosing Project -> Build, and checking for the file name in the build output.

If the files are being included in the build correctly, you can force a rebuild of Eclipse's internal C/C++ data cache under under Project -> C/C++ Index -> Rebuild. Then Project -> Clean and afterwards run a Project -> Build. I wouldn't have thought this was necessary, but maybe it is under some circumstances.

Angus

DL88AI88
Posts: 29
Joined: Mon Aug 29, 2016 8:26 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby DL88AI88 » Mon Mar 20, 2017 6:42 pm

Strange thing.
I can find the built files in the build directory of the project folder.
I did a Rebuild, a clean and run a build again.
The blue question marks are still there.
I will try flashing the program and check whether it will work.
Maybe it is just a false message from eclipse which can be igrnored....

Best regards

DL88AI88

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby ESP_Angus » Tue Mar 21, 2017 9:06 am

DL88AI88 wrote:The blue question marks are still there.
My apologies, I really didn't think about your question before replying.

The question marks are added by the Eclipse git integration, Eclipse is telling you that the files are not yet added to the git repository.

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby rudi ;-) » Tue Mar 21, 2017 10:36 am

@DL88AI88
can u post your template for "import.zip" this?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

DL88AI88
Posts: 29
Joined: Mon Aug 29, 2016 8:26 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby DL88AI88 » Tue Mar 21, 2017 2:46 pm

Hi Rudi,

I wish, I could.But I reinstalled esp-idf and eclipse as to the latest posting here
http://esp-idf.readthedocs.io/en/latest ... setup.html
and
http://esp-idf.readthedocs.io/en/latest ... setup.html
(B.t.w. I could not find the menu item "Make Targets" in eclipse Neon, but "Project Targets".)
I keep all files and directories like it is described inthe guides above.

But:
I just want to organize my projects like this:
/home/development/workspace/esp32project_1
/home/development/workspace/esp32project_2
...
and so on.

Now when I import one of these projects into eclipse as it is written here
http://esp-idf.readthedocs.io/en/latest ... setup.html
and try to build from eclipse I get error messages.
Then, when I do a clean and try to build from command line I get different error messages.
(Jumping between eclipse and command line, in order to build and flash a project in eclipse is quite tedious.)
Also, repeating the whole configuration process every time for each imported project is not funny either.
I know, there is probably a short way, but I haven't found it yet.

It is quite time consuming to set up a working environment for esp32 development, sigh.


Dl88AI88

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby rudi ;-) » Tue Mar 21, 2017 3:25 pm

DL88AI88 wrote: (B.t.w. I could not find the menu item "Make Targets" in eclipse Neon, but "Project Targets".)
perhabs this helps:
project create make is
if you right click to an open project
and then you can selct make targets

the same is then in the right corner,
you see after open the project
your opended project right side in the "Make target" window ( outline..)

you can create new target here or with right click on the opened project
make_targets.gif
make_targets.gif (3.95 MiB) Viewed 13843 times
DL88AI88 wrote:
I keep all files and directories like it is described inthe guides above.

But:
I just want to organize my projects like this:
/home/development/workspace/esp32project_1
/home/development/workspace/esp32project_2
...
and so on.
ok this is ok -
as long as ecipse knows where your workspace is.
cause eclipse works with environment vars
${WorkspaceDirPath}/esp32project_1
${WorkspaceDirPath}/esp32project_1

DL88AI88 wrote: Now when I import one of these projects into eclipse as it is written here
http://esp-idf.readthedocs.io/en/latest ... setup.html
and try to build from eclipse I get error messages.
can u pls post this error message?
DL88AI88 wrote: Then, when I do a clean and try to build from command line I get different error messages.
(Jumping between eclipse and command line, in order to build and flash a project in eclipse is quite tedious.)
same here, can you post the error message
example make a screen copy and save the picture

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

DL88AI88
Posts: 29
Joined: Mon Aug 29, 2016 8:26 am

Re: using myapp eclipse esp-idf configuration as template - adding project folder

Postby DL88AI88 » Wed Mar 22, 2017 8:51 am

Hi there,

@Angus: Thank you for the info about the blue question marks.
(reminds me that I was standing in the wood and couldn't see the wood because of all the trees... :oops: )

@Rudi: Your animated gif did the trick!
;)
(In eclipse Neon.2 the menu item is called "Build Target". "Make Target" seems to be the previous naming).


Eclipse seems to be really picky. I reinstalled esp-idf, eclipse and created a new workspace.
checked all path twice.
Finally I got a running ide!
Thanks to all. This forum is a great help!

Having a beer on you next weekend. ;)

Cheers

DL88AI88

Who is online

Users browsing this forum: No registered users and 184 guests