ti33x: switch default preference to ti-staging tree
[glsdk/meta-ti-glsdk.git] / recipes-ti / syslink / ti-syslink.inc
1 DESCRIPTION = "SYSLINK Inter-Processor Communications (IPC) for TI ARM/DSP processors"
2 HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/syslink/index.html"
3 SECTION = "devel"
4 LICENSE = "BSD"
6 LIC_FILES_CHKSUM = "file://docs/bsd.pdf;md5=9f2edd962cd129f8c24e9ef1bd641029"
8 # TODO :: multi-machine, add m3 build as well?
9 # TODO :: proper staging?
10 # TODO :: kernel module examples?
11 # TODO :: smarter handling of config.bld
12 # TODO :: review XDC parallel make - why not happening automatically?
13 # TODO :: smarter suffix management
15 require ../includes/ti-paths.inc
16 require ../includes/ti-staging.inc
18 PROVIDES = "ti-syslink-module"
19 PROVIDES += "ti-syslink-examples"
21 # This package builds a kernel module, use kernel PR as base and append a local version
22 PR = "${MACHINE_KERNEL_PR}"
23 PR_append = "a"
24 PVExtra = ""
26 inherit module pkgconfig
28 S = "${WORKDIR}/syslink_${PV}${PVExtra}"
30 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/syslink/${PV}${PVExtra}/exports/syslink_${PV}${PVExtra}.tar.gz;name=syslinktarball \
31            file://syslink.pc \
32           "
34 DEPENDS = "ti-sysbios ti-xdctools ti-cgt6x ti-ipc ti-cgt470"
35 DEPENDS += "virtual/kernel" 
37 #common frameq gateMP heapBufMP heapMemMP knlNotify listMP messageQ notify ringIO ringIO_gpp sharedRegion slaveLoader tilerDaemon
38 SYSLINKHLOSSAMPLES = "knlnotify slaveLoader frameq notify"
39 #SYSLINKRTOSSAMPLES = "frameq gateMP heapBufMP heapMemMP listMP messageQ notify ringIO ringIO_gpp sharedRegion"
41 # SOC_FAMILY configuration
43 SYSLINKPLATFORM_omap3     = "OMAP3530"
44 SYSLINKPLATFORM_omapl137  = "OMAPL1XX"
45 SYSLINKPLATFORM_omapl138  = "OMAPL1XX"
46 SYSLINKPLATFORM_ti816x    = "TI81XX"
47 SYSLINKPLATFORM_ti814x    = "TI81XX"
48 SYSLINKPLATFORM          ?= "<UNDEFINED_SYSLINKPLATFORM>"
50 SYSLINKVARIANT_omap3     = "OMAP3530"
51 SYSLINKVARIANT_omapl137  = "OMAPL1XX"
52 SYSLINKVARIANT_omapl138  = "OMAPL1XX"
53 SYSLINKVARIANT_ti816x    = "TI816X"
54 SYSLINKVARIANT_ti814x    = "TI814X"
55 SYSLINKVARIANT          ?= "<UNDEFINED_SYSLINKVARIANT>"
57 # COFF/ELF config - omap3 can be coff/elf, omapl only coff, ti816x and ti814x only elf
59 # this really needs to be a list... in the case of ELF/COFF (and this could use DSPSUFFIX?)
60 SYSLINKSUFFIX_omap3       = "x64P"
61 SYSLINKSUFFIX_omapl137    = "x674"
62 SYSLINKSUFFIX_omapl138    = "x674"
63 SYSLINKSUFFIX_ti816x      = "xe674"
64 SYSLINKSUFFIX_ti814x      = "xe674"
65 SYSLINKSUFFIX            ?= "<UNDEFINED_SYSLINKSUFFIX>"
67 SYSLINKLOADER_omap3       = "COFF"
68 SYSLINKLOADER_omapl137    = "COFF"
69 SYSLINKLOADER_omapl138    = "COFF"
70 SYSLINKLOADER_ti816x      = "ELF"
71 SYSLINKLOADER_ti814x      = "ELF"
72 SYSLINKLOADER            ?= "<UNDEFINED_SYSLINKLOADER>"
74 # Do we really need to configure this? - configured already in config.bld
75 XDCTARGETS_omap3          = "ti.targets.C64P"
76 XDCTARGETS_omapl137       = "ti.targets.C674"
77 XDCTARGETS_omapl138       = "ti.targets.C674"
78 # for ti816x and ti814x, we should later also build for ti.targets.arm.elf.M3
79 XDCTARGETS_ti816x         = "ti.targets.elf.C674 ti.targets.arm.elf.M3"
80 XDCTARGETS_ti814x         = "ti.targets.elf.C674 ti.targets.arm.elf.M3"
81 XDCTARGETS               ?= "<UNDEFINED_XDCTARGETS>"
82 export XDCTARGETS
84 # Exported Variable needed by build
85 export SYSLINK_ROOT = "${S}/packages/"
87 export XDCPATH = "${IPC_INSTALL_DIR}/packages;${SYSBIOS_INSTALL_DIR}/packages" 
89 do_configure() {
90     sed -i -e s:@VERSION@:${PV}:g ${WORKDIR}/syslink.pc
91     
92     cp ${WORKDIR}/syslink.pc ${S}
93 }
95 do_prepsources () {
96         
97     # Prepare the tree for rebuiling - clean and generate interfaces
98     cd ${SYSLINK_ROOT}/ti/syslink    
99     ${XDC_INSTALL_DIR}/xdc --jobs=${BB_NUMBER_THREADS} .make -PR .
100     ${XDC_INSTALL_DIR}/xdc --jobs=${BB_NUMBER_THREADS} clean -PR .
101     ${XDC_INSTALL_DIR}/xdc --jobs=${BB_NUMBER_THREADS} .interfaces -PR .
104 addtask prepsources after do_configure before do_compile
106 do_compile() {
107     # TODO :: KERNEL_CC, should use for kernel module build?
108     # TODO :: Check the 'unset's
110     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
112     do_make_scripts
114     # Build the gpp (hlos) kernel space
115     cd ${SYSLINK_ROOT}/ti/syslink/utils/hlos/knl/Linux && make \
116         ARCH="${TARGET_ARCH}" \
117         CROSS_COMPILE="${TARGET_PREFIX}" \
118         SYSLINK_PLATFORM="${SYSLINKPLATFORM}" \
119         SYSLINK_VARIANT="${SYSLINKVARIANT}" \
120         SYSLINK_LOADER="${SYSLINKLOADER}" \
121         SYSLINK_PKGPATH="${IPC_INSTALL_DIR}/packages" \
122         KDIR="${STAGING_KERNEL_DIR}"
124 #    # Build the gpp (hlos) kernel space samples. 
125 #    for sample in ${SYSLINKHLOSSAMPLES}; do
126 #        cd ${SYSLINK_ROOT}/ti/syslink/samples/hlos/$sample/knl/Linux && make \
127 #            ARCH="${TARGET_ARCH}" \
128 #            CROSS_COMPILE="${TARGET_PREFIX}" \
129 #            SYSLINK_PLATFORM="${SYSLINKPLATFORM}" \
130 #            SYSLINK_VARIANT="${SYSLINKVARIANT}" \
131 #            SYSLINK_LOADER="${SYSLINKLOADER}" \
132 #            SYSLINK_PKGPATH="${IPC_INSTALL_DIR}/packages" \
133 #            SYSLINK_SDK=EZSDK \
134 #            KDIR="${STAGING_KERNEL_DIR}"
135 #    done
137     # Build the gpp (hlos) user space
138     cd ${SYSLINK_ROOT}/ti/syslink/utils/hlos/usr/Linux && make \
139         ARCH="${TARGET_ARCH}" \
140         CROSS_COMPILE="${TARGET_PREFIX}" \
141         TOOLCHAIN_PREFIX="${TOOLCHAIN_PATH}/${TARGET_PREFIX}" \
142         SYSLINK_PLATFORM="${SYSLINKPLATFORM}" \
143         SYSLINK_VARIANT="${SYSLINKVARIANT}" \
144         SYSLINK_LOADER="${SYSLINKLOADER}" \
145         SYSLINK_PKGPATH="${IPC_INSTALL_DIR}/packages"
147     # Build the gpp (hlos) user space samples 
148     # First build the common lib for samples.
149     cd ${SYSLINK_ROOT}/ti/syslink/samples/hlos/common/usr/Linux && make \
150         ARCH="${TARGET_ARCH}" \
151         CROSS_COMPILE="${TARGET_PREFIX}" \
152         TOOLCHAIN_PREFIX="${TOOLCHAIN_PATH}/${TARGET_PREFIX}" \
153         SYSLINK_PLATFORM="${SYSLINKPLATFORM}" \
154         SYSLINK_VARIANT="${SYSLINKVARIANT}" \
155         SYSLINK_LOADER="${SYSLINKLOADER}" \
156         SYSLINK_SDK=EZSDK \
157         SYSLINK_PKGPATH="${IPC_INSTALL_DIR}/packages"
159     for sample in ${SYSLINKHLOSSAMPLES}; do
160         cd ${SYSLINK_ROOT}/ti/syslink/samples/hlos/$sample/usr/Linux && make \
161             ARCH="${TARGET_ARCH}" \
162             CROSS_COMPILE="${TARGET_PREFIX}" \
163             TOOLCHAIN_PREFIX="${TOOLCHAIN_PATH}/${TARGET_PREFIX}" \
164             SYSLINK_PLATFORM="${SYSLINKPLATFORM}" \
165             SYSLINK_VARIANT="${SYSLINKVARIANT}" \
166             SYSLINK_LOADER="${SYSLINKLOADER}" \
167             SYSLINK_SDK=EZSDK \
168             SYSLINK_PKGPATH="${IPC_INSTALL_DIR}/packages"
169     done
171     # Build the dsp/arm (rtos) code (system and samples)
172     # cd ${SYSLINK_ROOT}/ti/syslink && \
173     #     ${XDC_INSTALL_DIR}/xdc --jobs=${BB_NUMBER_THREADS} -PR .
174     export XDCOPTIONS=v
175     cd ${SYSLINK_ROOT}/ti/syslink && \
176         ${XDC_INSTALL_DIR}/xdc -P \
177          `${XDC_INSTALL_DIR}/bin/xdcpkg ${SYSLINK_ROOT}/ti/syslink | grep -v samples`
178     export XDCARGS="profile=debug"
179     cd ${SYSLINK_ROOT}/ti/syslink && \
180         ${XDC_INSTALL_DIR}/xdc --jobs=${BB_NUMBER_THREADS} -P \
181          `${XDC_INSTALL_DIR}/bin/xdcpkg ${SYSLINK_ROOT}/ti/syslink | grep samples`
184 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
186 do_install () {
188     # Install the hlos kernel module
189     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
190     install -m 0755 ${SYSLINK_ROOT}/ti/syslink/bin/${SYSLINKVARIANT}/syslink.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/
192     # Install the hlos example kernel modules and apps
193     install -d ${D}/${installdir}/ti-syslink-examples
194     install -m 0755 ${SYSLINK_ROOT}/ti/syslink/bin/${SYSLINKVARIANT}/samples/* ${D}/${installdir}/ti-syslink-examples/
196     # Install the rtos example apps 
197     install -d ${D}/${installdir}/ti-syslink-examples/dsp
198     cd ${SYSLINK_ROOT}/ti/syslink/samples/rtos
199     for i in $(find . -name "*.${SYSLINKSUFFIX}" | grep "${SOC_FAMILY}"); do
200         install ${i} ${D}/${installdir}/ti-syslink-examples/dsp/
201     done
203     # TODO :: Fixup - library/headers installation - this shouldn't go into the examples directory....
204     # Needs proper staging
205     # Install the library in the filesystem
206     # install -d ${D}/${installdir}/ti-syslink-examples
207     # install -m 0755 ${SYSLINK_ROOT}/ti/syslink/lib/syslink.a ${D}/${installdir}/ti-syslink-examples/
208     
209     # Install/Stage the Source Tree
210     install -d ${D}${SYSLINK_INSTALL_DIR_RECIPE}
211     cp -pPrf ${S}/* ${D}${SYSLINK_INSTALL_DIR_RECIPE}
212    
213     install -d ${D}/${libdir}/pkgconfig
214     install ${S}/syslink.pc ${D}/${libdir}/pkgconfig/
217 PACKAGES =+ "ti-syslink-module"
218 FILES_ti-syslink-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/syslink.ko" 
219 RDEPENDS_ti-syslink-module += "update-modules"
221 pkg_postinst_ti-syslink-module () {
222 #!/bin/sh
223 if [ -n "$D" ]; then
224         exit 1
225 fi
227 depmod -a
228 update-modules || true
231 pkg_postrm_ti-syslink-module () {
232 #!/bin/sh
233 update-modules || true
236 PACKAGES =+ "ti-syslink-examples"
237 RRECOMMENDS_ti-syslink-examples_append = " ti-syslink-module"
238 FILES_ti-syslink-examples = "${installdir}/ti-syslink-examples/*"
239 INSANE_SKIP_ti-syslink-examples = "1"
241 FILES_ti-syslink-dev = "${libdir}/*"