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