Changes

How to setup a development environment

2,506 bytes added, 10:36, 31 December 2013
m
no edit summary
This tutorial was written for the [http://wwwlabs.igep-platformisee.combiz/index.php?option=com_content&view=article&id=46&Itemid=55 /IGEP_Technology_devices_revisions ''igep revB''] board, but it is transposable to other ''OMAP3530'' boards (above all for the ''DSP'' part). It is a summary (with some adaptations) of several tutorials found on Internet (see [[How_to_setup_a_development_environmentHow to setup a development environment#References|References]]). All files will be installed in the $HOME directory.
This tutorial is a translation of a French tutorial we wrote on our robotic [http://as.tech.free.fr/wiki/index.php?title=Cr%C3%A9er_un_environnement_de_d%C3%A9veloppement_pour_l%27OMAP3530 web site]. Sorry for the English, feel free to correct mistakes.__TOC__
{{Message/Obsolete|Link= ''Rootfs'' =Visit the [[IGEP SDK Virtual Machine]] for updated information}}
This section describes how to obtain the [http://www.pokylinux.org/ ''Poky''] distribution. This is the distribution shipped with the ''igep'' boad; it is based on [http://wiki.openembedded.net/index.php/Main_Page ''Open Embedded''].
The first thing to do is set = ''BashRootfs'' as default ''sh'' ''shell'': =
<pre>sudo dpkg-reconfigure dash<This section describes how to obtain the [http:/pre>/www.pokylinux.org/ ''Poky''] distribution. This is the distribution shipped with the ''igep'' board; it is based on [http://www.openembedded.org/wiki/Main_Page ''Open Embedded''].
The first thing to do is set ''Bash'' as default ''sh'' ''shell'': <pre>sudo dpkg-reconfigure dash</pre> answer no to the question. Thus, "/bin/sh" will point towards "/bin/bash" (and not "/bin/dash"). Then, some kernels settings have to be changed. Edit the file "/etc/sysctl.conf" as ''root'' and set &nbsp;:  <pre>vm.mmap_min_addr = 0</pre>then, to take the modification into account:<pre>sudo sysctl -p</pre> Some additional packages need to be installed to satisfy ''bitbake'' dependencies. First, add the following repositories to "/etc/apt/sources.list" &nbsp;:<pre>deb http://debian.o-hand.com etch/
deb http://debian.o-hand.com unstable/
deb http://debian.o-hand.com feisty/
deb http://debian.o-hand.com gutsy/
deb http://debian.o-hand.com hardy/
</pre>Update the data base and install the following packages:<pre>sudo apt-get update
sudo aptitude install python-psyco hgsvn qemu poky-depends poky-scripts
</pre><!--
a priori ceci est automatiquement installé :
sudo aptitude install subversion cvs git-core \
libncurses5-dev gawk python-dev python-psyco python-pysqlite2 \
scrollkeeper gnome-doc-utils gettext automake hgsvn qemu poky-depends poky-scripts
-->Then, download and decompress the last stable version of ''Poky'': <pre>mkdir -p $HOME/igep/poky
cd $HOME/igep/poky
wget http://pokylinux.org/releases/poky-purple-3.2.tar.bz2
tar -xjf poky-purple-3.2.tar.bz2
</pre> The configuration file of ''Poky'' is located in the directory $HOME/igep/poky/build/conf &nbsp;:<pre>cd build/conf
nano local.conf
</pre>And paste the modified version for the ''igep'' board:<pre># Where to cache the files Poky downloadsDL_DIR &nbsp;?= "${OEROOT}/sources"
BBFILES += "\
${OEROOT}/meta/packages/*/*.bb \
# For a quadcore, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would
# be appropriate.
# BB_NUMBER_THREADS = "24"
# Also, make can be passed flags so it run parallel threads e.g.:
# PARALLEL_MAKE = "-j 2"
# The machine to target
MACHINE &nbsp;?= "igep0020b"
TARGET_FPU_arm &nbsp;?= "hard"
# Other supported machines
#MACHINE &nbsp;?= "qemux86"#MACHINE &nbsp;?= "qemuarm"#MACHINE &nbsp;?= "c7x0"#MACHINE &nbsp;?= "akita"#MACHINE &nbsp;?= "spitz"#MACHINE &nbsp;?= "nokia770"#MACHINE &nbsp;?= "nokia800"#MACHINE &nbsp;?= "fic-gta01"#MACHINE &nbsp;?= "bootcdx86"#MACHINE &nbsp;?= "cm-x270"#MACHINE &nbsp;?= "em-x270"#MACHINE &nbsp;?= "htcuniversal"#MACHINE &nbsp;?= "mx31ads"#MACHINE &nbsp;?= "mx31litekit"#MACHINE &nbsp;?= "mx31phy"#MACHINE &nbsp;?= "netbook"#MACHINE &nbsp;?= "zylonite"
DISTRO &nbsp;?= "poky"
# For bleeding edge / experimental / unstable package versions
# DISTRO &nbsp;?= "poky-bleeding"
# Poky has various extra metadata collections (openmoko, extras).
# include 'package_deb' for debs
# include 'package_ipk' for ipks
#PACKAGE_CLASSES &nbsp;?= "package_deb package_ipk"PACKAGE_CLASSES &nbsp;?= "package_ipk"
# POKYMODE controls the characteristics of the generated packages/images by
#
# The default is "eabi"
# Use "oabi" for machines with kernels < &lt; 2.6.18 on ARM for example.
# Use "external-MODE" to use the precompiled external toolchains where MODE
# is the type of external toolchain to use e.g. eabi.
# Note that a full build of everything in OpenEmbedded will take GigaBytes of hard
# disk space, so make sure to free enough space. The default TMPDIR is
# <&lt;build directory>&gt;/tmp
TMPDIR = "${OEROOT}/build/tmp-${MACHINE}"
# Supported values are i586 and x86_64
SDKMACHINE="i586"
</pre> The following section needs to be adapted to the number of CPU the host machine has:<pre># Uncomment and set to allow bitbake to execute multiple tasks at once.
# For a quadcore, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would
# be appropriate.
# Also, make can be passed flags so it run parallel threads e.g.:
# PARALLEL_MAKE = "-j 2"
</pre> The build environment needs to be setup by the following command:<pre>cd ../..
source poky-init-build-env
</pre>A target can be built using:<pre>bitbake <&lt;target>&gt;</pre>there is a lot of targets, which can be an image (take a look at the "meta/packages/images/" directory) or more simply a ''recipe'' corresponding to a software. A detailed list of images can be found on the [http://www.pokylinux.org/doc/poky-handbook.html#ref-images Poky Handbook]. To build an image without ''X11'' server:<pre>bitbake poky-image-base</pre>This step is very long (several hours) and take a lot of space (like 16 gigas) on the host's hard disk. If you are behind a ''proxy'', take a look at this [http://www.pokylinux.org/doc/poky-handbook.html#id3403214 part] of ''Poky's'' FAQ.
This step is very long (several hours) and take a lot of space (like 16 gigas) on the host's hard disk. If you are behind a ''proxy'', take a look at this [http://www.pokylinux.org/doc/poky-handbook.html#id3403214 part] of ''Poky's'' FAQ. If everything compiles well, the resulting image (''rootfs'' and kernel) will be placed in the directory:<pre>tmp-igep0020b/deploy/images/</pre>and ''.ipk'' packages in:<pre>tmp-igep0020b/deploy/ipk/</pre> We will see in section [[How_to_setup_a_development_environmentHow to setup a development environment#Boot_on_the_rootfs_and_the_kernel|''Boot'' on ''rootfs'' and kernel]] how to use it. Yet, ''bitbake'' will download by default the kernel "linux-omap-2.6.28.10-igep0020b-0" which is not the last one provided by ''ISEE''. See section [[How_to_setup_a_development_environmentHow to setup a development environment#Kernel_compilation|Kernel compilation]] to compile another version.
TODO: modify ''recipes'' to download another kernel version
= Cross toolchain for the ''ARM''=
Aparently, there is a ''bug'' in one of ''Poky's'' ''recipes'', which implies that the cross toolchain doesn't include automatically the ''C++'' ''headers'', see [http://lists.o-hand.com/poky/1420.html this thread]. A ''patch'' has been proposed; to apply it &nbsp;:<pre>cd $HOME/igep/poky
wget http://lists.o-hand.com/poky/att-1420/fix-gxx-include-dir.patch
patch -p1 < &lt; fix-gxx-include-dir.patch</pre>The cross toolchain can be built using ''bitbake'': <pre>source poky-init-build-envbitbake meta-toolchain-sdk</pre> The result will be placed in the directory: <pre> tmp-igep0020b/deploy/sdk/</pre> as an archive to decompress in the directory "/usr/local/poky".
The In order to cross toolchain can be built using compile code for the ''bitbakeARM'', the following script needs to be run to set up paths:<pre>source /usr/local/poky/eabi-initglibc/environment-buildsetup-envbitbake metaarm-toolchainnone-sdk</pre>The result will be placed in the directory:<pre> tmplinux-igep0020b/deploy/sdk/gnueabi
</pre>
as an archive to decompress in the directory "/usr/local/poky".
In order to cross compile code for the ''ARM'', the following script needs to be run to set up paths:<pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-poky-linux-gnueabi</pre>= Kernel compilation =
= Kernel compilation =Another more recent source of information can be found at [http://labs.igep.es/index.php/The_Linux_kernel labs.igep.es/index.php/The_Linux_kernel].
Currently, In this example the last stable kernel provided by ''ISEE'' is version "linux-omap-2.6.28.10-igep0020b-2"is used. Check in the ''download'' section of [http://www.myigepigep.comes/index.php?option=com_weblinkscom_content&view=categoryarticle&id=5099&Itemid=85 112 www.myigepigep.comes] which is the last stable one. More recent versions (but unstable) can be downloaded on the [http://git.myigepigep.comes/gitweb ''git''] of ''ISEE''.
=== Kernel compilation under ''bitbake'' ===
=== Kernel compilation outside ''bitbake'' ===
First, download the kernel sources:<pre>cd $HOME/igep
wget http://downloads.myigep.com/sources/kernel/linux-omap-2.6.28.10-igep0020b-2.tar.gz
tar -xzf linux-omap-2.6.28.10-igep0020b-2.tar.gz
cd linux-omap-2.6.28.10-igep0020b-2
</pre>Configure the kernel: <pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabimake ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- igep0020b_defconfigmake ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig</pre> The last line is only needed if you want to customize the kernel.
Configure the To compile kerneland modules:<pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-poky-linux-gnueabimake ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- igep0020b_defconfigmake ARCH=arm CROSS_COMPILE=arm-pokynone-linux-gnueabi- menuconfiguImage modules</pre>The last line resulting image is placed in "arch/arm/boot" directory.<br>Note: If there is only needed if no uImage file present you want may not have installed the uboot-mkimage package.<br>In ubuntu Hardy (8.04), this package is unknown. First upgrade to customize e.g. Lucid (10.04) then install the kernelpackage.
To compile We will see in the section [[How to setup a development environment#Boot_on_the_rootfs_and_the_kernel|Boot on the ''rootfs'' and the kernel]] how to use kernel and modules:<pre>make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- uImage modules</pre>.
The resulting image is placed in "arch/arm/boot" directory.= Boot on the ''rootfs'' and the kernel =
We will see in There are several methods to do it. For developing purposes, the section [[How_to_setup_a_development_environment#Boot_on_the_rootfs_and_the_kernel|Boot easiest way is to boot over network, which avoid flashing operations or coping on the ''rootfs'' and memory card. Yet, these two solutions are essentials for applications where the kernel]] how board need to use kernel and modulesbe independent from the host computer.
= Boot on the ''rootfs'' and the kernel == Over network ===
There Two servers are several methods needed. The ''NFS'' (''Network File System'') server allows the target to do itaccede its ''rootfs'' by the network. For developing purposes, The ''TFTP'' (''Trivial File Transfer Protocol'') server allows the easiest way is target to boot download the kernel over network. Thus, which avoid flashing operations or coping ''UBoot'' needs to be correctly setup to boot on the memory cardcorrect files. YetTo do this, these two solutions are essentials for applications where plug a serial cable on the board (''115200n8'') and stop ''UBoot'' by pressing a key. The environment variable of ''UBoot'' we need to be independent from the host computer.change are:
=== Over network ===*''serverip'': the server's ''IP'' address, need to be on the ''192.168.254.x'' subnet (except if you change the board address, which is not explained here). By default, the server's ''IP'' address is ''192.168.254.10''. *''distro'': the distribution's name, by default ''poky''. *''machine'': the card's name, by default ''igep0020b''. *''project'': the project's name, that is to say the ''rootfs'' generated [[How to setup a development environment#Rootfs|previously]].
Two servers are needed. The To change a variable, use the command ''NFSsetenv'' (. Thus, to change the project''Network File System'') server allows s name and use the target one we have just made, set: <pre>setenv project poky-image-base</pre> Then, to accede its boot: <pre>run bootcmd</pre> which will execute the contents of the ''rootfsbootcmd'' by the networkvariable. The 'printenv'TFTP'' (''Trivial File Transfer Protocol'') server allows the target command allow to download show the kernel over network. Thus, content of a variable; for example:''UBoot'' needs <pre>printenv bootcmd</pre> returns by default: <pre>run mmc-boot; run nfs-boot; run onenand-boot</pre> That is to be correctly setup say the board will first check if a memory card is present to boot on the correct fileswith it. To do thisIf memory card is not present, plug a serial cable on the board (''115200n8'') and stop ''UBoot'' by pressing a key. The environment variable of ''UBoot'' we need to change are:*will ''serveripping'': the server's ''IP'' address, need to be on boot over the ''192.168network.254.x'' subred (except if you change If the board address, which is server does not explained here). By defaultanswer, the server's ''IP'' address is ''192board will boot on the flash.168.254.10<br>Take a look at ''.*'mmc-boot'distro'': the distribution's name, by default ''pokynfs-boot''.*and ''machine'': the card's name, by default ''igep0020bonenand-boot''variables for more details.*''project'': the project's nameIn addition, that is to say the factory settings of ''rootfsUBoot'' generated are given [[How_to_setup_a_development_environment_for_OMAP3530#Rootfs|previously]http://labs.igep.es/index.php/The_bootloader_U-Boot here].
To change a variable, use the command In order to save ''setenvUBoot''. Thus, to change environment variables in the project's name and use the one we have just made, set:<pre>setenv project poky-image-base</pre>Thenflash, to bootdo:<pre>run bootcmdsaveenv</pre>which will execute the contents of the ''bootcmd'' variable. The 'printenv'' command allow to show the content of a variable; for example:<pre>printenv bootcmd</pre>returns by default:<pre>run mmc-boot; run nfs-boot; run onenand-boot</pre>That is to say the board will first check if a memory card is present avoid to boot with reenter itevery time. If memory card is not present, the board will newt ''ping'' the server to boot over network. If server does not answer, the board will boot on the flash. Take a look at ''mmc-boot'', ''nfs-boot'' and ''onenand-boot'' variables for more details. In addition, the factory settings of ''UBoot'' are given [http://wiki.myigep.com/trac/wiki/HowToSetupUBootFactorySetting here].
In order to save Once ''&lt;serverip&gt;'', ''&lt;distro&gt;'', ''&lt;project&gt;'', and ''&lt;machine&gt;'' variables setup, ''UBoot'' environment variables in will search on the flash, doserver of address ''&lt;serverip&gt;'':<pre>saveenv</pre>which will avoid to reenter it every time...
Once ''<serverip>'', ''<distro>'', ''<project>'', and ''<machine>'' variables setup, ''UBoot'' will search on the server of address ''<serverip>'':* a kernel image ''uImage'' in the directory "/srv/tftp/''<&lt;distro>&gt;''/''<&lt;project>&gt;''/''<&lt;machine>&gt;''" accessible by ''TFTP''.* a ''rootfs'' in the directory "/srv/nfs/''<&lt;distro>&gt;''/''<&lt;project>&gt;''/''<&lt;machine>&gt;''" accessible by ''NFS''.
We assume now that ''<&lt;distro>&gt;=poky'', ''<&lt;project>&gt;=poky-image-base'' and ''<&lt;machine>&gt;=igep0020b''.
Thus, create the following directories on the host:<pre>sudo mkdir -p /srv/nfs/poky/poky-image-base/igep0020b
sudo mkdir -p /srv/tftp/poky/poky-image-base/igep0020b
</pre>Make sure the access rights of the directory is set correctly (use e.g. chmod 777 &lt;dir&gt;).<br>If not correct, uBoot will complain on the uBoot terminal when trying to load the kernel or on access of the rootfs.  Next, copy the kernel. If it was made [[How_to_setup_a_development_environmentHow to setup a development environment#Kernel_compilation_outside_bitbake|outside ''bitbake'']]:<pre>sudo cp $HOME/igep/linux-omap-2.6.28.10-igep0020b-2/arch/arm/boot/uImage /srv/tftp/poky/poky-image-base/igep0020b/</pre>or if it was made [[How_to_setup_a_development_environment_for_OMAP3530How to setup a development environment#Rootfs|with the ''rootfs'']] or [[Créer_un_environnement_de_développement_pour_l'OMAP3530How to setup a development environment#Compilation_du_noyau_sous_bitbakeKernel_compilation_under_bitbake|with under''bitbake'']]:<pre>sudo cp $HOME/igep/poky/build/tmp-igep0020b/deploy/images/uImage /srv/tftp/poky/poky-image-base/igep0020b/</pre>Next, install the ''rootfs'' in the good directory:<pre>pushd /srv/nfs/poky/poky-image-base/igep0020bsudo cpio -idm< &lt; $HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.cpio
popd
</pre>If kernel was built [[How_to_setup_a_development_environmentHow to setup a development environment#Kernel_compilation_outside_bitbake|outside ''bitbake'']], install kernel modules in the ''rootfs'' as follows:<pre>cd $HOME/igep/linux-omap-2.6.28.10-igep0020b-2
source /usr/local/poky/eabi-glibc/environment-setup-arm-poky-linux-gnueabi
make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=/srv/nfs/poky/poky-image-base/igep0020b
</pre>Finally, install the two servers on host:<pre>sudo apt-get install tftpd nfs-kernel-server</pre>By default, the ''TFTP'' server shares the "/srv/tftp" directory, which is the one we are using. If necessary, you can change this by editing the "/etc/inetd.conf" file &nbsp;:<pre>#:BOOT: TFTP service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers."
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
</pre>The configuration file of ''NFS'' server is "/etc/exports". Add the following line for each ''rootfs''&nbsp;: <pre># Poky image rootfs/srv/nfs/&lt;distro&gt;/&lt;project&gt;/&lt;machine&gt; &lt;target_ip&gt;(rw,no_root_squash,no_subtree_check,sync)</pre> where ''&lt;target_ip&gt;'' is the ''ip'' address of the target. By default, ''igep'' address is ''192.168.254.254''. It is also possible to put ''an asterisk (*)'' to allow a wider range of addresses. In our case, write&nbsp;: <pre>/srv/nfs/poky/poky-image-base/igep0020b 192.168.254.254(rw,no_root_squash,no_subtree_check,sync)or/srv/nfs/poky/poky-image-base/igep0020b *(rw,no_root_squash,no_subtree_check,sync)</pre> Remember execute the command:<br> <pre>$ exportfs -a </pre> Every time that you modify/update the file /etc/exports.<br>  Note: In the rootfs on the nfs-server I had to remove the line "auto eth0" from the file /etc/network/interfaces. If this line is present, the boot process stops with the error:<br>nfs: server 192.168.2.10 not responding, still trying
The configuration file of ''NFS'' server is "/etc/exports". Add the following line for each === Copy kernel and ''rootfs'' :<pre># Poky image rootfs/srv/nfs/<distro>/<project>/<machine> <target_ip>(rw,no_root_squash,no_subtree_check,sync)</pre>where ''<target_ip>'' is the ''ip'' address of the target. By default, ''igep'' address is ''192.168.254.254''. It is also possible to put in ''*flash'' to allow a wider range of addresses. In our case, write :<pre>/srv/nfs/poky/poky-image-base/igep0020b 192.168.254.254(rw,no_root_squash,no_subtree_check,sync)</pre>memory ===
=== Copy kernel and can be done either from ''uboot'' or ''linux''. To copy the ''rootfs'', a ''jffs2'' file is needed. If you do not need any modification to the one created [[How to setup a development environment#Rootfs|previously]], you can jump next step. If you have made changes to the ''rootfs'' in (for example when using it for [[How to setup a development environment#Over_network|''flashNFS'' boot]]), you will have to build the ''jffs2'' file from the ''rootfs'' memory ===directory.
Copy can be done either from ==== Create the ''ubootjffs2'' or ''linux''.file ====
First step is The following package needs to be installed to create the ''jffs2'' file (if you do not have it), which will be used to copy the ''rootfs''. The following package needs to be installed:<pre>sudo apt-get install mtd-utils</pre>Then use the command:<pre>mkfs.jffs2 -r <&lt;root file system> &gt; -e <&lt;erase block size> &gt; -o <&lt;output file> &gt; </pre>where <&lt;root file system> &gt; is the path to the directory to copy (ie /srv/nfs/poky/poky-image-base/igep0020b), <&lt;erase block size> &gt; is the block size to erase in KB and <&lt;output file> &gt; name of the output file.Block size can be seen with the following command:<pre>cat /proc/mtd</pre>On ''igep'', it returns:<pre>dev: size erasesize name
mtd0: 00080000 00040000 "X-Loader"
mtd1: 00180000 00040000 "U-Boot"
mtd3: 00300000 00040000 "Kernel"
mtd4: 1fa80000 00040000 "File System"
</pre>Thus, the size is 0x40000=265KB256KB.
====Copy from ''uboot'' ====
==== Copy from ''linux'' ====
====Copy To do this, you will have to boot the card from ''linuxnfs''====or memory card; but not from flash.
To do this, you will have to boot the card from ''nfs'' or memory card; but not from flash. Partitions can be seen with the following command:<pre>cat /proc/mtd</pre>On ''igep'', it returns:<pre>dev: size erasesize name
mtd0: 00080000 00040000 "X-Loader"
mtd1: 00180000 00040000 "U-Boot"
mtd3: 00300000 00040000 "Kernel"
mtd4: 1fa80000 00040000 "File System"
</pre>To copy the kernel, erase the corresponding memory area before doing the copy:<pre>flash_eraseall /dev/mtd3
nandwrite -p /dev/mtd3 uImage
</pre>same thing for the ''rootfs''<pre>flash_eraseall /dev/mtd4
nandwrite -p /dev/mtd4 rootfs.jffs2
</pre> Note that if you are using the ''rootfs'' built [[How to setup a development environment#Rootfs|previously]], the corresponding file should be located there: <pre>$HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.jffs2</pre>And now reboot. In case of errors (such as ''bad crc'' on the ''kernel'' for example), it is necessary to reflash all, see [http://wikilabs.myigepisee.combiz/trac/wikiindex.php/HowToUpgradeTheFactoryFirmware Update_the_PRE-INSTALLED_software_image_to_a_current_release this].
=== Copy kernel and ''rootfs'' in memory card ===
= Cross toolchain for the ''DSP'' =
= Chaine de développement croisée ''DSP'' = NoteNota: certains des outils de cette some of the software of this section nécessitent un compte sur le site de need an account on TI pour pouvoir les téléchargerwebsite. La The main page principale des téléchargements est for the downloads is [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/index.html celle-cithis one]. === ''Code generation tools'' ===
=== ''TI CGTCode generation tools'' est le cross compilateur pour le DSP. Récupérer la dernière version [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm ici] et installer (par exemple dans le répertoire $HOME/TI/TI_CGT). ===
=== ''TI CGT'' is the cross compiler for the ''DSP BIOS'' ===. Download last version [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm here] and install it (for example in $HOME/TI/TI_CGT directory).
=== ''DSP BIOS'' est le système d'exploitation résidant dans le ''DSP''. A télécharger [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dspbios/index.html ici] et installer (par exemple dans le répertoire $HOME/TI/BIOS). ===
=== ''XDC ToolsDSP BIOS'' ===is the operating system running on the ''DSP''. Download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dspbios/index.html here] and install it (for example in $HOME/TI/BIOS directory).
A télécharger [http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/rtsc/index.html ici] et installer (par exemple dans le répertoire === '$HOME/TI/xdctools).'XDC Tools'' ===
=== Download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/ here] and install it (for example in $HOME/TI/xdctools directory). ''XDC Tools'' is needed for ''DSP Link'' ===compilation.
''DSPLink'' permet la communication entre ''ARM'' et === ''DSPLink''. A télécharger [http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/link/link_1_60/index.html ici]. Décompresser le par exemple dans le répertoire $HOME/igep/dsplink. ===
Ajouter une variable d'environnement DSPLINK contenant le chemin du répertoire de 'DSPLink'DSPLINK' allows communication between ''ARM'' and ''DSP'', par exemple en ajoutant au .bashrc la ligne suivanteDownload it from [http: (penser à faire un log out/log in ensuite)/software-dl.ti.com/dsps/dsps_public_sw/DSPLink/index.html here]. Uncompress it into the $HOME/igep/dsplink directory.
Then, add an environment variable ''DSPLINK'' with the path to the directory of ''DSPLINK''. For exemple, edd the following line to .bashrc file: (remember to log out/log in after this)
<pre>
export DSPLINK=$HOME/igep/dsplink_linux_1_63/dsplink
</pre> aller dans le répertoire go to $(DSPLINK)/config/bin et lancer directory and execute
<pre>
perl dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=PONSLRMC
</pre>
pour configurer This will configure ''DSPLINK''. Pour comprendre ce que fait chacune de ces optionsTo understand each of the option we passed, lancer simplement run:
<pre>
perl dsplinkcfg.pl
</pre>et ajouter les and add options au fur et à mesureone by one. Si tout se passe bienIf everything is alright, le the following message suivant devrait apparaitre will appear
<pre>
Please edit the following files for toolchains, kernel sources, etc changes.
GPP side distribution file: $DSPLINK/gpp/src/Rules.mk
DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk
</pre>ce sont les fichiers à éditer pour adapter à notre which are the files we need to edit and adapt to our configuration.
Pour le fichier For $DSPLINK/make/Linux/omap3530_2.6.mkfile, changer change (et adapter si besoinand adapt if needed) les valeurs suivantesthe following values:
<pre>
# ============================================================================
# Base directory for the GPP OS
# ----------------------------------------------------------------------------
BASE_BUILDOS :=${HOME}/igep/linux-omap-2.6.28.10-igep0020b-2
# ----------------------------------------------------------------------------
# Base for toolchain
# ----------------------------------------------------------------------------
BASE_TOOLCHAIN := /usr/local/poky/eabi-glibc
# ----------------------------------------------------------------------------
# Base directory for include files provided by GPP OS
# ----------------------------------------------------------------------------
BASE_OSINC := $(BASE_BUILDOS)/include
OSINC_GENERIC := $(BASE_OSINC)OSINC_PLATFORM := $(BASE_TOOLCHAIN)/lib/gcc/arm-poky-linux-gnueabi/4.3.3/includeOSINC_TARGET := $(BASE_TOOLCHAIN)/arm-poky-linux-gnueabi/libc/usr/include
# ============================================================================
# Name of the compiler
# ----------------------------------------------------------------------------
COMPILER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gccLD := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-ld
CROSS_COMPILE := arm-poky-linux-gnueabi-
export CROSS_COMPILE
# ARCHIVER2 - This denotes the archiver.
# ============================================================================
ARCHIVER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-ar
# ============================================================================
# LINKER - The compiler is used for linking purpose as well.
# ============================================================================
LINKER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gcc</pre>Pour le fichier For $DSPLINK/gpp/src/Rules.mkfile, changer change (et adapter si besoinand adapt if needed) :
<pre>
ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530")
KERNEL_DIR &nbsp;:= ${HOME}/igep/linux-omap-2.6.28.10-igep0020b-2TOOL_PATH &nbsp;:= /usr/local/poky/eabi-glibc/bin
endif #ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530")
</pre>ainsi que and also:
<pre>
ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc")
MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-poky-linux-gnueabi-
endif # ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc")
</pre>Pour le fichier Finally, for $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mkfile, changer change (et adapter si besoinand adapt if needed) :
<pre>
# ----------------------------------------------------------------------------
# Base directory for the DSP OS
# ----------------------------------------------------------------------------
BASE_INSTALL &nbsp;:= $(HOME)/TIBASE_SABIOS &nbsp;:= $(BASE_INSTALL)/bios_5_41_03_17BASE_BUILDOS &nbsp;:= $(BASE_SABIOS)/packages/ti/bios
# ----------------------------------------------------------------------------
# Base directory for the XDC tools
# ----------------------------------------------------------------------------
XDCTOOLS_DIR &nbsp;:= $(BASE_INSTALL)/xdctools_3_15_00_50
# ----------------------------------------------------------------------------
# Base for code generation tools - compiler, linker, archiver etc.
# ----------------------------------------------------------------------------
BASE_CGTOOLS &nbsp;:= $(BASE_INSTALL)/TI_CGT_C6000_6.1.13BASE_CGTOOLSBIN &nbsp;:= $(BASE_CGTOOLS)/bin
</pre>
 Aller ensuite dans le répertoire Then, go to the $DSPLINK/dsp/src et faire directory and execute
<pre>
make -s
</pre> de même dans le répertoire do the same in $DSPLINK/gpp/src directory:
<pre>
make -s
</pre>ce qui aura pour effet de compiler le module this will compile dsplinkk.ko module (dans le répertoire it will be placed in the $DSPLINK/gpp/export/BIN/Linux/OMAP3530/RELEASEdirectory). Attention: You may encounter compilations problems with SZ_2K symbol. In this case modify all the files causing problem by replacing SZ_2K occurences by (2*SZ_1K).
Des programmes exemples se trouvent dans les répertoires Some examples programs are located in the $DSPLINK/dsp/src/samples et and $DSPLINK/gpp/src/samples, à compiler avec directories. Compile it with:
<pre>
make
</pre>
=== ''CMEM'' ===
'''NOTENOTA:''' les versions 2.25 et and 2.25.01.06 ont des soucis au niveau des have problems with ''ioctl'' [http://e2e.ti.com/support/arm174_microprocessors/omap_applications_processors/f/42/p/36278/126821.aspx#126821 voir icisee here], ce qui affecte notamment les which affect cache manipulations de cache (writeback et and invalidate). La version Version 2.25.02.08 est sensée corriger cela should solve these problems (à testernot tested). SinonOtherwise, travailler sur les versions you can use 2.24 versions.
 ''CMEM'', ou or ''contiguous memory manager'' permet d'allouer de la mémoire partagée entre allows to allocate shared memory between ''ARM'' et and ''DSP''. Il fait partie des It is part of the ''linuxutils'', à télécharger download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/linuxutils/index.html icihere]and decompress it. Aller dans le répertoire Go to linuxutils_2_25_02_08/packages/ti/sdo/linuxutils/cmem et donner l'accès en écriture au fichier directory. Remove the write protection to Rules.make file:
<pre>
chmod +w Rules.make
</pre>Puis éditer ce fichier et changer Then edit it and change (adapter si besoinadapt it if needed) :
<pre>
# For "kernel_org" builds
# For OMAP3530 2.6.29 Linux kernel
LINUXKERNEL_INSTALL_DIR=$(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2
</pre> Puis faireThen execute<pre>make release</pre>pour compiler le module to compile cmemk.ko module (dans le réperoire it will be placed in ./src/moduledirectory). === ''Framework Components'' === Les ''Framework Components'' incluent entre autres les librairies ''DMAN3'' et ''ACPY3'', permettant les copies par ''DMA''. A télécharger [http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/FC/index.html ici] et à décompresser par exemple dans "$HOME/TI/framework_components_2_24_01".
=== ''Framework Components'' ===
=== ''Local Power Manager (LPM)Framework Components'' ===include some libraries like ''DMAN3'' and ''ACPY3'', allowing ''DMA'' copy. Download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/fc/index.html here] and decompress it for example in $HOME/TI/framework_components_2_24_01 directory.
=== ''Local Power Manager (LPM)'' fait aussi partie des ''Linux Utilities'', mais ne semble plus intégré dans les nouvelles versions. Il se trouve avec les anciennes versions de ''linuxutils'', [http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/linuxutils/old.html ici]. ===
''LPM'' permet de redémarrer le also belongs to the ''DSPLinux Utilities'' à la volée, but it seems that it is no longer included in the newest versions. En effetSo, par défaut ''DSPLink'' garde dans la mémoire cache le programme exécuté par le ''DSP''you can download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm/index. La même application peut donc être lancée plusieurs fois à la suite, par contre si une nouvelle application est lancée, il y aura plantage; d'où l'intérêt de ''LPM''html here].
Aller dans le répertoire local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm et éditer le Makefile pour changer:''LPM'' allows to reset the ''DSP''. Indeed, by default, ''DSPLink'' keeps in the cache memory the program executed by the ''DSP''. So, the same application can be executed several times, but if a new applications is run, the ''DSP'' will crash; that is why we need ''LPM''.
Go to the local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm directory end edit the Makefile to change:
<pre>
LINUXKERNEL_INSTALL_DIR = $(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2
MVTOOL_PREFIX = /usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi-
DSPLINK_REPO = $(HOME)/igep/dsplink_linux_1_63
</pre>
the compile
<pre>make
</pre>
the lpm_omap3530.ko module will be placed in the current directory.
 
The lpmON.x470uC and lpmOFF.x470uC executables are already compiled and can be found in the following directories:
 
local_power_manager_1_24/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/
 
local_power_manager_1_24/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/release/
 
or in the following directories: (for the latest versions of LPM)
 
local_power_manager_1_24/packages/ti/bios/power/utils/bin/ti_platforms_evm3530/linux/debug/
 
local_power_manager_1_24/packages/ti/bios/power/utils/bin/ti_platforms_evm3530/linux/release/
 
Note: if you get compiler errors like:
<pre>TI/local_power_manager_linux_1_24_02_09/packages/ti/bios/power/modules/omap3530/lpm/lpm_driver.c: In function 'lpm_open':
TI/local_power_manager_linux_1_24_02_09/packages/ti/bios/power/modules/omap3530/lpm/lpm_driver.c:474: error: implicit declaration of function 'kmalloc'
TI/local_power_manager_linux_1_24_02_09/packages/ti/bios/power/modules/omap3530/lpm/lpm_driver.c:474: warning: assignment makes pointer from integer without a cast
TI/local_power_manager_linux_1_24_02_09/packages/ti/bios/power/modules/omap3530/lpm/lpm_driver.c:500: error: implicit declaration of function 'kfree'
</pre>
 puis compilerplease add:<pre>make#include <linux/slab.h>
</pre>
le module lpm_omap3530to lpm_driver.ko sera fait dans le répertoire courentcLes exécutables lpmON.x470uC et lpmOFF.x470uC sont déjà compilés et se trouvent dans les répertoires:
local_power_manager_1_24/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/
local_power_manager_1_24/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/release/=== Libraries ===
=== Librairies ===The interesting libraries are the followings:
Les principales librairies sont les suivantes:*[http://focus.ti.com/docs/toolsw/folders/print/sprc265.html dsplib]*[http://focus.ti.com/docs/toolsw/folders/print/sprc264.html dsp image lib]
*[http://focus.ti.com/docs/toolsw/folders/print/sprc542.html IQ Math]
A noter, pour les Note that for ''dsplib v210'', le lien Linux semble ne pas marcherthe linux link seems to be broken. A partir de la From Windows version Windows, il faut changer le fichier you will have to change C64x+DSPLIB/dsplib_v210/dsplib64plus.hfiles. Tous les chemins relatifs sont en Indeed, all relative paths are in Windows notation Windows (eg "\" qu'il faut remplacer par des ), which you will have to change to "/". 
<!-- pour loop fft, changer le fichier sources pour mettre le chemin des fichiers c de dsplib
changer aussi le chemin des .h dans tskloop.c -->
= Configurer Configure ''DSPLINK'' pour la compilation de projets to compile projects =
Cette partie explique comment rajouter les diverses librairies à l'environnement This part explains how to add libraries to ''DSPLINK'' environment.
=== ''Includes'' ===
Éditer le fichier Edit file $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk pour rajouter les répertoires and add the ''includes''directories: <pre># ----------------------------------------------------------------------------
# Base directory for include files
# ----------------------------------------------------------------------------
BASE_OSINC &nbsp;:= $(BASE_BUILDOS)/includeBASE_CGTOOLSINC &nbsp;:= $(BASE_CGTOOLS)/includeBASE_RTDXINC &nbsp;:= $(BASE_RTDX)/include/c6000BASE_PSLINC &nbsp;:= $(BASE_PSL)/includeBASE_CSLINC &nbsp;:=
BASE_XDCINC := $(BASE_INSTALL)/xdctools_3_15_00_50/packages
BASE_FCINC := $(BASE_INSTALL)/framework_components_2_24_01/packages
BASE_IQMATHINC := $(BASE_INSTALL)/IQmath_v213/include
OSINC_GENERIC &nbsp;:= $(BASE_OSINC)OSINC_PLATFORM &nbsp;:= $(BASE_CGTOOLSINC) $(BASE_RTDXINC) \
$(BASE_PSLINC) $(BASE_CSLINC) $(BASE_XDCINC) $(BASE_FCINC) $(BASE_FCTOOLINC) $(BASE_IMGLIBINC) $(BASE_IQMATHINC)
</pre>Les The variables OSINC_GENERIC et and OSINC_PLATFORM permettent de définir les répertoires où allow to setup the directories where ''DSPLINK'' cherchera les will look for ''.h''files.
=== Librairies Libraries ===
Par défautBy defualt, ''DSPLINK'' cherche les librairies dans les répertoiresis searching the libraries in the directories:<pre>$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/
$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/
</pre>Il faut donc y copier les différentes librairesThus, you have to copy the libraries in the right place:<pre>cp $HOME/TI/framework_components_2_24_01/packages/ti/sdo/fc/dman3/lib/debug/dman3.a64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/
cp $HOME/TI/framework_components_2_24_01/packages/ti/sdo/fc/dman3/lib/release/dman3.a64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/
cp $HOME/TI/framework_components_2_24_01/packages/ti/sdo/fc/acpy3/lib/debug/acpy3.a64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/
</pre>
= Configure ''CodeBlocks'' for ''ARM''=
This part explains how to setup ''CodeBlocks'' to develop programs using ''dsplink'' library.
Go to ''settings/compiler and debugger'' menu, choose ''GNU ARM GCC compiler'' as compiler. You should see the following window:
[[Image:settingsSettings.jpg|center|500px]]
Select ''Search directories'' tab and ''Compiler''. Then add the following directories (and adapt it if necessary):<pre>/usr/local/poky/eabi-glibc/arm-none-linux-gnueabi/lib
$(HOME)/igep/dsplink_linux_1_63/dsplink/gpp/inc/sys/Linux
$(HOME)/igep/dsplink_linux_1_63/dsplink/gpp/export/INCLUDE/Linux/OMAP3530/usr
</pre>Which should give the following result:
[[Image:compilerCompiler.jpg|center|500px]]<!--In ''Search directories'', now choose ''Linker'' and add the following directories: <pre>$(HOME)/dsplink_linux_1_63/dsplink/gpp/inc/sys/Linux</pre> Which should give the following result:
In [[Image:Linker.jpg|center|500px]] -->Choose ''Search directoriesToolchain executables'', now choose tab and ''Compiler'Linkers installations directory'' and add the following directories:<pre>$(HOME)/dsplink_linux_1_63usr/dsplinklocal/gpppoky/inceabi-glibc/sys/Linux</pre>Which should give Then, enter the following result''Program Files'' as follows:
[[Image:linkerExecutables.jpg|center|500px]]
Choose ''Toolchain executables'' tab and ''Compiler's installations directory'':<pre>/usr/local/poky/eabi-glibc/</pre>Then, enter the ''Program Files'' as follows:= References =
[[Imagehttp:executables//www.jpg|center|500px]pokylinux.org/doc/poky-handbook.html Poky Handbook]
= References=[http://wiki.myigepdavincidsp.com/trac/wiki/HowToGetThePokyLinuxDistribution How To Get The Poky Linux Distribution] [http://wwwindex.pokylinux.orgphp/doc/poky-handbook.html Poky HandbookBuilding_DSPLink Building DSPLink]
[http://wikihilbert-space.myigep.com/trac/wikide/HowToCrossCompileTheLinuxKernel How To Cross Compile The Linux Kernel?p=14 Compiling CMEM]
[http[Category://wiki.myigep.com/trac/wiki/HowToUpgradeTheFactoryFirmware How To Upgrade The Factory Firmwareto forge|Development environment]][[Category:Development tools]][http[Category://wiki.davincidsp.com/index.php/Building_DSPLink Building DSPLinkTutorials]]
4,199
edits