Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to setup a development environment

1,448 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 environment#References|References]]). All files will be installed in the $HOME directory.  __TOC__ {{Message/Obsolete|Link=Visit the [[IGEP SDK Virtual Machine]] for updated information}}
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.
= ''Rootfs'' =
This section describes how to obtain the [http://www.pokylinux.org/ ''Poky''] distribution. This is the distribution shipped with the ''igep'' boadboard; it is based on [http://wikiwww.openembedded.netorg/index.phpwiki/Main_Page ''Open Embedded''].
The first thing to do is set ''Bash'' as default ''sh'' ''shell'':
We will see in section [[How 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 environment#Kernel_compilation|Kernel compilation]] to compile another version.
TODO: modify ''recipes'' to download another kernel version
= Cross toolchain for the ''ARM'' =
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-pokynone-linux-gnueabi</pre>  
= Kernel compilation =
Currently, 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].  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'' ===
</pre>
Configure the kernel:
<pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-pokynone-linux-gnueabimake ARCH=arm CROSS_COMPILE=arm-pokynone-linux-gnueabi- igep0020b_defconfigmake ARCH=arm CROSS_COMPILE=arm-pokynone-linux-gnueabi- menuconfig
</pre>
The last line is only needed if you want to customize the kernel.
To compile kernel and modules:
<pre>make ARCH=arm CROSS_COMPILE=arm-pokynone-linux-gnueabi- uImage modules
</pre>
The resulting image is placed in "arch/arm/boot" directory.<br>Note: If there is no uImage file present you may not have installed the uboot-mkimage package.<br>In ubuntu Hardy (8.04), this package is unknown. First upgrade to e.g. Lucid (10.04) then install the package.
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.
= Boot on the ''rootfs'' and the kernel =
Two servers are needed. The ''NFS'' (''Network File System'') server allows the target to accede its ''rootfs'' by the network. The ''TFTP'' (''Trivial File Transfer Protocol'') server allows the target to download the kernel over network. Thus, ''UBoot'' needs to be correctly setup to boot on the correct files. To do this, 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:
*''serverip'': the server's ''IP'' address, need to be on the ''192.168.254.x'' subred 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''.
<pre>run bootcmd
</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>
<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 to boot with it. If memory card is not present, the board will newt ''ping'' the server to boot over the network. If the server does not answer, the board will boot on the flash. <br>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://wikilabs.myigepigep.comes/tracindex.php/wiki/HowToSetupUBootFactorySetting The_bootloader_U-Boot here].
In order to save ''UBoot'' environment variables in the flash, do:
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 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/
/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
=== Copy kernel and ''rootfs'' in ''flash'' memory ===
Copy 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'' (for example when using it for [[How to setup a development environment#Over_network|''NFS'' boot]]), you will have to build the ''jffs2'' file from the ''rootfs'' directory.
==== Create the ''jffs2'' file ====
The following package needs to be installed to create the ''jffs2'' file:
mtd4: 1fa80000 00040000 "File System"
</pre>
Thus, the size is 0x40000=265KB256KB.
==== Copy from ''uboot'' ====
==== Copy from ''linux'' ====
To do this, you will have to boot the card from ''nfs'' or memory card; but not from flash.
<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'' =
Nota: some of the software of this section need an account on TI website. The main page for the downloads is [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/index.html this one].
=== ''Code generation tools'' ===
=== ''XDC Tools'' ===
Download it from [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/rtsc/index.html here] and install it (for example in $HOME/TI/xdctools directory). ''XDC Tools'' is needed for ''DSP Link'' compilation.
=== ''DSP Link'' ===
''DSPLink'' allows communication between ''ARM'' and ''DSP''. Download it from [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/link/link_1_60DSPLink/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)
make -s
</pre>
this will compile dsplinkk.ko module (it will be placed in the $DSPLINK/gpp/export/BIN/Linux/OMAP3530/RELEASE directory). 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).
Some examples programs are located in the $DSPLINK/dsp/src/samples and $DSPLINK/gpp/src/samples directories. Compile it with:
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.
<br> ''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&nbsp;file: <pre>chmod +w Rules.make
</pre>
Puis éditer ce fichier et changer Then edit it and change (adapter si besoinadapt it if needed)&nbsp;: <pre># For "kernel_org" builds
MVTOOL_PREFIX=/usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi-
LINUXKERNEL_INSTALL_DIR=$(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2
</pre>
Puis faire Then 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 include some libraries like ''DMAN3'' et and ''ACPY3'', permettant les copies par allowing ''DMA''copy. A télécharger Download it from [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/FCfc/index.html icihere] et à décompresser par exemple dans "and decompress it for example in $HOME/TI/framework_components_2_24_01"directory.  <br>
=== ''Local Power Manager (LPM)'' ===
''LPM'' fait aussi partie des also belongs to the ''Linux Utilities'', mais ne semble plus intégré dans les nouvelles but it seems that it is no longer included in the newest versions. Il se trouve avec les anciennes versions de ''linuxutils''So, you can download it from [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/linuxutilslpm/oldindex.html icihere].
''LPM'' permet de redémarrer le allows to reset the ''DSP'' à la volée. En effetIndeed, by default, par défaut ''DSPLink'' garde dans la mémoire keeps in the cache le programme exécuté par le memory the program executed by the ''DSP''. La même So, the same application peut donc être lancée plusieurs fois à la suitecan be executed several times, par contre si une nouvelle application est lancéebut if a new applications is run, il y aura plantage; dthe ''DSP'où l'intérêt de will crash; that is why we need ''LPM''.
Aller dans le répertoire Go to the local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm et éditer le directory end edit the Makefile pour changerto 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>
puis compiler the compile
<pre>make
</pre>
le module the lpm_omap3530.ko sera fait dans le répertoire courentmodule will be placed in the current directory.
Les exécutables The lpmON.x470uC et and lpmOFF.x470uC sont déjà compilés et se trouvent dans les répertoiresexecutables 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 castTI/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>please add:<pre>#include <linux/slab.h></pre>to lpm_driver.c. 
=== Librairies Libraries ===
Les principales librairies sont les suivantesThe interesting libraries are the followings:
*[http://focus.ti.com/docs/toolsw/folders/print/sprc265.html dsplib]
*[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_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/imglib_v201/lib/target/imglib2.l64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/
cp $HOME/TI/imglib_v201/lib/target/imglib2.l64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/
</pre>  
= Configure ''CodeBlocks'' for ''ARM'' =
[[Image:Compiler.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
[[Image:Linker.jpg|center|500px]]
-->
Choose ''Toolchain executables'' tab and ''Compiler's installations directory'':
<pre>/usr/local/poky/eabi-glibc/
Then, enter the ''Program Files'' as follows:
[[Image:Executables.jpg|center|500px]]
= References =
 
[http://wiki.myigep.com/trac/wiki/HowToGetThePokyLinuxDistribution How To Get The Poky Linux Distribution]
[http://www.pokylinux.org/doc/poky-handbook.html Poky Handbook]
[http://wiki.myigepdavincidsp.com/trac/wikiindex.php/HowToCrossCompileTheLinuxKernel How To Cross Compile The Linux KernelBuilding_DSPLink Building DSPLink]
[http://wikihilbert-space.myigep.com/trac/wikide/HowToUpgradeTheFactoryFirmware How To Upgrade The Factory Firmware?p=14 Compiling CMEM]
[http[Category://wiki.davincidsp.com/index.php/Building_DSPLink Building DSPLinkHow to forge|Development environment]][[Category:Development tools]][[Category:Tutorials]]
4,199
edits