Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to setup a development environment

1,485 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)
</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'' ===
=== ''Framework Components'' ===
''Framework Components'' include some libraries like ''DMAN3'' and ''ACPY3'', allowing ''DMA'' copy. Download it from [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/FCfc/index.html here] and decompress it for example in $HOME/TI/framework_components_2_24_01 directory.  
=== ''Local Power Manager (LPM)'' ===
''LPM'' also belongs to the ''Linux Utilities'', but it seems that it is no longer included in the newest versions. So, you can download it from the older versions of ''linuxutils'', [http://software-dl.ti.com/dsps/dsps_registered_swdsps_public_sw/sdo_sb/targetcontent/linuxutilslpm/oldindex.html here].
''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''.
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. 
=== Libraries ===
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.myigep.com/trac/wiki/HowToCrossCompileTheLinuxKernel How To Cross Compile The Linux Kernel]
 
[http://wiki.myigep.com/trac/wiki/HowToUpgradeTheFactoryFirmware How To Upgrade The Factory Firmware]
[http://wiki.davincidsp.com/index.php/Building_DSPLink Building DSPLink]
[http://hilbert-space.de/?p=14 Compiling CMEM]
[[Category:How_toHow to forge|Development environment]][[Category:Development tools]][[Category:Tutorials]]
4,199
edits