Changes

How to setup a development environment

16,992 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, fill 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</pre> answer no This section describes how to obtain the question. Thus, "[http:/bin/sh" will point towards "www.pokylinux.org/bin''Poky''] distribution. This is the distribution shipped with the ''igep'' board; it is based on [http:/bash" (and not "/bin/dash")www. Then, some kernels settings have to be changedopenembedded. Edit the file "org/etcwiki/sysctl.conf" as Main_Page ''rootOpen Embedded'' and set :  <pre>vm].mmap_min_addr = 0</pre>then, to take the modification into account:<pre>sudo sysctl -p</pre>
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.  To compile kernel and modules: <pre>make ARCH=arm CROSS_COMPILE=arm-none-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 = There are several methods to do it. For developing purposes, the easiest way is to boot over network, which avoid flashing operations or coping on the memory card. Yet, these two solutions are essentials for applications where the board need to be independent from the host computer.  === Over network === 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'' 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]]. To change a variable, use the command ''setenv''. Thus, to change the project's name and use the one we have just made, set: <pre>setenv project poky-image-base</pre> Then, to boot: <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> 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 to boot with it. If memory card is not present, the board will ''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://labs.igep.es/index.php/The_bootloader_U-Boot here].  In order to save ''UBoot'' environment variables in the flash, do: <pre>saveenv</pre> which will avoid to reenter it every time...  Once ''&lt;serverip&gt;'', ''&lt;distro&gt;'', ''&lt;project&gt;'', and ''&lt;machine&gt;'' variables setup, ''UBoot'' will search on the server of address ''&lt;serverip&gt;'':  *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/igep0020bsudo 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.
Configure 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/</pre> or if it was made [[How to setup a development environment#Rootfs|with the ''rootfs'']] or [[How to setup a development environment#Kernel_compilation_under_bitbake|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 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- igep0020b_defconfigmodules_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)make ARCHor/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 ==arm CROSS_COMPILE=arm 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: <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 namemtd0: 00080000 00040000 "X-Loader"mtd1: 00180000 00040000 "U-Boot"mtd2: 00080000 00040000 "U-Boot Env"mtd3: 00300000 00040000 "Kernel"mtd4: 1fa80000 00040000 "File System"</pre> Thus, the size is 0x40000=256KB.  ==== 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.  Partitions can be seen with the following command: <pre>cat /proc/mtd</pre> On ''igep'', it returns: <pre>dev: size erasesize namemtd0: 00080000 00040000 "X-Loader"mtd1: 00180000 00040000 "U-Boot"mtd2: 00080000 00040000 "U-Boot Env"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/mtd3nandwrite -gnueabip /dev/mtd3 uImage</pre> same thing for the ''rootfs'' <pre>flash_eraseall /dev/mtd4nandwrite - menuconfigp /dev/mtd4 rootfs.jffs2</pre>The last line is only needed Note that if you want are using the ''rootfs'' built [[How to customize 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://labs.isee.biz/index.php/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_public_sw/sdo_sb/targetcontent/index.html this one].  === ''Code generation tools'' ===
To compile kernel and modules''TI CGT'' is the cross compiler for the ''DSP''. Download last version [https:<pre>make ARCH=arm CROSS_COMPILE=arm//www-poky-linux-gnueabi- uImage modules<a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm here] and install it (for example in $HOME/TI/pre>TI_CGT directory).
The resulting image is placed in "arch/arm/boot" directory.=== ''DSP BIOS'' ===
We will see in ''DSP BIOS'' is the section [[How_to_setup_a_development_environment#Boot_on_the_rootfs_and_the_kernel|Boot operating system running on the ''rootfsDSP'' and the kernel. Download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dspbios/index.html here]] how to use kernel and modulesinstall it (for example in $HOME/TI/BIOS directory).
= Boot on the == ''rootfsXDC Tools'' and the kernel ===
There are several methods to do Download itfrom [http://software-dl.ti. For developing purposes, the easiest way com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/ here] and install it (for example in $HOME/TI/xdctools directory). ''XDC Tools'' is to boot over network, which avoid flashing operations or coping on the memory card. Yet, these two solutions are essentials needed for applications where the board need to be independent from the host computer''DSP Link'' compilation.
=== Over network ''DSP Link'' ===
Two servers are needed. The ''NFS'' (DSPLink''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 (communication between ''115200n8ARM'') and stop ''UBootDSP'' by pressing a key. The environment variable of ''UBoot'' we need to change areDownload it from [http:*''serverip'': the server's ''IP'' address, need to be on the ''192//software-dl.168ti.254com/dsps/dsps_public_sw/DSPLink/index.x'' subred (except if you change the board address, which is not explained html here)]. By default, Uncompress it into 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_for_OMAP3530#Rootfs|previously]]$HOME/igep/dsplink directory.
To change a Then, add an environment variable, use ''DSPLINK'' with the path to the command directory of ''setenvDSPLINK''. ThusFor exemple, edd the following line to change the project's name and use the one we have just made, set.bashrc file:(remember to log out/log in after this)
<pre>
setenv project poky-image-baseexport DSPLINK=$HOME/igep/dsplink_linux_1_63/dsplink</pre>Then, go to boot$(DSPLINK)/config/bin directory and execute:
<pre>
run bootcmdperl dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=PONSLRMC</pre>which This will execute the contents of the configure ''bootcmdDSPLINK'' variable. The 'printenv'' command allow to show To understand each of the content of a variable; for exampleoption we passed, run:
<pre>
printenv bootcmdperl dsplinkcfg.pl</pre>returns and add options one by defaultone. If everything is alright, the following message will appear:
<pre>
run mmc-boot; run nfs-boot; run onenand-boot</pre>That is to say Please edit the board will first check if a memory card is present to boot with it. If memory card is not presentfollowing files for toolchains, kernel sources, the board will newt ''ping'' the server to boot over networketc changes. If server does not answer, the board will boot on the flashGPP side distribution file: $DSPLINK/make/Linux/omap3530_2. Take a look at ''mmc-boot'', ''nfs-boot'' and ''onenand-boot'' variables for more details6. In addition, the factory settings of ''UBoot'' are given [httpmkGPP side distribution file:$DSPLINK/gpp/src/wikiRules.myigep.commkDSP side distribution file: $DSPLINK/tracmake/wikiDspBios/HowToSetupUBootFactorySetting here]c64xxp_5.xx_linux.mk</pre> which are the files we need to edit and adapt to our configuration.
In order to save ''UBoot'' environment variables in For $DSPLINK/make/Linux/omap3530_2.6.mk file, change (and adapt if needed) the flash, dofollowing values:
<pre>
saveenv# ============================================================================<# Set the values of necessary variables to be used for the OS.# ============================================================================ # ----------------------------------------------------------------------------# Base directory for the GPP OS# ----------------------------------------------------------------------------BASE_BUILDOS :=${HOME}/igep/pre>linux-omap-2.6.28.10-igep0020b-2which will avoid to reenter it every time.# ----------------------------------------------------------------------------# 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 # ============================================================================# COMPILER# ============================================================================ # ----------------------------------------------------------------------------# Name of the compiler# ----------------------------------------------------------------------------COMPILER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gccLD := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-ld
Once ''<serverip>'', ''<distro>'', ''<project>'', and ''<machine>'' variables setup, ''UBoot'' will search on the server of address ''<serverip>''CROSS_COMPILE := arm-poky-linux-gnueabi-* a kernel image ''uImage'' in the directory "/srv/tftp/''<distro>''/''<project>''/''<machine>''" accessible by ''TFTP''.* a ''rootfs'' in the directory "/srv/nfs/''<distro>''/''<project>''/''<machine>''" accessible by ''NFS''.export CROSS_COMPILE
We assume now that ''<distro># =poky'', ''<project>===========================================================================# ARCHIVER2 - This denotes the archiver.# ============================================================================ARCHIVER := $(BASE_CGTOOLS)/arm-poky-imagelinux-gnueabi-base'' and ''<machine>=igep0020b''.ar
Thus# ============================================================================# LINKER - The compiler is used for linking purpose as well.# ============================================================================LINKER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gcc</pre> For $DSPLINK/gpp/src/Rules.mk file, create the following directories on the hostchange (and adapt if needed):
<pre>
sudo mkdir -p ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530")KERNEL_DIR &nbsp;:= ${HOME}/srvigep/nfs/poky/pokylinux-omap-image2.6.28.10-base/igep0020b-2sudo mkdir -p TOOL_PATH &nbsp;:= /srvusr/tftplocal/poky/poky-imageeabi-baseglibc/igep0020bbinendif #ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530")</pre>Next, copy the kernel. If it was made [[How_to_setup_a_development_environment#Kernel_compilation_outside_bitbake|outside ''bitbake'']]and also:
<pre>
sudo cp ifeq ("$HOME/igep(TI_DSPLINK_GPPOSPREFIX)", "uc")CG_PREFIX = arm-linux-uclibcgnueabi-MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-linux-omapuclibcgnueabi-2.6.28.10elseCG_PREFIX = arm-poky-linux-igep0020bgnueabi-2/archMAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm/boot/uImage /srv/tftp/poky/-poky-imagelinux-gnueabi-base/igep0020b/endif # ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc")</pre>or Finally, for $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk file, change (and adapt if it was made [[How_to_setup_a_development_environment_for_OMAP3530#Rootfs|with the ''rootfs'']] or [[Créer_un_environnement_de_développement_pour_l'OMAP3530#Compilation_du_noyau_sous_bitbake|with ''bitbake'']]needed):
<pre>
sudo cp # ----------------------------------------------------------------------------# Base directory for the DSP OS# ----------------------------------------------------------------------------BASE_INSTALL &nbsp;:= $(HOME)/igepTIBASE_SABIOS &nbsp;:= $(BASE_INSTALL)/pokybios_5_41_03_17BASE_BUILDOS &nbsp;:= $(BASE_SABIOS)/buildpackages/tmpti/bios # ----------------------------------------------------------------------------# Base directory for the XDC tools# -------------------------igep0020b---------------------------------------------------XDCTOOLS_DIR &nbsp;:= $(BASE_INSTALL)/deploy/images/uImage /srv/tftp/poky/pokyxdctools_3_15_00_50 # ----------------------------------------------------------------------------# Base for code generation tools - compiler, linker, archiver etc.# ---------------------------------------------------------------------------image-baseBASE_CGTOOLS &nbsp;:= $(BASE_INSTALL)/igep0020bTI_CGT_C6000_6.1.13BASE_CGTOOLSBIN&nbsp;:= $(BASE_CGTOOLS)/bin
</pre>
NextThen, install go to the ''rootfs'' in the good $DSPLINK/dsp/src directoryand execute:
<pre>
pushd /srv/nfs/poky/pokymake -image-base/igep0020bsudo cpio -idm< $HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.cpio popds</pre>If kernel was built [[How_to_setup_a_development_environment#Kernel_compilation_outside_bitbake|outside ''bitbake'']], install kernel modules do the same in the ''rootfs'' as follows$DSPLINK/gpp/src directory:
<pre>
cd make -s</pre> this will compile dsplinkk.ko module (it will be placed in the $HOMEDSPLINK/gpp/export/BIN/Linux/igepOMAP3530/linux-omap-2RELEASE directory).6 Attention: You may encounter compilations problems with SZ_2K symbol.28In this case modify all the files causing problem by replacing SZ_2K occurences by (2*SZ_1K).10-igep0020b-2source /usr/local/poky/eabi-glibc/environment-setup-arm-poky-linux-gnueabimake ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=Some examples programs are located in the $DSPLINK/srvdsp/nfssrc/pokysamples and $DSPLINK/poky-image-basegpp/igep0020b<src/pre>Finally, install the two servers on hostsamples directories. Compile it with:
<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 :<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/tftpmake
</pre>
The configuration file of === ''CMEM'' === '''NOTA:''' versions 2.25 and 2.25.01.06 have problems with ''NFSioctl'' server is "[http://e2e.ti.com/support/arm174_microprocessors/omap_applications_processors/f/42/p/etc36278/exports"126821.aspx#126821 see here], which affect cache manipulations (writeback and invalidate). Version 2.25.02.08 should solve these problems (not tested). Otherwise, you can use 2.24 versions. ''CMEM'', or ''contiguous memory manager'' allows to allocate shared memory between ''ARM'' and ''DSP''. Add It is part of the following line for each ''rootfslinuxutils'' , download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/linuxutils/index.html here] and decompress it. Go to linuxutils_2_25_02_08/packages/ti/sdo/linuxutils/cmem directory. Remove the write protection to Rules.make file:
<pre>
# Poky image rootfschmod +w Rules.make/srv/nfs/<distro>/<project>/<machine> <target_ippre>Then edit it and change (rw,no_root_squash,no_subtree_check,syncadapt it if needed)</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 ''*'' to allow a wider range of addresses. In our case, write :
<pre>
# For "kernel_org" buildsMVTOOL_PREFIX=/srvusr/nfslocal/poky/eabi-glibc/bin/arm-poky-imagelinux-basegnueabi- # Equivalent path for uClibc compiler toolsUCTOOL_PREFIX=/igep0020b 192usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi- # For OMAP3530 2.1686.254.25429 Linux kernelLINUXKERNEL_INSTALL_DIR=$(rw,no_root_squash,no_subtree_check,syncHOME)/igep/linux-omap-2.6.28.10-igep0020b-2</pre> Then execute<pre>make release</pre>to compile cmemk.ko module (it will be placed in ./src/module directory).  === ''Framework Components'' === ''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)'' ===
=== Copy kernel and ''rootfsLPM'' in also belongs to the ''flashLinux Utilities'' memory ===, but it seems that it is no longer included in the newest versions. So, you can download it from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm/index.html here].
Copy ''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 done either from executed several times, but if a new applications is run, the ''ubootDSP'' or will crash; that is why we need ''linuxLPM''.
First step is Go to create the ''jffs2'' file (if you do not have it), which will be used to copy local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm directory end edit the ''rootfs''. The following package needs Makefile to be installedchange:
<pre>
sudo aptLINUXKERNEL_INSTALL_DIR = $(HOME)/igep/linux-get install mtdomap-2.6.28.10-igep0020b-2MVTOOL_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 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>
Then use the commandplease add:<pre>mkfs#include <linux/slab.jffs2 -r <root file system> -e <erase block size> -o <output fileh>
</pre>
where to lpm_driver.c.  === Libraries === The interesting libraries are the followings:  *[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] Note that for ''dsplib v210'', the linux link seems to be broken. From Windows version, you will have to change C64x+DSPLIB/dsplib_v210/dsplib64plus.h files. Indeed, all relative paths are in Windows notation (eg "\"), which you will have to change to "/". <root file system!-- pour loop fft, changer le fichier sources pour mettre le chemin des fichiers c de dsplibchanger aussi le chemin des .h dans tskloop.c --> is the path  = Configure ''DSPLINK'' to compile projects = This part explains how to add libraries to ''DSPLINK'' environment. === ''Includes'' === Edit file $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk and add the ''includes'' directories:<pre># ----------------------------------------------------------------------------# Base directory to copy 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/packagesBASE_FCINC := $(ie BASE_INSTALL)/srvframework_components_2_24_01/nfspackagesBASE_FCTOOLINC := $(BASE_INSTALL)/pokyframework_components_2_24_01/poky-image-basefctools/packagesBASE_IMGLIBINC := $(BASE_INSTALL)/imglib_v201/includeBASE_IQMATHINC := $(BASE_INSTALL)/IQmath_v213/igep0020binclude 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), <erase block size/pre> The variables OSINC_GENERIC and OSINC_PLATFORM allow to setup the directories where ''DSPLINK'' will look for ''.h'' files.  === Libraries === By defualt, ''DSPLINK'' is searching the block size to erase libraries in KB and the directories: <pre>$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/<output file/pre> name of Thus, you have to copy the output file.Block size can be seen with libraries in the following commandright 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/cp $HOME/TI/framework_components_2_24_01/packages/ti/sdo/fc/acpy3/lib/release/acpy3.a64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/cp $HOME/TI/imglib_v201/lib/target/imglib2.l64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/cat cp $HOME/TI/imglib_v201/lib/target/imglib2.l64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/procRELEASE/mtd
</pre>
On ''igep'', it returns:
<pre>
dev: size erasesize name
mtd0: 00080000 00040000 "X-Loader"
mtd1: 00180000 00040000 "U-Boot"
mtd2: 00080000 00040000 "U-Boot Env"
mtd3: 00300000 00040000 "Kernel"
mtd4: 1fa80000 00040000 "File System"
</pre>
Thus, the size is 0x40000=265KB.
=Configure ''CodeBlocks'' for ''ARM'' ===Copy from  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:Settings.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: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</pre> Which should give the following result:  [[Image:Linker.jpg|center|500px]] -->Choose ''Toolchain executables'' tab and ''Compiler's installations directory'': <pre>/usr/local/poky/eabi-glibc/</pre> Then, enter the ''ubootProgram Files''====as follows:  [[Image:Executables.jpg|center|500px]]
= References =
====Copy from ''linux''====[http://www.pokylinux.org/doc/poky-handbook.html Poky Handbook]
To do this, you will have to boot the card from ''nfs'' or memory card; but not from flash[http://wiki.davincidsp.com/index.php/Building_DSPLink Building DSPLink]
Partitions can be seen with the following command:<pre>cat /proc/mtd</pre>On ''igep'', it returns:<pre>dev: size erasesize namemtd0: 00080000 00040000 "X-Loader"mtd1: 00180000 00040000 "U-Boot"mtd2: 00080000 00040000 "U-Boot Env"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/mtd3nandwrite -p /dev/mtd3 uImage</pre>same thing for the ''rootfs''<pre>flash_eraseall /dev/mtd4nandwrite -p /dev/mtd4 rootfs.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://wikihilbert-space.myigep.comde/trac/wiki/HowToUpgradeTheFactoryFirmware this?p=14 Compiling CMEM].
=== Copier le noyau et le ''rootfs'' dans la carte mémoire ===[[Category:How to forge|Development environment]][[Category:Development tools]][[Category:Tutorials]]
4,199
edits