ti-recipes: Add SECTION qualifiers to recipes
[openembedded.git] / recipes / ti / ti-dsplink.inc
blob432cfb436e94f9cb8e9ba834dd09f3c60af49b25
1 DESCRIPTION = "DSPLINK Inter-Processor Communications (IPC) for TI ARM/DSP processors"
2 HOMEPAGE = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/DSPLink"
3 SECTION = "devel"
5 # TODO :: KERNEL_CC, should use for kernel cc for module build?
6 # TODO :: Need to understand why OBJDUMP is required for kernel module
7 # TODO :: Unset required since LDFLAGS gets picked up and used incorrectly - investigate
8 # TODO :: Do we need to pass so many variables to each make step?
10 require ti-paths.inc
11 require ti-staging.inc
13 PROVIDES = "ti-dsplink-module"
14 PROVIDES += "ti-dsplink-examples"
16 # This package builds a kernel module, use kernel PR as base and append a local version
17 PR = "${MACHINE_KERNEL_PR}"
18 PR_append = "c"
20 S = "${WORKDIR}/dsplink_linux_${PV}"
22 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/DSPLink/${PV}/exports/dsplink_linux_${PV}.tar.gz;name=dsplinktarball \
23            file://loadmodules-ti-dsplink-apps.sh \
24            file://unloadmodules-ti-dsplink-apps.sh "
26 DEPENDS = "ti-dspbios ti-xdctools ti-cgt6x" 
27 DEPENDS += "virtual/kernel perl-native" 
29 # SOC_FAMILY configuration
31 DSPLINKPLATFORM_dm6446    = "DAVINCI"
32 DSPLINKPLATFORM_dm6467    = "DAVINCIHD"
33 DSPLINKPLATFORM_omapl137  = "OMAPL1XX"
34 DSPLINKPLATFORM_omapl138  = "OMAPL138"
35 DSPLINKPLATFORM_omap3     = "OMAP3530"
36 DSPLINKPLATFORM          ?= "<UNDEFINED_DSPLINKPLATFORM>"
38 DSPLINKDSPCFG_dm6446      = "DM6446GEMSHMEM"
39 DSPLINKDSPCFG_dm6467      = "DM6467GEMSHMEM"
40 DSPLINKDSPCFG_omapl137    = "OMAPL1XXGEMSHMEM"
41 DSPLINKDSPCFG_omapl138    = "OMAPL138GEMSHMEM"
42 DSPLINKDSPCFG_omap3       = "OMAP3530SHMEM"
43 DSPLINKDSPCFG            ?= "<UNDEFINED_DSPLINKDSPCFG>"
45 DSPLINKGPPOS_dm6446       = "MVL5G"
46 DSPLINKGPPOS_dm6467       = "DM6467LSP"
47 DSPLINKGPPOS_omapl137     = "ARM"
48 DSPLINKGPPOS_omapl138     = "ARM"
49 DSPLINKGPPOS_omap3        = "OMAPLSP"
50 DSPLINKGPPOS             ?= "<DEFINED_DSPLINKGPPOS>" 
52 # Exported Variable needed by build
53 DSPLINK = "${S}/dsplink"
54 export DSPLINK
56 do_configure() {
58     # asm/page.h is gone with linux-libc-headers 2.6.31.
59     # We can safely sed it out since it has been empty for the past 2 years
60     sed -i /page.h/d ${S}/dsplink/gpp/src/api/Linux/drv_api.c || true 
62     # Run perl script to create appropriate makefiles (v1.60 and up)
63     (
64     cd ${DSPLINK}
65     perl config/bin/dsplinkcfg.pl --platform=${DSPLINKPLATFORM} --nodsp=1 \
66         --dspcfg_0=${DSPLINKDSPCFG} --dspos_0=DSPBIOS5XX \
67         --gppos=${DSPLINKGPPOS} --comps=ponslrmc
68     )
72 do_prepsources () {
73         
74     # Prepare the tree for rebuiling - clean and generate interfaces
75     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .make -PR .
76     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc clean -PR .
77     XDCPATH=${DSPLINK} ${XDC_INSTALL_DIR}/xdc .interfaces -PR .
79     # Clean the gpp user space library
80     cd ${DSPLINK}/gpp/src/api && make \
81       CROSS_COMPILE="${TARGET_PREFIX}" \
82       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
83       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
84       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
85       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
86       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
87       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
88       clean
90     # Clean the gpp kernel space (debug and release)
91     cd ${DSPLINK}/gpp/src && make \
92       OBJDUMP="${TARGET_PREFIX}objdump" \
93       CROSS_COMPILE="${TARGET_PREFIX}" \
94       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
95       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
96       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
97       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
98       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
99       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
100       BASE_BUILDOS="${STAGING_KERNEL_DIR}" \
101       clean
103     # Clean the gpp samples
104     cd ${DSPLINK}/gpp/src/samples && make \
105       BASE_TOOLCHAIN="${TOOLCHAIN_PATH}" \
106       BASE_CGTOOLS="${BASE_TOOLCHAIN}/bin" \
107       OSINC_PLATFORM="${TOOLCHAIN_PATH}/lib/gcc/${TARGET_SYS}/$(${TARGET_PREFIX}gcc -dumpversion)/include" \
108       OSINC_TARGET="${BASE_TOOLCHAIN}/target/usr/include" \
109       CROSS_COMPILE="${TARGET_PREFIX}" \
110       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
111       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
112       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
113       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
114       LINKER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
115       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
116       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
117       clean
119     # Clean the dsp library (debug and release)
120      cd ${DSPLINK}/dsp/src && make \
121       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
122       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
123       clean
125     # Clean the dsp samples (debug and release)
126     cd ${DSPLINK}/dsp/src/samples && make \
127       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
128       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
129       clean
130         
133 addtask prepsources after do_configure before do_compile
135 do_compile() {
136     # TODO :: KERNEL_CC, should use for kernel module build?
137     # TODO :: Need to understand why OBJDUMP is required for kernel module
138     # Unset these since LDFLAGS gets picked up and used incorrectly.... need 
139     # investigation
141     unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
143     # Build the gpp user space library
144     cd ${DSPLINK}/gpp/src/api && make \
145       CROSS_COMPILE="${TARGET_PREFIX}" \
146       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
147       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
148       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
149       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
150       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
151       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
152       all
154     # Build the gpp kernel space (debug and release)
155     cd ${DSPLINK}/gpp/src && make \
156       OBJDUMP="${TARGET_PREFIX}objdump" \
157       CROSS_COMPILE="${TARGET_PREFIX}" \
158       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
159       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
160       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ld" \
161       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
162       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
163       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
164       BASE_BUILDOS="${STAGING_KERNEL_DIR}" \
165       all
167     # Build the gpp samples
168     cd ${DSPLINK}/gpp/src/samples && make \
169       BASE_TOOLCHAIN="${TOOLCHAIN_PATH}" \
170       BASE_CGTOOLS="${BASE_TOOLCHAIN}/bin" \
171       OSINC_PLATFORM="${TOOLCHAIN_PATH}/lib/gcc/${TARGET_SYS}/$(${TARGET_PREFIX}gcc -dumpversion)/include" \
172       OSINC_TARGET="${BASE_TOOLCHAIN}/target/usr/include" \
173       CROSS_COMPILE="${TARGET_PREFIX}" \
174       CC="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
175       LD="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
176       AR="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
177       COMPILER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
178       LINKER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}gcc" \
179       ARCHIVER="${TOOLCHAIN_PATH}/bin/${TARGET_PREFIX}ar" \
180       KERNEL_DIR="${STAGING_KERNEL_DIR}" \
181       all
183     # Build the dsp library (debug and release)
184      cd ${DSPLINK}/dsp/src && make \
185       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
186       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
187       all
189     # Build the dsp samples (debug and release)
190     cd ${DSPLINK}/dsp/src/samples && make \
191       BASE_CGTOOLS="${CODEGEN_INSTALL_DIR}" \
192       BASE_SABIOS="${BIOS_INSTALL_DIR}" \
193       all
196 KERNEL_VERSION = "${@base_read_file('${STAGING_KERNEL_DIR}/kernel-abiversion')}"
198 do_install () {
199         
200     # Install the kernel module
201     install -d ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp
202     install -m 0755 ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/dsplinkk.ko ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/ 
204     # Install the example apps
205     install -d ${D}/${installdir}/ti-dsplink-examples/
206     cp ${DSPLINK}/gpp/export/BIN/Linux/${DSPLINKPLATFORM}/RELEASE/*gpp ${D}/${installdir}/ti-dsplink-examples
207     
208     for i in $(find ${DSPLINK}/dsp/BUILD/ -name "*.out") ; do
209         cp ${i} ${D}/${installdir}/ti-dsplink-examples
210     done
212     # Install the example apps module un/load scripts
213     install ${WORKDIR}/loadmodules-ti-dsplink-apps.sh ${D}/${installdir}/ti-dsplink-examples
214     install ${WORKDIR}/unloadmodules-ti-dsplink-apps.sh ${D}/${installdir}/ti-dsplink-examples
215     
216     # Install/Stage the Source Tree
217     install -d ${D}${LINK_INSTALL_DIR_RECIPE}
218     cp -pPrf ${S}/* ${D}${LINK_INSTALL_DIR_RECIPE}
219     chmod -R +w ${D}${LINK_INSTALL_DIR_RECIPE}
222 PACKAGES += "ti-dsplink-module"
223 FILES_ti-dsplink-module = "/lib/modules/${KERNEL_VERSION}/kernel/drivers/dsp/dsplinkk.ko" 
224 RDEPENDS_ti-dsplink-module += "update-modules"
226 pkg_postinst_ti-dsplink-module_append () {
227         if [ -n "$D" ]; then
228                 exit 1
229         fi
230         depmod -a
231         update-modules || true
234 pkg_postrm_ti-dsplink-module_append () {
235         update-modules || true
238 PACKAGES += "ti-dsplink-examples"
239 RDEPENDS_ti-dsplink-examples += "ti-dsplink-module"
240 RDEPENDS_ti-dsplink-examples_omap3 += "ti-lpm-module"
241 FILES_ti-dsplink-examples = "${installdir}/ti-dsplink-examples/*"
242 INSANE_SKIP_ti-dsplink-examples = True