recipes-ti: initial check in of dsplink stack
[glsdk/meta-ti-glsdk.git] / recipes-ti / dsplink / ti-dsplink.inc
1 DESCRIPTION = "DSPLINK Inter-Processor Communications (IPC) for TI ARM/DSP processors"
2 HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/DSPLink/index.html"
3 SECTION = "devel"
4 LICENSE = "GPLv2"
6 LIC_FILES_CHKSUM = "file://dsplink/doc/gpl_2.0.pdf;md5=70996be607b61df78ce46093f4afe2bd"
9 # TODO :: KERNEL_CC, should use for kernel cc for module build?
10 # TODO :: Need to understand why OBJDUMP is required for kernel module
11 # TODO :: Unset required since LDFLAGS gets picked up and used incorrectly - investigate
12 # TODO :: Do we need to pass so many variables to each make step?
14 require ../includes/ti-paths.inc
15 require ../includes/ti-staging.inc
17 PROVIDES = "ti-dsplink-module"
18 PROVIDES += "ti-dsplink-examples"
20 # This package builds a kernel module, use kernel PR as base and append a local version
21 PR = "${MACHINE_KERNEL_PR}"
22 PR_append = "i"
24 S = "${WORKDIR}/dsplink_linux_${PV}"
26 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/${PV_DL_PATH}/dsplink_linux_${PV}.tar.gz;name=dsplinktarball \
27            file://ti-dsplink-examples-run.sh \
28            file://ti-dsplink-examples-loadmodules.sh \
29            file://ti-dsplink-examples-unloadmodules.sh "
31 DEPENDS = "ti-dspbios ti-xdctools ti-cgt6x" 
32 DEPENDS += "virtual/kernel perl-native" 
34 # SOC_FAMILY configuration
36 DSPLINKPLATFORM_dm6446    = "DAVINCI"
37 DSPLINKPLATFORM_dm6467    = "DAVINCIHD"
38 DSPLINKPLATFORM_omapl137  = "OMAPL1XX"
39 DSPLINKPLATFORM_omapl138  = "OMAPL138"
40 DSPLINKPLATFORM_omap3     = "OMAP3530"
41 DSPLINKPLATFORM          ?= "<UNDEFINED_DSPLINKPLATFORM>"
43 DSPLINKDSPCFG_dm6446      = "DM6446GEMSHMEM"
44 DSPLINKDSPCFG_dm6467      = "DM6467GEMSHMEM"
45 DSPLINKDSPCFG_omapl137    = "OMAPL1XXGEMSHMEM"
46 DSPLINKDSPCFG_omapl138    = "OMAPL138GEMSHMEM"
47 DSPLINKDSPCFG_omap3       = "OMAP3530SHMEM"
48 DSPLINKDSPCFG            ?= "<UNDEFINED_DSPLINKDSPCFG>"
50 DSPLINKDSP_dm6446         = "DM6446GEM_0"
51 DSPLINKDSP_dm6467         = "DM6467GEM_0"
52 DSPLINKDSP_omapl137       = "OMAPL1XXGEM_0"
53 DSPLINKDSP_omapl138       = "OMAPL138GEM_0"
54 DSPLINKDSP_omap3          = "OMAP3530_0"
55 DSPLINKDSP               ?= "<UNDEFINED_DSPLINKDSP>"
57 DSPLINKGPPOS_dm6446       = "DM6446LSP"
58 DSPLINKGPPOS_dm6467       = "DM6467LSP"
59 DSPLINKGPPOS_omapl137     = "ARM"
60 DSPLINKGPPOS_omapl138     = "ARM"
61 DSPLINKGPPOS_omap3        = "OMAPLSP"
62 DSPLINKGPPOS             ?= "<DEFINED_DSPLINKGPPOS>" 
64 # Exported Variable needed by build
65 DSPLINK = "${S}/dsplink"
66 export DSPLINK
68 do_configure() {
70     # Run perl script to create appropriate makefiles (v1.60 and up)
71     (
72     cd ${DSPLINK}
73     perl config/bin/dsplinkcfg.pl --platform=${DSPLINKPLATFORM} --nodsp=1 \
74         --dspcfg_0=${DSPLINKDSPCFG} --dspos_0=DSPBIOS5XX \
75         --gppos=${DSPLINKGPPOS} --comps=ponslrmc
76     )
77 }
79 do_prepsources () {
80         
81     # Prepare the tree for rebuiling - clean and generate interfaces
82     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .make -PR .
83     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc clean -PR .
84     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .interfaces -PR .
85 }
87 addtask prepsources after do_configure before do_compile
89 do_compile() {
90     # TODO :: KERNEL_CC, should use for kernel module build?
91     # TODO :: Need to understand why OBJDUMP is required for kernel module
92     # Unset these since LDFLAGS gets picked up and used incorrectly.... need 
93     # investigation
95     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
97     # Build the gpp user space library
98     cd ${DSPLINK}/gpp/src/api && make \
99       CROSS_COMPILE="${TARGET_PREFIX}" \
100       CC="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
101       AR="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
102       LD="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ld" \
103       COMPILER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
104       ARCHIVER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
105       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
106       all
108     # Build the gpp kernel space (debug and release)
109     cd ${DSPLINK}/gpp/src && make \
110       OBJDUMP="${TARGET_PREFIX}objdump" \
111       CROSS_COMPILE="${TARGET_PREFIX}" \
112       CC="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
113       AR="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
114       LD="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ld" \
115       COMPILER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
116       ARCHIVER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
117       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
118       BASE_BUILDOS="${STAGING_KERNEL_DIR}" \
119       all
121     # Build the gpp samples
122     cd ${DSPLINK}/gpp/src/samples && make \
123       BASE_TOOLCHAIN="${TOOLCHAIN_PATH}" \
124       BASE_CGTOOLS="${BASE_TOOLCHAIN}/bin" \
125       OSINC_PLATFORM="${TOOLCHAIN_PATH}/lib/gcc/${TARGET_SYS}/$(${TARGET_PREFIX}gcc -dumpversion)/include" \
126       OSINC_TARGET="${BASE_TOOLCHAIN}/target/usr/include" \
127       CROSS_COMPILE="${TARGET_PREFIX}" \
128       CC="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
129       LD="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
130       AR="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
131       COMPILER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
132       LINKER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}gcc" \
133       ARCHIVER="${TOOLCHAIN_PATH}/${TARGET_PREFIX}ar" \
134       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
135       all
137     # Build the dsp library (debug and release)
138      cd ${DSPLINK}/dsp/src && make \
139       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
140       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
141       all
143     # Build the dsp samples (debug and release)
144     cd ${DSPLINK}/dsp/src/samples && make \
145       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
146       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
147       all
150 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
152 do_install () {
153         
154     # Install the kernel module
155     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
156     install -m 0755 ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/dsplinkk.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/ 
158     # Install the example apps (gpp and dsp)
159     install -d ${D}/${installdir}/ti-dsplink-examples/
160     cp ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/*gpp ${D}/${installdir}/ti-dsplink-examples
161     cp ${DSPLINK}/dsp/export/BIN/DspBios/${DSPLINKPLATFORM}/${DSPLINKDSP}/RELEASE/*.out ${D}/${installdir}/ti-dsplink-examples    
163     # Install the example apps module un/load scripts
164     install ${WORKDIR}/ti-dsplink-examples-loadmodules.sh ${D}/${installdir}/ti-dsplink-examples
165     install ${WORKDIR}/ti-dsplink-examples-unloadmodules.sh ${D}/${installdir}/ti-dsplink-examples
166     install ${WORKDIR}/ti-dsplink-examples-run.sh ${D}/${installdir}/ti-dsplink-examples   
167  
168     # Install/Stage the Source Tree
169     install -d ${D}${LINK_INSTALL_DIR_RECIPE}
170     cp -pPrf ${S}/* ${D}${LINK_INSTALL_DIR_RECIPE}
171     chmod -R +w ${D}${LINK_INSTALL_DIR_RECIPE}
173     # Changes path of include txt file to use LINK_INSTALL_DIR variable for GPP
174     for i in $(find ${D}${LINK_INSTALL_DIR_RECIPE}/dsplink/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/*/ -name "*.txt"); do
175        sed -i ${i} -e s=${S}=\$\{LINK_INSTALL_DIR\}=g
176     done
178     # Changes path of include txt file to use LINK_INSTALL_DIR variable for DSP 
179     for i in $(find ${D}${LINK_INSTALL_DIR_RECIPE}/dsplink/dsp/export/BIN/DspBios/${DSPLINKPLATFORM}/${DSPLINKDSP}/*/ -name "*.txt"); do
180     sed -i ${i} -e s=${S}=\$\{LINK_INSTALL_DIR\}=g
181     done
185 PACKAGES += "ti-dsplink-module"
186 FILES_ti-dsplink-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/dsplinkk.ko" 
187 RDEPENDS_ti-dsplink-module += "update-modules"
189 pkg_postinst_ti-dsplink-module () {
190 #!/bin/sh
191 if [ -n "$D" ]; then
192         exit 1
193 fi
195 depmod -a
196 update-modules || true
199 pkg_postrm_ti-dsplink-module () {
200 #!/bin/sh
201 update-modules || true
204 PACKAGES += "ti-dsplink-examples"
205 RDEPENDS_ti-dsplink-examples_append = " ti-dsplink-module"
206 RDEPENDS_ti-dsplink-examples_append_omap3 += " ti-lpm-module ti-lpm-utils"
207 FILES_ti-dsplink-examples = "${installdir}/ti-dsplink-examples/*"
208 INSANE_SKIP_ti-dsplink-examples = True