NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
How to build an ARM/DSP Hello World program on the DaVinci EVM
This tutorial addresses those who have only got the DaVinci DM6446 EVM without any expensive JTAG device and want to build a very easy DSP program that can be invoked within Montavista linux on the arm side. I wrote this tutorial because I had to search, post in newsgroups and edit Makefiles for a whole week only to make the DSP send the ARM a simple "Hello, World!" message.
Once you have established a working toolchain to the ARM and the DSP, writing more interesting programs (ie fourier transform) should be very easy.
What you need
- the DaVinci DM6446 EVM with Montavista linux running
- a PC with linux AND windows working on it (linux may be virtualized)
- you have already gone through the "Getting Started" guide and spend a day installing everything from the CDs
- you have already found out that the software on the CDs is quite old, registered at ti.com and installed the most important updates 
- as a registered ti user, you have installed the test version of Code Composer Studio 
- you have got a telnet or ssh connection between host and EVM
- you can share folders between linux and windows host and the EVM (via samba or nfs)
TI basically wants you to understand the DSP as a blackbox. Or, if you are a codec engineer, use the Codec Engine framework to design codecs. In the former case, you only develop on the ARM, in the latter, you buy an expensive JTAG debugger and work directly on the DSP. Both ways do not allow you to write a simple program that uses both ARM and DSP (within a restricted period of time). But you need both in order to take advantage of the main strength of the DaVinci: the interaction between ARM and DSP. Besides both toolchains, you also need means for sending messages between both processors (rather than simply writing into common memory). Dsplink is a library (and kernel module for montavista) that offers you exactly these functions.
Building DSPLink on arm-linux
After you have installed all programs from the CDs, the Dsplink is located somewhere in ~/dvevm_1_20/dsplink_1_30/packages/dsplink and can be compiled as described on page A-17 in the "Getting Started" guide.
IMHO, it is easier to have the arm toolchain directly on the arm target. Later, you have to develop the DSP binaries in windows and thus don't need to switch between windows and linux host all the time. For this, you need make the kernel headers available to the EVM, i.e. copying /opt/mv_pro_4.0/montavista/pro/devkit from the linux host to the target /opt. Of course, you also copy ~/dvevm_1_20/dsplink_1_30/packages/dsplink to the EVM (i.e. into /opt). After that, you edit the Makefile dvevm_1_20/dsplink_1_30_08_02/packages/dsplink/make/Linux/davinci_mvlpro4.0.mk (on the arm-linux target) <syntaxhighlight lang='make'> BASE_BUILDOS := /opt/devkit/lsp/ti-davinci BASE_CGTOOLS := /usr/bin OSINC_PLATFORM := /usr/lib/gcc/armv5tl-montavista-linuxeabi/3.4.3/include OSINC_TARGET := /usr/include BASE_OSLIB := /usr/lib </syntaxhighlight>
recompile a utility needed for the build
cd /opt/devkit/lsp/ti-davinci/scripts/mod gcc -o modpost file2alias.c modpost.c sumversion.c
set the environment variable
and run the configuration script (see Dsplink User Guide)
cd $DSPLINK/etc/host/scripts/Linux ./dsplinkcfg
Important: Select Windows as Dsp/Bios OS and remember the other selections.
Now you can run the build
sh -f buildmodule.sh
or, alternatively, build the samples
cd $DSPLINK/gpp/src/samples make -s release
Building the Dsp binaries
At first, copy the dsplink folder from your linux to your windows host, i.e. C:\dvevm_1_20\dsplink_1_30_08_02\packages\dsplink.
From now on, we work on the windows host. You need to install
- the Code Composer Studio test version
- Perl in C:\Perl
- MinGW in C:\Mingw 
Copy C:\Mingw\mingw32-make.exe to gmake.exe so your Mingw can understand the gmake command.
Create the folder C:\ti-tools\bios,
- copy the contents of C:\CCStudio_v3.3\bios_5_31_02 into C:\ti-tools\bios and
- the folder C:\CCStudio_v3.3\C6000 into C:\ti-tools.
Run the cmd shell (Start->Run->cmd)
set DSPMAKE_Makefile=Makefile set DSPLINK=C:\dvevm_1_20\dsplink_1_30_08_02\packages\dsplink set PATH=C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Mingw\bin
and the configuration script
cd %DSPLINK%\etc\host\scripts\msdos dsplinkcfg.bat
and select exactly the same as in the linux configuration script.
Now you should be able to compile C files for the DSP using the Dsplink library
cd %DSPLINK%\dsp\src\samples gmake -s release
or even rebuild the DSP side of the Dsplink library
dspmake Davinci Release libs all
Run a sample
In order to run the sample application readwrite, you need
- to make sure the dsplink kernel module is installed (see $DSPLINK/doc/InstallGuide_Davinci.pdf on page 15f)
- the arm linux binary readwritegpp ($DSPLINKL/gpp/export/BIN/Linux/Davinci/RELEASE)
- the dsp binary readwrite.out (%DSPLINK%\dsp\export\BIN\DspBios\Davinci\RELEASE)
The example writes 1kB to a DSP memory address, the DSP multiplies each Byte with the test case number, the arm reads and checks the result. If anything goes wrong, it will print a message.
./readwritegpp readwrite.out 0x8FFF0000 1024 2