Adding specific library build on the fly with RT-Druid

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Locked
Phil0031

Adding specific library build on the fly with RT-Druid

Post by Phil0031 »

Hi
I am trying to implement a specific library built on the fly with the link, but I do no see effect in the make file.
What I did :
I did the following change c

In file conf.oil I added
EE_OPT = "__ADD_LIBS__";
LIB = ENABLE { NAME = "mylib"; };

In hiearchy ee_files/contrib I created a folder mylib with cfg, inc (includes files), src (sources files)
with in cfg.mk file
ifeq ($(call islibopt, __LIB_MYLIB__), yes)
ifeq ($(call iseeopt, __TC27xxMYLIB__), yes)
INCLUDE_PATH += $(EEBASE)/contrib/mylib/inc
endif # __TC27xxMYLIB__
endif # __LIB_MYLIB__
with in libcfg.mk file
ifeq ($(call iseeopt, __TC27xxMYLIB__), yes)
ifeq ($(findstring __LIB_MYLIB__,$(LIB_OPT)) , __LIB_MYLIB__)
INCLUDE_MYLIB = YES
endif
ifeq ($(call iseeopt, __BUILD_ALL_LIBS__), yes)
INCLUDE_MYLIB = YES
endif
ifeq ($(INCLUDE_MYLIB), YES)
INCLUDE_PATH += $(EEBASE)/contrib/mylib/inc
## Add each file individually
EE_SRCS_MYLIB += contrib/mylib/src/src0.c
## Make list of object files and add it to libraries global list
EE_OBJS_MYLIB := $(addprefix $(OBJDIR)/, $(patsubst %.c,%.o,$(patsubst %.s,%.o,$(EE_SRCS_MYLIB))))
LIBSRCS += $(EE_SRCS_MYLIB)
MYLIBLIB := libmylib.a
$(MYLIBLIB): $(EE_OBJS_MYLIB)
@echo "AR $(MYLIBLIB)";
$(QUIET)$(EE_AR) $(COMPUTED_OPT_AR) $@ $^
OPT_LIBS += $(MYLIBLIB)
ALL_LIBS += $(MYLIBLIB)
endif # INCLUDE_MYLIB
endif # __TC27xxMYLIB__

And in make file added
LIB_OPT += __LIB_MYLIB__

But in the make execution I do see libee.a for ERIKA, but not the build of my library.
Do I missed something is respective declaration, I didn't find a clear description in the wiki for this purpose.

Thanks for your help.
Phil
e.guidieri

Re: Adding specific library build on the fly with RT-Druid

Post by e.guidieri »

Hi Phil,

good job, you almost got everyrthing right in an not easy task.

Try to add:

LIBDEP += $(MYLIBLIB)

This should do the trick.

Regards,
Errico
paolo.gai
Administrator
Posts: 877
Joined: Thu Dec 07, 2006 12:11 pm

Re: Adding specific library build on the fly with RT-Druid

Post by paolo.gai »

Once you get it done, it would be nice if you could update or write a new wiki page on the topic :-)

Thanks!

PJ
Phil0031

Re: Adding specific library build on the fly with RT-Druid

Post by Phil0031 »

Hi Paolo

I did the change in libcfg.mk to add LIBDEP += $(MYLIBLIB), but there is no effect no compiling of mylib library
I tested also the change in the make, cfg but not in the OIL as syntax is not support.
I seems that contrib/mylib/cfg is not visible ! in my oil the configuration is defined for MCU_DATA = TRICORE { MODEL = TC27xC;/
Phil0031

Re: Adding specific library build on the fly with RT-Druid

Post by Phil0031 »

Hi again

I even applies the patch from Matthias - Some patches for ERIKA v2.8 - but no success
1. MIssing $(LIBS) ./RT-Druid/plugins/com.eu.evidence.ee_2.8.0.20171025_0922/ee_files/pkg/cfg/arch/rules_infineon_tc_generic.mk and added $(QUIET)$(EE_LINK) $(OPT_LINK) $(TARGET_LD_FILE) $(OBJS) $(LIBDEP) $(LINK_REDIRECT) $(LIBS)
MatzeB.

Re: Adding specific library build on the fly with RT-Druid

Post by MatzeB. »

Hi Phil,
I think that my patch isn't related to your problem. The reason for my patch was, that the linker for an AURIX/Tricore ignored the user defined libs from the oil file. But this is/was the case for already compiled libs. If your build doesn't generate a libmylib.a then there must be something wrong before the final linker call.

Regards
Matthias
Locked