u-boot-bug: Drop do_stage (not needed), add package_stagefile_shell to deploy
[openembedded.git] / recipes / ti / ti-dsplink.inc
blob388d05737225ad09a698fa82452e8137f1c588a7
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 # TODO :: KERNEL_CC, should use for kernel cc for module build?
7 # TODO :: Need to understand why OBJDUMP is required for kernel module
8 # TODO :: Unset required since LDFLAGS gets picked up and used incorrectly - investigate
9 # TODO :: Do we need to pass so many variables to each make step?
11 require ti-paths.inc
12 require ti-staging.inc
14 PROVIDES = "ti-dsplink-module"
15 PROVIDES += "ti-dsplink-examples"
17 # This package builds a kernel module, use kernel PR as base and append a local version
18 PR = "${MACHINE_KERNEL_PR}"
19 PR_append = "h"
21 S = "${WORKDIR}/dsplink_linux_${PV}"
23 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/${PV_DL_PATH}/dsplink_linux_${PV}.tar.gz;name=dsplinktarball \
24            file://ti-dsplink-examples-run.sh \
25            file://ti-dsplink-examples-loadmodules.sh \
26            file://ti-dsplink-examples-unloadmodules.sh "
28 DEPENDS = "ti-dspbios ti-xdctools ti-cgt6x" 
29 DEPENDS += "virtual/kernel perl-native" 
31 # SOC_FAMILY configuration
33 DSPLINKPLATFORM_dm6446    = "DAVINCI"
34 DSPLINKPLATFORM_dm6467    = "DAVINCIHD"
35 DSPLINKPLATFORM_omapl137  = "OMAPL1XX"
36 DSPLINKPLATFORM_omapl138  = "OMAPL138"
37 DSPLINKPLATFORM_omap3     = "OMAP3530"
38 DSPLINKPLATFORM          ?= "<UNDEFINED_DSPLINKPLATFORM>"
40 DSPLINKDSPCFG_dm6446      = "DM6446GEMSHMEM"
41 DSPLINKDSPCFG_dm6467      = "DM6467GEMSHMEM"
42 DSPLINKDSPCFG_omapl137    = "OMAPL1XXGEMSHMEM"
43 DSPLINKDSPCFG_omapl138    = "OMAPL138GEMSHMEM"
44 DSPLINKDSPCFG_omap3       = "OMAP3530SHMEM"
45 DSPLINKDSPCFG            ?= "<UNDEFINED_DSPLINKDSPCFG>"
47 DSPLINKDSP_dm6446         = "DM6446GEM_0"
48 DSPLINKDSP_dm6467         = "DM6467GEM_0"
49 DSPLINKDSP_omapl137       = "OMAPL1XXGEM_0"
50 DSPLINKDSP_omapl138       = "OMAPL138GEM_0"
51 DSPLINKDSP_omap3          = "OMAP3530_0"
52 DSPLINKDSP               ?= "<UNDEFINED_DSPLINKDSP>"
54 DSPLINKGPPOS_dm6446       = "DM6446LSP"
55 DSPLINKGPPOS_dm6467       = "DM6467LSP"
56 DSPLINKGPPOS_omapl137     = "ARM"
57 DSPLINKGPPOS_omapl138     = "ARM"
58 DSPLINKGPPOS_omap3        = "OMAPLSP"
59 DSPLINKGPPOS             ?= "<DEFINED_DSPLINKGPPOS>" 
61 # Exported Variable needed by build
62 DSPLINK = "${S}/dsplink"
63 export DSPLINK
65 do_configure() {
67     # Run perl script to create appropriate makefiles (v1.60 and up)
68     (
69     cd ${DSPLINK}
70     perl config/bin/dsplinkcfg.pl --platform=${DSPLINKPLATFORM} --nodsp=1 \
71         --dspcfg_0=${DSPLINKDSPCFG} --dspos_0=DSPBIOS5XX \
72         --gppos=${DSPLINKGPPOS} --comps=ponslrmc
73     )
76 do_prepsources () {
77         
78     # Prepare the tree for rebuiling - clean and generate interfaces
79     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .make -PR .
80     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc clean -PR .
81     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .interfaces -PR .
84 addtask prepsources after do_configure before do_compile
86 do_compile() {
87     # TODO :: KERNEL_CC, should use for kernel module build?
88     # TODO :: Need to understand why OBJDUMP is required for kernel module
89     # Unset these since LDFLAGS gets picked up and used incorrectly.... need 
90     # investigation
92     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
94     # Build the gpp user space library
95     cd ${DSPLINK}/gpp/src/api && make \
96       CROSS_COMPILE="${TARGET_PREFIX}" \
97       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
98       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
99       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
100       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
101       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
102       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
103       all
105     # Build the gpp kernel space (debug and release)
106     cd ${DSPLINK}/gpp/src && make \
107       OBJDUMP="${TARGET_PREFIX}objdump" \
108       CROSS_COMPILE="${TARGET_PREFIX}" \
109       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
110       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
111       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
112       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
113       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
114       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
115       BASE_BUILDOS="${STAGING_KERNEL_DIR}" \
116       all
118     # Build the gpp samples
119     cd ${DSPLINK}/gpp/src/samples && make \
120       BASE_TOOLCHAIN="${TOOLCHAIN_PATH}" \
121       BASE_CGTOOLS="${BASE_TOOLCHAIN}/bin" \
122       OSINC_PLATFORM="${TOOLCHAIN_PATH}/lib/gcc/${TARGET_SYS}/$(${TARGET_PREFIX}gcc -dumpversion)/include" \
123       OSINC_TARGET="${BASE_TOOLCHAIN}/target/usr/include" \
124       CROSS_COMPILE="${TARGET_PREFIX}" \
125       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
126       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
127       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
128       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
129       LINKER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
130       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
131       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
132       all
134     # Build the dsp library (debug and release)
135      cd ${DSPLINK}/dsp/src && make \
136       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
137       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
138       all
140     # Build the dsp samples (debug and release)
141     cd ${DSPLINK}/dsp/src/samples && make \
142       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
143       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
144       all
147 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
149 do_install () {
150         
151     # Install the kernel module
152     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
153     install -m 0755 ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/dsplinkk.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/ 
155     # Install the example apps (gpp and dsp)
156     install -d ${D}/${installdir}/ti-dsplink-examples/
157     cp ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/*gpp ${D}/${installdir}/ti-dsplink-examples
158     cp ${DSPLINK}/dsp/export/BIN/DspBios/${DSPLINKPLATFORM}/${DSPLINKDSP}/RELEASE/*.out ${D}/${installdir}/ti-dsplink-examples    
160     # Install the example apps module un/load scripts
161     install ${WORKDIR}/ti-dsplink-examples-loadmodules.sh ${D}/${installdir}/ti-dsplink-examples
162     install ${WORKDIR}/ti-dsplink-examples-unloadmodules.sh ${D}/${installdir}/ti-dsplink-examples
163     install ${WORKDIR}/ti-dsplink-examples-run.sh ${D}/${installdir}/ti-dsplink-examples   
165     # Install/Stage the Source Tree
166     install -d ${D}${LINK_INSTALL_DIR_RECIPE}
167     cp -pPrf ${S}/* ${D}${LINK_INSTALL_DIR_RECIPE}
168     chmod -R +w ${D}${LINK_INSTALL_DIR_RECIPE}
170     # Changes path of include txt file to use LINK_INSTALL_DIR variable for GPP
171     for i in $(find ${D}${LINK_INSTALL_DIR_RECIPE}/dsplink/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/*/ -name "*.txt"); do
172        sed -i ${i} -e s=${S}=\$\{LINK_INSTALL_DIR\}=g
173     done
175     # Changes path of include txt file to use LINK_INSTALL_DIR variable for DSP 
176     for i in $(find ${D}${LINK_INSTALL_DIR_RECIPE}/dsplink/dsp/export/BIN/DspBios/${DSPLINKPLATFORM}/${DSPLINKDSP}/*/ -name "*.txt"); do
177     sed -i ${i} -e s=${S}=\$\{LINK_INSTALL_DIR\}=g
178     done
182 PACKAGES += "ti-dsplink-module"
183 FILES_ti-dsplink-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/dsplinkk.ko" 
184 RDEPENDS_ti-dsplink-module += "update-modules"
186 pkg_postinst_ti-dsplink-module () {
187 #!/bin/sh
188 if [ -n "$D" ]; then
189         exit 1
192 depmod -a
193 update-modules || true
196 pkg_postrm_ti-dsplink-module () {
197 #!/bin/sh
198 update-modules || true
201 PACKAGES += "ti-dsplink-examples"
202 RDEPENDS_ti-dsplink-examples_append = " ti-dsplink-module"
203 RDEPENDS_ti-dsplink-examples_append_omap3 += " ti-lpm-module ti-lpm-utils"
204 FILES_ti-dsplink-examples = "${installdir}/ti-dsplink-examples/*"
205 INSANE_SKIP_ti-dsplink-examples = True