Difference between revisions of "How to setup a development environment"
From IGEP - ISEE Wiki
m (→Copy kernel and rootfs in flash memory) |
m |
||
(48 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
− | This tutorial was written for the [http:// | + | This tutorial was written for the [http://labs.isee.biz/index.php/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}} |
− | |||
− | + | = ''Rootfs'' = | |
− | + | This section describes how to obtain the [http://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'']. | |
− | |||
− | |||
− | 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 : | + | The first thing to do is set ''Bash'' as default ''sh'' ''shell'': |
− | + | <pre>sudo dpkg-reconfigure dash | |
− | <pre> | + | </pre> |
− | vm.mmap_min_addr = 0 | + | 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 : |
− | </pre> | + | <pre>vm.mmap_min_addr = 0 |
− | then, to take the modification into account: | + | </pre> |
− | <pre> | + | then, to take the modification into account: |
− | sudo sysctl -p | + | <pre>sudo sysctl -p |
− | </pre> | + | </pre> |
− | + | Some additional packages need to be installed to satisfy ''bitbake'' dependencies. First, add the following repositories to "/etc/apt/sources.list" : | |
− | Some additional packages need to be installed to satisfy ''bitbake'' dependencies. First, add the following repositories to "/etc/apt/sources.list" : | + | <pre>deb http://debian.o-hand.com etch/ |
− | <pre> | ||
− | deb http://debian.o-hand.com etch/ | ||
deb http://debian.o-hand.com unstable/ | deb http://debian.o-hand.com unstable/ | ||
deb http://debian.o-hand.com feisty/ | deb http://debian.o-hand.com feisty/ | ||
deb http://debian.o-hand.com gutsy/ | deb http://debian.o-hand.com gutsy/ | ||
deb http://debian.o-hand.com hardy/ | deb http://debian.o-hand.com hardy/ | ||
− | </pre> | + | </pre> |
− | Update the data base and install the following packages: | + | Update the data base and install the following packages: |
− | <pre> | + | <pre>sudo apt-get update |
− | sudo apt-get update | ||
sudo aptitude install python-psyco hgsvn qemu poky-depends poky-scripts | sudo aptitude install python-psyco hgsvn qemu poky-depends poky-scripts | ||
− | </pre> | + | </pre> <!-- |
− | <!-- | ||
a priori ceci est automatiquement installé : | a priori ceci est automatiquement installé : | ||
sudo aptitude install subversion cvs git-core \ | sudo aptitude install subversion cvs git-core \ | ||
Line 42: | Line 35: | ||
libncurses5-dev gawk python-dev python-psyco python-pysqlite2 \ | libncurses5-dev gawk python-dev python-psyco python-pysqlite2 \ | ||
scrollkeeper gnome-doc-utils gettext automake hgsvn qemu poky-depends poky-scripts | scrollkeeper gnome-doc-utils gettext automake hgsvn qemu poky-depends poky-scripts | ||
− | --> | + | --> |
− | Then, download and decompress the last stable version of ''Poky'': | + | Then, download and decompress the last stable version of ''Poky'': |
− | + | <pre>mkdir -p $HOME/igep/poky | |
− | <pre> | ||
− | mkdir -p $HOME/igep/poky | ||
cd $HOME/igep/poky | cd $HOME/igep/poky | ||
wget http://pokylinux.org/releases/poky-purple-3.2.tar.bz2 | wget http://pokylinux.org/releases/poky-purple-3.2.tar.bz2 | ||
tar -xjf poky-purple-3.2.tar.bz2 | tar -xjf poky-purple-3.2.tar.bz2 | ||
− | </pre> | + | </pre> |
− | + | The configuration file of ''Poky'' is located in the directory $HOME/igep/poky/build/conf : | |
− | The configuration file of ''Poky'' is located in the directory $HOME/igep/poky/build/conf : | + | <pre>cd build/conf |
− | <pre> | ||
− | cd build/conf | ||
nano local.conf | nano local.conf | ||
− | </pre> | + | </pre> |
− | And paste the modified version for the ''igep'' board: | + | And paste the modified version for the ''igep'' board: |
− | <pre> | + | <pre># Where to cache the files Poky downloads |
− | # Where to cache the files Poky downloads | + | DL_DIR ?= "${OEROOT}/sources" |
− | DL_DIR ?= "${OEROOT}/sources" | ||
BBFILES += "\ | BBFILES += "\ | ||
${OEROOT}/meta/packages/*/*.bb \ | ${OEROOT}/meta/packages/*/*.bb \ | ||
Line 75: | Line 63: | ||
# For a quadcore, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would | # For a quadcore, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would | ||
# be appropriate. | # be appropriate. | ||
− | + | BB_NUMBER_THREADS = "4" | |
# Also, make can be passed flags so it run parallel threads e.g.: | # Also, make can be passed flags so it run parallel threads e.g.: | ||
# PARALLEL_MAKE = "-j 2" | # PARALLEL_MAKE = "-j 2" | ||
# The machine to target | # The machine to target | ||
− | MACHINE ?= "igep0020b" | + | MACHINE ?= "igep0020b" |
− | TARGET_FPU_arm ?= "hard" | + | TARGET_FPU_arm ?= "hard" |
# Other supported machines | # Other supported machines | ||
− | #MACHINE ?= "qemux86" | + | #MACHINE ?= "qemux86" |
− | #MACHINE ?= "qemuarm" | + | #MACHINE ?= "qemuarm" |
− | #MACHINE ?= "c7x0" | + | #MACHINE ?= "c7x0" |
− | #MACHINE ?= "akita" | + | #MACHINE ?= "akita" |
− | #MACHINE ?= "spitz" | + | #MACHINE ?= "spitz" |
− | #MACHINE ?= "nokia770" | + | #MACHINE ?= "nokia770" |
− | #MACHINE ?= "nokia800" | + | #MACHINE ?= "nokia800" |
− | #MACHINE ?= "fic-gta01" | + | #MACHINE ?= "fic-gta01" |
− | #MACHINE ?= "bootcdx86" | + | #MACHINE ?= "bootcdx86" |
− | #MACHINE ?= "cm-x270" | + | #MACHINE ?= "cm-x270" |
− | #MACHINE ?= "em-x270" | + | #MACHINE ?= "em-x270" |
− | #MACHINE ?= "htcuniversal" | + | #MACHINE ?= "htcuniversal" |
− | #MACHINE ?= "mx31ads" | + | #MACHINE ?= "mx31ads" |
− | #MACHINE ?= "mx31litekit" | + | #MACHINE ?= "mx31litekit" |
− | #MACHINE ?= "mx31phy" | + | #MACHINE ?= "mx31phy" |
− | #MACHINE ?= "netbook" | + | #MACHINE ?= "netbook" |
− | #MACHINE ?= "zylonite" | + | #MACHINE ?= "zylonite" |
− | DISTRO ?= "poky" | + | DISTRO ?= "poky" |
# For bleeding edge / experimental / unstable package versions | # For bleeding edge / experimental / unstable package versions | ||
− | # DISTRO ?= "poky-bleeding" | + | # DISTRO ?= "poky-bleeding" |
# Poky has various extra metadata collections (openmoko, extras). | # Poky has various extra metadata collections (openmoko, extras). | ||
Line 155: | Line 143: | ||
# include 'package_deb' for debs | # include 'package_deb' for debs | ||
# include 'package_ipk' for ipks | # include 'package_ipk' for ipks | ||
− | #PACKAGE_CLASSES ?= "package_deb package_ipk" | + | #PACKAGE_CLASSES ?= "package_deb package_ipk" |
− | PACKAGE_CLASSES ?= "package_ipk" | + | PACKAGE_CLASSES ?= "package_ipk" |
# POKYMODE controls the characteristics of the generated packages/images by | # POKYMODE controls the characteristics of the generated packages/images by | ||
Line 165: | Line 153: | ||
# | # | ||
# The default is "eabi" | # The default is "eabi" | ||
− | # Use "oabi" for machines with kernels | + | # Use "oabi" for machines with kernels < 2.6.18 on ARM for example. |
# Use "external-MODE" to use the precompiled external toolchains where MODE | # Use "external-MODE" to use the precompiled external toolchains where MODE | ||
# is the type of external toolchain to use e.g. eabi. | # is the type of external toolchain to use e.g. eabi. | ||
Line 173: | Line 161: | ||
# Note that a full build of everything in OpenEmbedded will take GigaBytes of hard | # 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 | # disk space, so make sure to free enough space. The default TMPDIR is | ||
− | # | + | # <build directory>/tmp |
TMPDIR = "${OEROOT}/build/tmp-${MACHINE}" | TMPDIR = "${OEROOT}/build/tmp-${MACHINE}" | ||
Line 221: | Line 209: | ||
# Supported values are i586 and x86_64 | # Supported values are i586 and x86_64 | ||
SDKMACHINE="i586" | SDKMACHINE="i586" | ||
− | </pre> | + | </pre> |
− | + | The following section needs to be adapted to the number of CPU the host machine has: | |
− | 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. |
− | <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 | # For a quadcore, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would | ||
# be appropriate. | # be appropriate. | ||
Line 231: | Line 217: | ||
# Also, make can be passed flags so it run parallel threads e.g.: | # Also, make can be passed flags so it run parallel threads e.g.: | ||
# PARALLEL_MAKE = "-j 2" | # PARALLEL_MAKE = "-j 2" | ||
− | </pre> | + | </pre> |
− | + | The build environment needs to be setup by the following command: | |
− | The build environment needs to be setup by the following command: | + | <pre>cd ../.. |
− | <pre> | ||
− | cd ../.. | ||
source poky-init-build-env | source poky-init-build-env | ||
− | </pre> | + | </pre> |
− | A target can be built using: | + | A target can be built using: |
− | <pre> | + | <pre>bitbake <target> |
− | bitbake | + | </pre> |
− | </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: |
− | 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> | + | </pre> |
− | bitbake poky-image-base | + | 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. |
− | </pre> | ||
− | + | If everything compiles well, the resulting image (''rootfs'' and kernel) will be placed in the directory: | |
− | + | <pre>tmp-igep0020b/deploy/images/ | |
− | If everything compiles well, the resulting image (''rootfs'' and kernel) will be placed in the directory: | + | </pre> |
− | <pre> | + | and ''.ipk'' packages in: |
− | tmp-igep0020b/deploy/images/ | + | <pre>tmp-igep0020b/deploy/ipk/ |
− | </pre> | + | </pre> |
− | and ''.ipk'' packages in: | + | 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. |
− | <pre> | ||
− | tmp-igep0020b/deploy/ipk/ | ||
− | </pre> | ||
− | |||
− | We will see in section [[ | ||
TODO: modify ''recipes'' to download another kernel version | TODO: modify ''recipes'' to download another kernel version | ||
− | = Cross toolchain for the ''ARM''= | + | = 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 : | + | 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 : |
− | <pre> | + | <pre>cd $HOME/igep/poky |
− | cd $HOME/igep/poky | ||
wget http://lists.o-hand.com/poky/att-1420/fix-gxx-include-dir.patch | wget http://lists.o-hand.com/poky/att-1420/fix-gxx-include-dir.patch | ||
− | patch -p1 | + | patch -p1 < fix-gxx-include-dir.patch |
− | </pre> | + | </pre> |
+ | The cross toolchain can be built using ''bitbake'': | ||
+ | <pre>source poky-init-build-env | ||
+ | bitbake 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". | ||
− | + | In order to cross compile code for the ''ARM'', the following script needs to be run to set up paths: | |
− | <pre> | + | <pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi |
− | source poky- | ||
− | |||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | |||
− | + | = 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]. | |
− | + | In this example the kernel version "linux-omap-2.6.28.10-igep0020b-2" is used. Check in the ''download'' section of [http://www.igep.es/index.php?option=com_content&view=article&id=99&Itemid=112 www.igep.es] which is the last stable one. More recent versions (but unstable) can be downloaded on the [http://git.igep.es/ ''git''] of ''ISEE''. | |
− | === Kernel compilation under ''bitbake'' === | + | === Kernel compilation under ''bitbake'' === |
− | === Kernel compilation outside ''bitbake'' === | + | === Kernel compilation outside ''bitbake'' === |
− | First, download the kernel sources: | + | First, download the kernel sources: |
− | <pre> | + | <pre>cd $HOME/igep |
− | cd $HOME/igep | ||
wget http://downloads.myigep.com/sources/kernel/linux-omap-2.6.28.10-igep0020b-2.tar.gz | 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 | tar -xzf linux-omap-2.6.28.10-igep0020b-2.tar.gz | ||
cd linux-omap-2.6.28.10-igep0020b-2 | cd linux-omap-2.6.28.10-igep0020b-2 | ||
− | </pre> | + | </pre> |
+ | Configure the kernel: | ||
+ | <pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi | ||
+ | make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- igep0020b_defconfig | ||
+ | make 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> | + | <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. | |
− | make ARCH=arm CROSS_COMPILE=arm- | ||
− | </pre> | ||
− | The | ||
− | + | 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... | |
− | |||
− | <pre> | ||
− | |||
− | </pre> | ||
− | which will | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | 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/''<distro>''/''<project>''/''<machine>''" accessible by ''TFTP''. | |
− | * a kernel image ''uImage'' in the directory "/srv/tftp/'' | + | *a ''rootfs'' in the directory "/srv/nfs/''<distro>''/''<project>''/''<machine>''" accessible by ''NFS''. |
− | * a ''rootfs'' in the directory "/srv/nfs/'' | ||
− | We assume now that '' | + | We assume now that ''<distro>=poky'', ''<project>=poky-image-base'' and ''<machine>=igep0020b''. |
− | Thus, create the following directories on the host: | + | Thus, create the following directories on the host: |
− | <pre> | + | <pre>sudo mkdir -p /srv/nfs/poky/poky-image-base/igep0020b |
− | sudo mkdir -p /srv/nfs/poky/poky-image-base/igep0020b | ||
sudo mkdir -p /srv/tftp/poky/poky-image-base/igep0020b | sudo mkdir -p /srv/tftp/poky/poky-image-base/igep0020b | ||
− | </pre> | + | </pre> |
− | Next, copy the kernel. If it was made [[ | + | Make sure the access rights of the directory is set correctly (use e.g. chmod 777 <dir>).<br>If not correct, uBoot will complain on the uBoot terminal when trying to load the kernel or on access of the rootfs. |
− | <pre> | + | |
− | sudo cp $HOME/igep/linux-omap-2.6.28.10-igep0020b-2/arch/arm/boot/uImage /srv/tftp/poky/poky-image-base/igep0020b/ | + | Next, copy the kernel. If it was made [[How to setup a development environment#Kernel_compilation_outside_bitbake|outside ''bitbake'']]: |
− | </pre> | + | <pre>sudo cp $HOME/igep/linux-omap-2.6.28.10-igep0020b-2/arch/arm/boot/uImage /srv/tftp/poky/poky-image-base/igep0020b/ |
− | or if it was made [[ | + | </pre> |
− | <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'']]: |
− | sudo cp $HOME/igep/poky/build/tmp-igep0020b/deploy/images/uImage /srv/tftp/poky/poky-image-base/igep0020b/ | + | <pre>sudo cp $HOME/igep/poky/build/tmp-igep0020b/deploy/images/uImage /srv/tftp/poky/poky-image-base/igep0020b/ |
− | </pre> | + | </pre> |
− | Next, install the ''rootfs'' in the good directory: | + | Next, install the ''rootfs'' in the good directory: |
− | <pre> | + | <pre>pushd /srv/nfs/poky/poky-image-base/igep0020b |
− | pushd /srv/nfs/poky/poky-image-base/igep0020b | + | sudo cpio -idm< $HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.cpio |
− | sudo cpio -idm | ||
popd | popd | ||
− | </pre> | + | </pre> |
− | If kernel was built [[ | + | 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> | + | <pre>cd $HOME/igep/linux-omap-2.6.28.10-igep0020b-2 |
− | cd $HOME/igep/linux-omap-2.6.28.10-igep0020b-2 | ||
source /usr/local/poky/eabi-glibc/environment-setup-arm-poky-linux-gnueabi | 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 | make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=/srv/nfs/poky/poky-image-base/igep0020b | ||
− | </pre> | + | </pre> |
− | Finally, install the two servers on host: | + | Finally, install the two servers on host: |
− | <pre> | + | <pre>sudo apt-get install tftpd nfs-kernel-server |
− | sudo apt-get install tftpd nfs-kernel-server | + | </pre> |
− | </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 : |
− | 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 |
− | <pre> | ||
− | #:BOOT: TFTP service is provided primarily for booting. Most sites | ||
# run this only on machines acting as "boot servers." | # run this only on machines acting as "boot servers." | ||
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp | tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp | ||
− | </pre> | + | </pre> |
+ | The configuration file of ''NFS'' server is "/etc/exports". Add the following line for each ''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 ''an asterisk (*)'' 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) | ||
+ | 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 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 [[ | + | 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==== | + | ==== Create the ''jffs2'' file ==== |
− | The following package needs to be installed to create the ''jffs2'' file: | + | The following package needs to be installed to create the ''jffs2'' file: |
− | <pre> | + | <pre>sudo apt-get install mtd-utils |
− | sudo apt-get install mtd-utils | + | </pre> |
− | </pre> | + | Then use the command: |
− | Then use the command: | + | <pre>mkfs.jffs2 -r <root file system> -e <erase block size> -o <output file> |
− | <pre> | + | </pre> |
− | mkfs.jffs2 -r | + | where <root file system> is the path to the directory to copy (ie /srv/nfs/poky/poky-image-base/igep0020b), <erase block size> is the block size to erase in KB and <output file> name of the output file. Block size can be seen with the following command: |
− | </pre> | + | <pre>cat /proc/mtd |
− | where | + | </pre> |
− | Block size can be seen with the following command: | + | On ''igep'', it returns: |
− | <pre> | + | <pre>dev: size erasesize name |
− | cat /proc/mtd | ||
− | </pre> | ||
− | On ''igep'', it returns: | ||
− | <pre> | ||
− | dev: size erasesize name | ||
mtd0: 00080000 00040000 "X-Loader" | mtd0: 00080000 00040000 "X-Loader" | ||
mtd1: 00180000 00040000 "U-Boot" | mtd1: 00180000 00040000 "U-Boot" | ||
Line 435: | Line 397: | ||
mtd3: 00300000 00040000 "Kernel" | mtd3: 00300000 00040000 "Kernel" | ||
mtd4: 1fa80000 00040000 "File System" | mtd4: 1fa80000 00040000 "File System" | ||
− | </pre> | + | </pre> |
− | Thus, the size is 0x40000= | + | Thus, the size is 0x40000=256KB. |
− | ====Copy from ''uboot''==== | + | ==== 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 | |
− | Partitions can be seen with the following command: | + | </pre> |
− | <pre> | + | On ''igep'', it returns: |
− | cat /proc/mtd | + | <pre>dev: size erasesize name |
− | </pre> | ||
− | On ''igep'', it returns: | ||
− | <pre> | ||
− | dev: size erasesize name | ||
mtd0: 00080000 00040000 "X-Loader" | mtd0: 00080000 00040000 "X-Loader" | ||
mtd1: 00180000 00040000 "U-Boot" | mtd1: 00180000 00040000 "U-Boot" | ||
Line 457: | Line 416: | ||
mtd3: 00300000 00040000 "Kernel" | mtd3: 00300000 00040000 "Kernel" | ||
mtd4: 1fa80000 00040000 "File System" | mtd4: 1fa80000 00040000 "File System" | ||
− | </pre> | + | </pre> |
− | To copy the kernel, erase the corresponding memory area before doing the copy: | + | To copy the kernel, erase the corresponding memory area before doing the copy: |
− | <pre> | + | <pre>flash_eraseall /dev/mtd3 |
− | flash_eraseall /dev/mtd3 | ||
nandwrite -p /dev/mtd3 uImage | nandwrite -p /dev/mtd3 uImage | ||
− | </pre> | + | </pre> |
− | same thing for the ''rootfs'' | + | same thing for the ''rootfs'' |
− | <pre> | + | <pre>flash_eraseall /dev/mtd4 |
− | flash_eraseall /dev/mtd4 | ||
nandwrite -p /dev/mtd4 rootfs.jffs2 | nandwrite -p /dev/mtd4 rootfs.jffs2 | ||
− | </pre> | + | </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:// | + | 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://labs.isee.biz/index.php/Update_the_PRE-INSTALLED_software_image_to_a_current_release this]. | ||
=== Copy kernel and ''rootfs'' in memory card === | === 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'' === |
− | + | ''TI CGT'' is the cross compiler for the ''DSP''. 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'' | + | === ''DSP BIOS'' === |
− | + | ''DSP 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). | |
− | + | === ''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. | |
− | + | === ''DSP Link'' === | |
− | + | ''DSPLink'' allows communication between ''ARM'' and ''DSP''. Download it from [http://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> | <pre> | ||
export DSPLINK=$HOME/igep/dsplink_linux_1_63/dsplink | export DSPLINK=$HOME/igep/dsplink_linux_1_63/dsplink | ||
− | </pre> | + | </pre> |
− | + | go to $(DSPLINK)/config/bin directory and execute: | |
− | |||
− | |||
<pre> | <pre> | ||
perl dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=PONSLRMC | perl dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=PONSLRMC | ||
</pre> | </pre> | ||
− | + | This will configure ''DSPLINK''. To understand each of the option we passed, run: | |
<pre> | <pre> | ||
perl dsplinkcfg.pl | perl dsplinkcfg.pl | ||
− | </pre> | + | </pre> |
− | + | and add options one by one. If everything is alright, the following message will appear: | |
− | |||
<pre> | <pre> | ||
Please edit the following files for toolchains, kernel sources, etc changes. | Please edit the following files for toolchains, kernel sources, etc changes. | ||
Line 515: | Line 470: | ||
GPP side distribution file: $DSPLINK/gpp/src/Rules.mk | GPP side distribution file: $DSPLINK/gpp/src/Rules.mk | ||
DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk | DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk | ||
− | </pre> | + | </pre> |
− | + | which are the files we need to edit and adapt to our configuration. | |
− | + | For $DSPLINK/make/Linux/omap3530_2.6.mk file, change (and adapt if needed) the following values: | |
<pre> | <pre> | ||
# ============================================================================ | # ============================================================================ | ||
Line 527: | Line 482: | ||
# Base directory for the GPP OS | # Base directory for the GPP OS | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_BUILDOS | + | BASE_BUILDOS :=${HOME}/igep/linux-omap-2.6.28.10-igep0020b-2 |
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
# Base for toolchain | # Base for toolchain | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_TOOLCHAIN | + | BASE_TOOLCHAIN := /usr/local/poky/eabi-glibc |
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
# Base directory for include files provided by GPP OS | # Base directory for include files provided by GPP OS | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_OSINC | + | BASE_OSINC := $(BASE_BUILDOS)/include |
− | OSINC_GENERIC | + | OSINC_GENERIC := $(BASE_OSINC) |
− | OSINC_PLATFORM | + | OSINC_PLATFORM := $(BASE_TOOLCHAIN)/lib/gcc/arm-poky-linux-gnueabi/4.3.3/include |
− | OSINC_TARGET | + | OSINC_TARGET := $(BASE_TOOLCHAIN)/arm-poky-linux-gnueabi/libc/usr/include |
# ============================================================================ | # ============================================================================ | ||
Line 550: | Line 505: | ||
# Name of the compiler | # Name of the compiler | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | COMPILER | + | COMPILER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gcc |
− | LD | + | LD := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-ld |
− | CROSS_COMPILE | + | CROSS_COMPILE := arm-poky-linux-gnueabi- |
export CROSS_COMPILE | export CROSS_COMPILE | ||
Line 559: | Line 514: | ||
# ARCHIVER2 - This denotes the archiver. | # ARCHIVER2 - This denotes the archiver. | ||
# ============================================================================ | # ============================================================================ | ||
− | ARCHIVER | + | ARCHIVER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-ar |
# ============================================================================ | # ============================================================================ | ||
# LINKER - The compiler is used for linking purpose as well. | # LINKER - The compiler is used for linking purpose as well. | ||
# ============================================================================ | # ============================================================================ | ||
− | LINKER | + | LINKER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gcc |
− | </pre> | + | </pre> |
− | + | For $DSPLINK/gpp/src/Rules.mk file, change (and adapt if needed): | |
<pre> | <pre> | ||
ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530") | ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530") | ||
− | KERNEL_DIR | + | KERNEL_DIR := ${HOME}/igep/linux-omap-2.6.28.10-igep0020b-2 |
− | TOOL_PATH | + | TOOL_PATH := /usr/local/poky/eabi-glibc/bin |
endif #ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530") | endif #ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530") | ||
− | </pre> | + | </pre> |
− | + | and also: | |
<pre> | <pre> | ||
ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc") | ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc") | ||
Line 582: | Line 537: | ||
MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-poky-linux-gnueabi- | MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-poky-linux-gnueabi- | ||
endif # ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc") | endif # ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc") | ||
− | </pre> | + | </pre> |
− | + | Finally, for $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk file, change (and adapt if needed): | |
<pre> | <pre> | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
# Base directory for the DSP OS | # Base directory for the DSP OS | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_INSTALL | + | BASE_INSTALL := $(HOME)/TI |
− | BASE_SABIOS | + | BASE_SABIOS := $(BASE_INSTALL)/bios_5_41_03_17 |
− | BASE_BUILDOS | + | BASE_BUILDOS := $(BASE_SABIOS)/packages/ti/bios |
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
# Base directory for the XDC tools | # Base directory for the XDC tools | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | XDCTOOLS_DIR | + | XDCTOOLS_DIR := $(BASE_INSTALL)/xdctools_3_15_00_50 |
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
# Base for code generation tools - compiler, linker, archiver etc. | # Base for code generation tools - compiler, linker, archiver etc. | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_CGTOOLS | + | BASE_CGTOOLS := $(BASE_INSTALL)/TI_CGT_C6000_6.1.13 |
− | BASE_CGTOOLSBIN := $(BASE_CGTOOLS)/bin | + | BASE_CGTOOLSBIN := $(BASE_CGTOOLS)/bin |
</pre> | </pre> | ||
− | + | Then, go to the $DSPLINK/dsp/src directory and execute: | |
− | |||
− | |||
<pre> | <pre> | ||
make -s | make -s | ||
− | </pre> | + | </pre> |
− | + | do the same in $DSPLINK/gpp/src directory: | |
− | |||
<pre> | <pre> | ||
make -s | make -s | ||
− | </pre> | + | </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: | |
<pre> | <pre> | ||
make | make | ||
</pre> | </pre> | ||
− | === ''CMEM'' === | + | === ''CMEM'' === |
− | ''' | + | '''NOTA:''' versions 2.25 and 2.25.01.06 have problems with ''ioctl'' [http://e2e.ti.com/support/arm174_microprocessors/omap_applications_processors/f/42/p/36278/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''. It is part of the ''linuxutils'', 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: | |
− | ''CMEM'', | ||
<pre> | <pre> | ||
chmod +w Rules.make | chmod +w Rules.make | ||
− | </pre> | + | </pre> |
− | + | Then edit it and change (adapt it if needed): | |
<pre> | <pre> | ||
# For "kernel_org" builds | # For "kernel_org" builds | ||
Line 640: | Line 593: | ||
# For OMAP3530 2.6.29 Linux kernel | # For OMAP3530 2.6.29 Linux kernel | ||
LINUXKERNEL_INSTALL_DIR=$(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2 | LINUXKERNEL_INSTALL_DIR=$(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2 | ||
− | </pre> | + | </pre> |
− | + | Then execute | |
− | + | <pre>make release | |
− | <pre> | + | </pre> |
− | make release | + | to compile cmemk.ko module (it will be placed in ./src/module directory). |
− | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | === ''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. | |
− | ''LPM'' | + | === ''Local Power Manager (LPM)'' === |
− | ''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 [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/lpm/index.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''. | |
+ | Go to the local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm directory end edit the Makefile to change: | ||
<pre> | <pre> | ||
LINUXKERNEL_INSTALL_DIR = $(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2 | 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- | MVTOOL_PREFIX = /usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi- | ||
DSPLINK_REPO = $(HOME)/igep/dsplink_linux_1_63 | 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> | </pre> | ||
− | + | please add: | |
− | + | <pre>#include <linux/slab.h> | |
− | <pre> | ||
− | |||
</pre> | </pre> | ||
− | + | 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/sprc265.html dsplib] | + | *[http://focus.ti.com/docs/toolsw/folders/print/sprc264.html dsp image lib] |
− | *[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] | *[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 "/". | |
− | |||
<!-- pour loop fft, changer le fichier sources pour mettre le chemin des fichiers c de dsplib | <!-- 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 --> | changer aussi le chemin des .h dans tskloop.c --> | ||
− | = | + | = Configure ''DSPLINK'' to compile projects = |
− | + | This part explains how to add libraries to ''DSPLINK'' environment. | |
− | === ''Includes'' === | + | === ''Includes'' === |
− | + | Edit file $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk and add the ''includes'' directories: | |
− | + | <pre># ---------------------------------------------------------------------------- | |
− | <pre> | ||
− | # ---------------------------------------------------------------------------- | ||
# Base directory for include files | # Base directory for include files | ||
# ---------------------------------------------------------------------------- | # ---------------------------------------------------------------------------- | ||
− | BASE_OSINC | + | BASE_OSINC := $(BASE_BUILDOS)/include |
− | BASE_CGTOOLSINC := $(BASE_CGTOOLS)/include | + | BASE_CGTOOLSINC := $(BASE_CGTOOLS)/include |
− | BASE_RTDXINC | + | BASE_RTDXINC := $(BASE_RTDX)/include/c6000 |
− | BASE_PSLINC | + | BASE_PSLINC := $(BASE_PSL)/include |
− | BASE_CSLINC | + | BASE_CSLINC := |
BASE_XDCINC := $(BASE_INSTALL)/xdctools_3_15_00_50/packages | BASE_XDCINC := $(BASE_INSTALL)/xdctools_3_15_00_50/packages | ||
BASE_FCINC := $(BASE_INSTALL)/framework_components_2_24_01/packages | BASE_FCINC := $(BASE_INSTALL)/framework_components_2_24_01/packages | ||
Line 715: | Line 678: | ||
BASE_IQMATHINC := $(BASE_INSTALL)/IQmath_v213/include | BASE_IQMATHINC := $(BASE_INSTALL)/IQmath_v213/include | ||
− | OSINC_GENERIC | + | OSINC_GENERIC := $(BASE_OSINC) |
− | OSINC_PLATFORM | + | OSINC_PLATFORM := $(BASE_CGTOOLSINC) $(BASE_RTDXINC) \ |
$(BASE_PSLINC) $(BASE_CSLINC) $(BASE_XDCINC) $(BASE_FCINC) $(BASE_FCTOOLINC) $(BASE_IMGLIBINC) $(BASE_IQMATHINC) | $(BASE_PSLINC) $(BASE_CSLINC) $(BASE_XDCINC) $(BASE_FCINC) $(BASE_FCTOOLINC) $(BASE_IMGLIBINC) $(BASE_IQMATHINC) | ||
− | </pre> | + | </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 libraries in the directories: | |
− | <pre> | + | <pre>$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/ |
− | $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/ | ||
$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/ | $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/ | ||
− | </pre> | + | </pre> |
− | + | Thus, you have to copy the libraries in the right place: | |
− | <pre> | + | <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/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/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/debug/acpy3.a64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/ | ||
Line 738: | Line 699: | ||
</pre> | </pre> | ||
− | = Configure ''CodeBlocks'' for ''ARM''= | + | = Configure ''CodeBlocks'' for ''ARM'' = |
− | This part explains how to setup ''CodeBlocks'' to develop programs using ''dsplink'' library. | + | 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: | + | Go to ''settings/compiler and debugger'' menu, choose ''GNU ARM GCC compiler'' as compiler. You should see the following window: |
− | [[Image: | + | [[Image:Settings.jpg|center|500px]] |
− | Select ''Search directories'' tab and ''Compiler''. Then add the following directories (and adapt it if necessary): | + | Select ''Search directories'' tab and ''Compiler''. Then add the following directories (and adapt it if necessary): |
− | <pre> | + | <pre>/usr/local/poky/eabi-glibc/arm-none-linux-gnueabi/lib |
− | /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/inc/sys/Linux | ||
$(HOME)/igep/dsplink_linux_1_63/dsplink/gpp/export/INCLUDE/Linux/OMAP3530/usr | $(HOME)/igep/dsplink_linux_1_63/dsplink/gpp/export/INCLUDE/Linux/OMAP3530/usr | ||
− | </pre> | + | </pre> |
− | Which should give the following result: | + | Which should give the following result: |
− | [[Image: | + | [[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]] | |
− | <pre> | + | --> |
− | + | Choose ''Toolchain executables'' tab and ''Compiler's installations directory'': | |
− | </pre> | + | <pre>/usr/local/poky/eabi-glibc/ |
− | + | </pre> | |
+ | Then, enter the ''Program Files'' as follows: | ||
− | [[Image: | + | [[Image:Executables.jpg|center|500px]] |
− | + | = References = | |
− | |||
− | |||
− | |||
− | |||
− | [ | + | [http://www.pokylinux.org/doc/poky-handbook.html Poky Handbook] |
− | + | [http://wiki.davincidsp.com/index.php/Building_DSPLink Building DSPLink] | |
− | [http://wiki. | ||
− | |||
− | |||
− | [http:// | + | [http://hilbert-space.de/?p=14 Compiling CMEM] |
− | [ | + | [[Category:How to forge|Development environment]] |
− | + | [[Category:Development tools]] | |
− | [ | + | [[Category:Tutorials]] |
Latest revision as of 10:36, 31 December 2013
This tutorial was written for the 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 References). All files will be installed in the $HOME directory.
Contents
A newer version of this information may be available: Visit the IGEP SDK Virtual Machine for updated information |
Rootfs
This section describes how to obtain the Poky distribution. This is the distribution shipped with the igep board; it is based on Open Embedded.
The first thing to do is set Bash as default sh shell:
sudo dpkg-reconfigure dash
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 :
vm.mmap_min_addr = 0
then, to take the modification into account:
sudo sysctl -p
Some additional packages need to be installed to satisfy bitbake dependencies. First, add the following repositories to "/etc/apt/sources.list" :
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/
Update the data base and install the following packages:
sudo apt-get update sudo aptitude install python-psyco hgsvn qemu poky-depends poky-scripts
Then, download and decompress the last stable version of Poky:
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
The configuration file of Poky is located in the directory $HOME/igep/poky/build/conf :
cd build/conf nano local.conf
And paste the modified version for the igep board:
# Where to cache the files Poky downloads DL_DIR ?= "${OEROOT}/sources" BBFILES += "\ ${OEROOT}/meta/packages/*/*.bb \ ${OEROOT}/meta-moblin/packages/*/*.bb" BBFILE_COLLECTIONS = "normal moblin" BBFILE_PATTERN_normal = "^${OEROOT}/meta/" BBFILE_PATTERN_moblin = "^${OEROOT}/meta-moblin/" BBFILE_PRIORITY_normal = "5" BBFILE_PRIORITY_moblin = "5" # 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. BB_NUMBER_THREADS = "4" # Also, make can be passed flags so it run parallel threads e.g.: # PARALLEL_MAKE = "-j 2" # The machine to target MACHINE ?= "igep0020b" TARGET_FPU_arm ?= "hard" # Other supported machines #MACHINE ?= "qemux86" #MACHINE ?= "qemuarm" #MACHINE ?= "c7x0" #MACHINE ?= "akita" #MACHINE ?= "spitz" #MACHINE ?= "nokia770" #MACHINE ?= "nokia800" #MACHINE ?= "fic-gta01" #MACHINE ?= "bootcdx86" #MACHINE ?= "cm-x270" #MACHINE ?= "em-x270" #MACHINE ?= "htcuniversal" #MACHINE ?= "mx31ads" #MACHINE ?= "mx31litekit" #MACHINE ?= "mx31phy" #MACHINE ?= "netbook" #MACHINE ?= "zylonite" DISTRO ?= "poky" # For bleeding edge / experimental / unstable package versions # DISTRO ?= "poky-bleeding" # Poky has various extra metadata collections (openmoko, extras). # To enable these, uncomment all (or some of) the following lines: # BBFILES = "\ # ${OEROOT}/meta/packages/*/*.bb \ # ${OEROOT}/meta-extras/packages/*/*.bb \ # ${OEROOT}/meta-openmoko/packages/*/*.bb \ # ${OEROOT}/meta-moblin/packages/*/*.bb \ # " # BBFILE_COLLECTIONS = "normal extras openmoko moblin" # BBFILE_PATTERN_normal = "^${OEROOT}/meta/" # BBFILE_PATTERN_extras = "^${OEROOT}/meta-extras/" # BBFILE_PATTERN_openmoko = "^${OEROOT}/meta-openmoko/" # BBFILE_PATTERN_moblin = "^${OEROOT}/meta-moblin/" # BBFILE_PRIORITY_normal = "5" # BBFILE_PRIORITY_extras = "5" # BBFILE_PRIORITY_openmoko = "5" # BBFILE_PRIORITY_moblin = "5" BBMASK = "" # EXTRA_IMAGE_FEATURES allows extra packages to be added to the generated images # (Some of these are automatically added to certain image types) # "dbg-pkgs" - add -dbg packages for all installed packages # (adds symbol information for debugging/profiling) # "dev-pkgs" - add -dev packages for all installed packages # (useful if you want to develop against libs in the image) # "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) # "tools-debug" - add debugging tools (gdb, strace) # "tools-profile" - add profiling tools (oprofile, exmap, lttng valgrind (x86 only)) # "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) # "debug-tweaks" - make an image for suitable of development # e.g. ssh root access has a blank password # There are other application targets too, see meta/classes/poky-image.bbclass # and meta/packages/tasks/task-poky.bb for more details. EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps debug-tweaks" # The default IMAGE_FEATURES above are too large for the mx31phy and # c700/c750 machines which have limited space. The code below limits # the default features for those machines. EXTRA_IMAGE_FEATURES_c7x0 = "tools-testapps debug-tweaks" EXTRA_IMAGE_FEATURES_mx31phy = "debug-tweaks" EXTRA_IMAGE_FEATURES_mx31ads = "tools-testapps debug-tweaks" # A list of packaging systems used in generated images # The first package type listed will be used for rootfs generation # include 'package_deb' for debs # include 'package_ipk' for ipks #PACKAGE_CLASSES ?= "package_deb package_ipk" PACKAGE_CLASSES ?= "package_ipk" # POKYMODE controls the characteristics of the generated packages/images by # telling poky which type of toolchain to use. # # Options include several different EABI combinations and a compatibility # mode for the OABI mode poky previously used. # # The default is "eabi" # Use "oabi" for machines with kernels < 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. # POKYMODE = "external-eabi" # Uncomment this to specify where BitBake should create its temporary files. # 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 # <build directory>/tmp TMPDIR = "${OEROOT}/build/tmp-${MACHINE}" # Uncomment this if you are using the Openedhand provided qemu deb - see README ASSUME_PROVIDED += "qemu-native" # Comment this out if you don't have a 3.x gcc version available and wish # poky to build one for you. The 3.x gcc is required to build qemu-native. #ASSUME_PROVIDED += "gcc3-native" # Uncomment these two if you want BitBake to build images useful for debugging. # DEBUG_BUILD = "1" # INHIBIT_PACKAGE_STRIP = "1" # Uncomment these to build a package such that you can use gprof to profile it. # NOTE: This will only work with 'linux' targets, not # 'linux-uclibc', as uClibc doesn't provide the necessary # object files. Also, don't build glibc itself with these # flags, or it'll fail to build. # # PROFILE_OPTIMIZATION = "-pg" # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}" # LDFLAGS =+ "-pg" # Uncomment this if you want BitBake to emit debugging output # BBDEBUG = "yes" # Uncomment this if you want BitBake to emit the log if a build fails. BBINCLUDELOGS = "yes" # Specifies a location to search for pre-generated tarballs when fetching # a cvs:// or svn:// URI. Uncomment this, if you do not want to pull directly # from CVS or Subversion SRC_TARBALL_STASH = "http://pokylinux.org/sources/" # Set this if you wish to make pkgconfig libraries from your system available # for native builds. Combined with extra ASSUME_PROVIDEDs this can allow # native builds of applications like oprofileui-native (unsupported feature). #EXTRA_NATIVE_PKGCONFIG_PATH = ":/usr/lib/pkgconfig" #ASSUME_PROVIDED += "gtk+-native libglade-native" ENABLE_BINARY_LOCALE_GENERATION = "0" # The architecture to build SDK items for, by setting this you can build SDK # packages for architectures other than the host i.e. building i586 packages # on an x86_64 host. # Supported values are i586 and x86_64 SDKMACHINE="i586"
The following section needs to be adapted to the number of CPU the host machine has:
# 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. # BB_NUMBER_THREADS = "2" # Also, make can be passed flags so it run parallel threads e.g.: # PARALLEL_MAKE = "-j 2"
The build environment needs to be setup by the following command:
cd ../.. source poky-init-build-env
A target can be built using:
bitbake <target>
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 Poky Handbook. To build an image without X11 server:
bitbake poky-image-base
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 part of Poky's FAQ.
If everything compiles well, the resulting image (rootfs and kernel) will be placed in the directory:
tmp-igep0020b/deploy/images/
and .ipk packages in:
tmp-igep0020b/deploy/ipk/
We will see in section 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 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 this thread. A patch has been proposed; to apply it :
cd $HOME/igep/poky wget http://lists.o-hand.com/poky/att-1420/fix-gxx-include-dir.patch patch -p1 < fix-gxx-include-dir.patch
The cross toolchain can be built using bitbake:
source poky-init-build-env bitbake meta-toolchain-sdk
The result will be placed in the directory:
tmp-igep0020b/deploy/sdk/
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:
source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi
Kernel compilation
Another more recent source of information can be found at labs.igep.es/index.php/The_Linux_kernel.
In this example the kernel version "linux-omap-2.6.28.10-igep0020b-2" is used. Check in the download section of www.igep.es which is the last stable one. More recent versions (but unstable) can be downloaded on the git of ISEE.
Kernel compilation under bitbake
Kernel compilation outside bitbake
First, download the kernel sources:
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
Configure the kernel:
source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- igep0020b_defconfig make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
The last line is only needed if you want to customize the kernel.
To compile kernel and modules:
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage modules
The resulting image is placed in "arch/arm/boot" directory.
Note: If there is no uImage file present you may not have installed the uboot-mkimage package.
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 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 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:
setenv project poky-image-base
Then, to boot:
run bootcmd
which will execute the contents of the bootcmd variable. The 'printenv' command allow to show the content of a variable; for example:
printenv bootcmd
returns by default:
run mmc-boot; run nfs-boot; run onenand-boot
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.
Take a look at mmc-boot, nfs-boot and onenand-boot variables for more details. In addition, the factory settings of UBoot are given here.
In order to save UBoot environment variables in the flash, do:
saveenv
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/<distro>/<project>/<machine>" accessible by TFTP.
- a rootfs in the directory "/srv/nfs/<distro>/<project>/<machine>" accessible by NFS.
We assume now that <distro>=poky, <project>=poky-image-base and <machine>=igep0020b.
Thus, create the following directories on the host:
sudo mkdir -p /srv/nfs/poky/poky-image-base/igep0020b sudo mkdir -p /srv/tftp/poky/poky-image-base/igep0020b
Make sure the access rights of the directory is set correctly (use e.g. chmod 777 <dir>).
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 outside bitbake:
sudo cp $HOME/igep/linux-omap-2.6.28.10-igep0020b-2/arch/arm/boot/uImage /srv/tftp/poky/poky-image-base/igep0020b/
or if it was made with the rootfs or underbitbake:
sudo cp $HOME/igep/poky/build/tmp-igep0020b/deploy/images/uImage /srv/tftp/poky/poky-image-base/igep0020b/
Next, install the rootfs in the good directory:
pushd /srv/nfs/poky/poky-image-base/igep0020b sudo cpio -idm< $HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.cpio popd
If kernel was built outside bitbake, install kernel modules in the rootfs as follows:
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
Finally, install the two servers on host:
sudo apt-get install tftpd nfs-kernel-server
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 :
#: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
The configuration file of NFS server is "/etc/exports". Add the following line for each rootfs :
# Poky image rootfs /srv/nfs/<distro>/<project>/<machine> <target_ip>(rw,no_root_squash,no_subtree_check,sync)
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 an asterisk (*) to allow a wider range of addresses. In our case, write :
/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)
Remember execute the command:
$ exportfs -a
Every time that you modify/update the file /etc/exports.
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:
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 previously, you can jump next step. If you have made changes to the rootfs (for example when using it for 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:
sudo apt-get install mtd-utils
Then use the command:
mkfs.jffs2 -r <root file system> -e <erase block size> -o <output file>
where <root file system> is the path to the directory to copy (ie /srv/nfs/poky/poky-image-base/igep0020b), <erase block size> is the block size to erase in KB and <output file> name of the output file. Block size can be seen with the following command:
cat /proc/mtd
On igep, it returns:
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"
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:
cat /proc/mtd
On igep, it returns:
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"
To copy the kernel, erase the corresponding memory area before doing the copy:
flash_eraseall /dev/mtd3 nandwrite -p /dev/mtd3 uImage
same thing for the rootfs
flash_eraseall /dev/mtd4 nandwrite -p /dev/mtd4 rootfs.jffs2
Note that if you are using the rootfs built previously, the corresponding file should be located there:
$HOME/igep/poky/build/tmp-igep0020b/deploy/images/poky-image-base-igep0020b.jffs2
And now reboot. In case of errors (such as bad crc on the kernel for example), it is necessary to reflash all, see 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 this one.
Code generation tools
TI CGT is the cross compiler for the DSP. Download last version here and install it (for example in $HOME/TI/TI_CGT directory).
DSP BIOS
DSP BIOS is the operating system running on the DSP. Download it from here and install it (for example in $HOME/TI/BIOS directory).
XDC Tools
Download it from 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 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)
export DSPLINK=$HOME/igep/dsplink_linux_1_63/dsplink
go to $(DSPLINK)/config/bin directory and execute:
perl dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 --dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=PONSLRMC
This will configure DSPLINK. To understand each of the option we passed, run:
perl dsplinkcfg.pl
and add options one by one. If everything is alright, the following message will appear:
Please edit the following files for toolchains, kernel sources, etc changes. GPP side distribution file: $DSPLINK/make/Linux/omap3530_2.6.mk GPP side distribution file: $DSPLINK/gpp/src/Rules.mk DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk
which are the files we need to edit and adapt to our configuration.
For $DSPLINK/make/Linux/omap3530_2.6.mk file, change (and adapt if needed) the following values:
# ============================================================================ # Set the values of necessary variables to be used for the OS. # ============================================================================ # ---------------------------------------------------------------------------- # 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/include OSINC_TARGET := $(BASE_TOOLCHAIN)/arm-poky-linux-gnueabi/libc/usr/include # ============================================================================ # COMPILER # ============================================================================ # ---------------------------------------------------------------------------- # Name of the compiler # ---------------------------------------------------------------------------- COMPILER := $(BASE_CGTOOLS)/arm-poky-linux-gnueabi-gcc LD := $(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
For $DSPLINK/gpp/src/Rules.mk file, change (and adapt if needed):
ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530") KERNEL_DIR := ${HOME}/igep/linux-omap-2.6.28.10-igep0020b-2 TOOL_PATH := /usr/local/poky/eabi-glibc/bin endif #ifeq ("$(TI_DSPLINK_PLATFORM)", "OMAP3530")
and also:
ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc") CG_PREFIX = arm-linux-uclibcgnueabi- MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-linux-uclibcgnueabi- else CG_PREFIX = arm-poky-linux-gnueabi- MAKE_OPTS = ARCH=arm CROSS_COMPILE=$(TOOL_PATH)/arm-poky-linux-gnueabi- endif # ifeq ("$(TI_DSPLINK_GPPOSPREFIX)", "uc")
Finally, for $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk file, change (and adapt if needed):
# ---------------------------------------------------------------------------- # Base directory for the DSP OS # ---------------------------------------------------------------------------- BASE_INSTALL := $(HOME)/TI BASE_SABIOS := $(BASE_INSTALL)/bios_5_41_03_17 BASE_BUILDOS := $(BASE_SABIOS)/packages/ti/bios # ---------------------------------------------------------------------------- # Base directory for the XDC tools # ---------------------------------------------------------------------------- XDCTOOLS_DIR := $(BASE_INSTALL)/xdctools_3_15_00_50 # ---------------------------------------------------------------------------- # Base for code generation tools - compiler, linker, archiver etc. # ---------------------------------------------------------------------------- BASE_CGTOOLS := $(BASE_INSTALL)/TI_CGT_C6000_6.1.13 BASE_CGTOOLSBIN := $(BASE_CGTOOLS)/bin
Then, go to the $DSPLINK/dsp/src directory and execute:
make -s
do the same in $DSPLINK/gpp/src directory:
make -s
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
CMEM
NOTA: versions 2.25 and 2.25.01.06 have problems with ioctl 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. It is part of the linuxutils, download it from 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:
chmod +w Rules.make
Then edit it and change (adapt it if needed):
# For "kernel_org" builds MVTOOL_PREFIX=/usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi- # Equivalent path for uClibc compiler tools UCTOOL_PREFIX=/usr/local/poky/eabi-glibc/bin/arm-poky-linux-gnueabi- # For OMAP3530 2.6.29 Linux kernel LINUXKERNEL_INSTALL_DIR=$(HOME)/igep/linux-omap-2.6.28.10-igep0020b-2
Then execute
make release
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 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 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.
Go to the local_power_manager_1_24/packages/ti/bios/power/modules/omap3530/lpm directory end edit the Makefile to change:
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
the compile
make
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:
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'
please add:
#include <linux/slab.h>
to lpm_driver.c.
Libraries
The interesting libraries are the followings:
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 "/".
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:
# ---------------------------------------------------------------------------- # Base directory for include files # ---------------------------------------------------------------------------- BASE_OSINC := $(BASE_BUILDOS)/include BASE_CGTOOLSINC := $(BASE_CGTOOLS)/include BASE_RTDXINC := $(BASE_RTDX)/include/c6000 BASE_PSLINC := $(BASE_PSL)/include BASE_CSLINC := BASE_XDCINC := $(BASE_INSTALL)/xdctools_3_15_00_50/packages BASE_FCINC := $(BASE_INSTALL)/framework_components_2_24_01/packages BASE_FCTOOLINC := $(BASE_INSTALL)/framework_components_2_24_01/fctools/packages BASE_IMGLIBINC := $(BASE_INSTALL)/imglib_v201/include BASE_IQMATHINC := $(BASE_INSTALL)/IQmath_v213/include OSINC_GENERIC := $(BASE_OSINC) OSINC_PLATFORM := $(BASE_CGTOOLSINC) $(BASE_RTDXINC) \ $(BASE_PSLINC) $(BASE_CSLINC) $(BASE_XDCINC) $(BASE_FCINC) $(BASE_FCTOOLINC) $(BASE_IMGLIBINC) $(BASE_IQMATHINC)
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 libraries in the directories:
$DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/DEBUG/ $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/
Thus, you have to copy the libraries in the right place:
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/ cp $HOME/TI/imglib_v201/lib/target/imglib2.l64P $DSPLINK/dsp/BUILD/OMAP3530_0/EXPORT/RELEASE/
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:
Select Search directories tab and Compiler. Then add the following directories (and adapt it if necessary):
/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
Which should give the following result:
Choose Toolchain executables tab and Compiler's installations directory:
/usr/local/poky/eabi-glibc/
Then, enter the Program Files as follows: