AnsweredAssumed Answered

how write .bb file for multiple file compilation?

Question asked by Bhargav Jayswal on Nov 9, 2017
Latest reply on Nov 24, 2017 by gusarambula


Dear Expert,


I am using imx6 processor and wrote an application. To cross compile i am using yocto for that.

 

I have 4 files in different directory.

 

1. /home/Linux/NXP/XYZ/Embedded/read/read.c
2. /home/Linux/NXP/XYZ/Embedded/main/mainfun.c
3. /home/Linux/NXP/XYZ/Embedded/write/write.c
4. /home/Linux/NXP/XYZ/Embedded/config/config.c

 

and .bb file is located at

 

"/home/Linux/NXP/yocto/jethro/yocto/source/meta-mylayer/recipes-app/mainfun/mainfun.bb"

 

==> From mainfun.c i am calling different function which funcion defination are present inside write.c , config.c and 

        read.c

 

==>I am only come across single file compilation using yocto so can you please help how i write .bb file , how can i compile and generate "XYZ_app" exicutable.

 

Here i attached .bb file which i have written but not working

 

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

DESCRIPTION = "multiple file compilation"
PR = "r0"
LICENSE = "CLOSED"

 

SRC_URI += "file://home/Linux/NXP/XYZ/Embedded/ \
           "

 

S = "${WORKDIR}"

 

do_compile() {

 

    ${CC} ${CFLAGS} ${LDFLAGS} --static -c  ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/read/read.c
    ${CC} ${CFLAGS} ${LDFLAGS} --static -c  ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/write/write.c
    ${CC} ${CFLAGS} ${LDFLAGS} --static -c  ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/conf/conf.c
    ${CC} ${CFLAGS} ${LDFLAGS} --static -c  ${WORKDIR}}/home/Linux/NXP/XYZ/Embedded/mainfun/mainfun.c
    ${CC} ${CFLAGS} ${LDFLAGS} --static ${WORKDIR} /home/Linux/NXP/XYZ/Embedded/Read/read.o /home/Linux/NXP/XYZ/Embedded/write/write.o /home/Linux/NXP/XYZ/Embedded/conf/conf.o /home/Linux/NXP/XYZ/Embedded/mainfun/mainfun.o -c XYZ_App
}

 

do_install() {

 

    install -m 0755 -d ${D}${bindir}
    install -m 0755 ${S}/XYZ_App ${D}${bindir}
}

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Thanks and Regards,

Bhargav

Outcomes