Building of a new library with Erika IDE

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
riccardo.ancona
Newbie
Posts: 3
Joined: Mon Oct 27, 2014 12:39 pm

Building of a new library with Erika IDE

Post by riccardo.ancona » Wed Nov 12, 2014 11:27 am

Hello everyone,
I want to include an existing set of source code (.c files as well as .h files, so NOT a .a file) into my Erika project.
The files are created outside the Erika IDE (i.e. they are not part of the ee/contrib directory) and I want to put them into a directory called "usrLibs" in the main directory of my Erika project (where there is also the main.c).

Where I have to add the include paths and specify the .c sources to build in Erika toolchain?
I did not find this information in the wiki, and I didn't understand very well what is written in the RT-Druid ref. manual at page 25. Should I modify the .oil file or the Makefiles? And how?

Thank you for your time,

Riccardo

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: Building of a new library with Erika IDE

Post by e.guidieri » Wed Nov 12, 2014 11:45 am

In .oil file

Code: Select all

CPU_DATA = PIC30 {    <--- Valid for any suppoeted CPU_DATA
    APP_SRC = " usrLibs/file1.c"; /* Relative path  to your project directory (the ones contains .oil file) or an absolute path */
    APP_SRC = " usrLibs/file2.c";
    ...
};
Errico

riccardo.ancona
Newbie
Posts: 3
Joined: Mon Oct 27, 2014 12:39 pm

Re: Building of a new library with Erika IDE

Post by riccardo.ancona » Wed Nov 12, 2014 11:48 am

Hi Errico,
Thanks for your quick answer :)
The problem that I am facing doing like this is that it takes into account only .c files. If those files are including .h files (as usual) the compiler is complaining that cannot include them because is not finding them.
So, how can I specify include paths?

Thanks very much for your support!

Riccardo

e.guidieri
Full Member
Posts: 166
Joined: Tue May 10, 2011 2:05 pm

Re: Building of a new library with Erika IDE

Post by e.guidieri » Wed Nov 12, 2014 11:55 am

riccardo.ancona wrote:Hi Errico,
Thanks for your quick answer :)
The problem that I am facing doing like this is that it takes into account only .c files. If those files are including .h files (as usual) the compiler is complaining that cannot include them because is not finding them.
So, how can I specify include paths?

Thanks very much for your support!

Riccardo
This is a little bit more tricky.

You have to use CFLAGS field to add the compiler option that add directory inclusion in compiler command line:

E.G. (Supposing using GCC compiler).

Code: Select all

  OS myEE {
    ...
    CFLAGS = "-I UserLibs"
    ...
  }
Errico

riccardo.ancona
Newbie
Posts: 3
Joined: Mon Oct 27, 2014 12:39 pm

Re: Building of a new library with Erika IDE

Post by riccardo.ancona » Wed Nov 12, 2014 3:21 pm

I really thank you Errico for your support :)

I am trying to add one by one the source files that I need, but they are hundreds: there is a shortcut that I can exploit (like you usually can do using normal makefiles, i.e.:

Code: Select all

$(call rwildcard,./source/,*.cpp)  
in order to collect several files and listing them in the CFLAGS variable?

Moreover, where I can find more information on how to customize the .oil file in order to avoid asking here and annoying you with such kind of questions?

Thanks for your support!

Riccardo

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Building of a new library with Erika IDE

Post by paolo.gai » Wed Nov 12, 2014 3:53 pm

No, currently there are no shortcuts available in the version distributed online.

The typical thing we do when we handle big number of files are one of the following:

1- put the code inside contrib so that it will be compiled as some of the other libraries.

2- you may want to change the makefiles in pkg/cfg to include your custom source tree.

3- customize the code generator in a way that it will add automatically all the missing files to the generated makefile

4- ry to add the makefile command (such as $(call rwildcard,./source/,*.cpp) ). it maybe could work (but there is no guarantee for that).

Point 1 is the typical way to do if the project is open-source. 2 and 3 are typical ways we use when we provide services to companies.

Note the manuals available are meant mainly for users, explaining what the user should do in order to use the system...

Ciao,

Paolo

Post Reply