Embedded Freaks..

November 26, 2010

Testing ‘Disko-Demos’ in LPC3250

Filed under: ARM9, arm926ej-s, embedded-linux — Tags: , — kunilkuda @ 4:48 pm

LPC3250 is NXP’s ARM926EJ-S SoC-based MCU. It comes with extra peripherals for user interface (LCD-32bits, touchscreen, SDRAM controller), designed mainly for industrial HMI (Human-Machine Interface) or simple embedded application that requires graphical user interface. Hence, it doesn’t have any fancy video / audio co-processors like TI OMAP series.

I’m running this test based on PHYCORE-LPC3250 at 208Mhz. The bootloaders (NXP S1L along with uboot) and linux kernel installation is provided in lpclinux.com.

To update your PHYCORE-LPC3250 S1L (new S1L is provided to ease LPC3250 board porting and adding more features), see this page. You won’t mess around with kernel’s source code or the bootloader. Hence, it’s better to burn everything into NAND flash.To burn the U-Boot in PHYCORE-LPC3250’s  flash, see this page. To burn the Linux kernel into PHYCORE-LPC3250’s  flash, see this page.

My suggestion is to add NFS server in your PC host, because modifying the root filesystem while debugging the Disko application is quite a troublesome if you use SD-Card (see my last post for it). However, just to run this demo, you can download your root filesystem into SD-Card and deploy it in your board.

Ok, that’s enough for the small talk..now I’m going to talk big =P..kidding..

Preparing Disko

The first thing is compile the libraries and Disko framework (here).

The issue with Disko-1.7.0 is that the library keeps referring to $HOST_DIR, even though it has been copied to target board. I’m adding this patch to hardcode the target’s resource root directory.


--- disko-1.7.0/src/mmsinfo/mmsinfo.cpp	2010-04-27 22:22:16.000000000 +0800
+++ disko-fix-1.7.0/src/mmsinfo/mmsinfo.cpp	2010-11-26 16:18:17.958657687 +0800
@@ -33,5 +33,5 @@
 #include "mmsinfo/mmsinfo.h"
 const char *getPrefix() {
-	return DISKO_PREFIX;
+	return "";
 }

Save the patch as ‘disko-cross_target.patch’. Apply the patches in the disko’s build directory, then re-compile and install disko

# cd $BUILD_DIR/disko-1.7.0
# patch -p1 < disko-cross_target.patch
# CXX=arm-none-linux-gnueabi-g++ CXXFLAGS="-mcpu=arm926ej-s" \
	PKG_CONFIG_PATH=$HOST_DIR/lib/pkgconfig \
	scons graphics=fbdev prefix=$HOST_DIR cross=true install

Preparing Disko-Demos

See my previous post..

Preparing Root Filesystem

Basically, it’s the same steps as in previous post, but there’s some additional steps that’re needed to be added. First, download, compile, and install the busybox into $TARGET_DIR

# tar xvjf busybox-1.18.0.tar.bz2
# cd busybox-1.18.0
# CFLAGS="-mcpu=arm926ej-s" make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
.....add in the utilities that you need..I'm using the standard utilities..
# CFLAGS="-mcpu=arm926ej-s" make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
# CFLAGS="-mcpu=arm926ej-s" make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- CONFIG_PREFIX=$TARGET_DIR install

Then install the busybox’s library dependencies

# arm-none-linux-gnueabi-readelf -d busybox

Dynamic section at offset 0xdb0cc contains 25 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0xc0a0
 0x0000000d (FINI)                       0xbd5fc
 0x00000019 (INIT_ARRAY)                 0xeb0c0
 ...
# mkdir $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libm.so.6 $TARGET_DIR/lib/
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libc.so.6 $TARGET_DIR/lib/
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/ld-linux.so.3 $TARGET_DIR/lib/

After that, also install the ‘disko-demos’ library dependencies.

# arm-none-linux-gnueabi-readelf -d $TARGET_DIR/bin/demo

Dynamic section at offset 0x2d028 contains 37 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libdisko.so]
 0x00000001 (NEEDED)                     Shared library: [libxml2.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsigc-2.0.so.0]
 0x00000001 (NEEDED)                     Shared library: [libpng14.so.14]
 0x00000001 (NEEDED)                     Shared library: [libfreetype.so.6]
 0x00000001 (NEEDED)                     Shared library: [libcurl.so.4]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.2]
 0x00000001 (NEEDED)                     Shared library: [libsqlite3.so.0]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [librt.so.1]
 0x0000000c (INIT)                       0xea0c
 ................
# cp $HOST_DIR/lib/libdisko.so $TARGET_DIR/lib
# cp $HOST_DIR/lib/libxml2.so.2 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libsigc-2.0.so.0 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libpng14.so.14 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libfreetype.so.6 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libcurl.so.4 $TARGET_DIR/lib
# cp $HOST_DIR/lib/libsqlite3.so.0 $TARGET_DIR/lib
.....Not in the list, but libpng depends on it
# cp $HOST_DIR/lib/libz.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libdl.so.2 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libgcc_s.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/libpthread.so.0 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/lib/librt.so.1 $TARGET_DIR/lib
# cp $CODESOURCERY/arm-none-linux-gnueabi/libc/usr/lib/libstdc++.so.6 $TARGET_DIR/lib

Copy also the XML files for Disko GUI’s configuration

# cp -R $HOST_DIR/share/disko $TARGET_DIR/share

The next step is installing the device mount point, so that our applications can communicate with the device drivers.

# mkdir $TARGET_DIR/dev
...Minimum standard device files to run Linux
# sudo mknod $TARGET_DIR/dev/console c 5 1
# sudo mknod $TARGET_DIR/dev/null c 1 3
# sudo mknod $TARGET_DIR/dev/zero c 1 5
...Need device file for SD-Card partition #1, because the rootfs is stored there
# sudo mknod $TARGET_DIR/dev/mmcblk0p1 b 179 1
...Serial console for boot..
# sudo mknod $TARGET_DIR/dev/ttyS0 c 4 64
...Framebuffer...
# sudo mknod $TARGET_DIR/dev/fb0 c 29 0
...Touchscreen
# mkdir $TARGET_DIR/dev/input
# sudo mknod $TARGET_DIR/dev/input/event0 c 13 64
...Virtual terminals..needed by Disko
# sudo mknod $TARGET_DIR/dev/tty0 c 4 0
# sudo mknod $TARGET_DIR/dev/tty2 c 4 2

Then, prepare the Linux’s system init files

# vi $TARGET_DIR/etc/inittab
::sysinit:/etc/init.d/rcS
::askfirst:/bin/sh
# mkdir TARGET_DIR/etc/init.d
# vi $TARGET_DIR/etc/init.d/rcS
/bin/mount -t proc proc /proc
echo "Welcome to Disko-Demos for LPC3250"
# chmod +x $TARGET_DIR/etc/init.d/rcS
# mkdir $TARGET_DIR/proc

Phewww….that was long isn’t it ??

Configuring Disko

The disko config is stored in ‘$TARGET_DIR/etc/diskorc.xml’. To run it on PHYCORE-LPC3250, you need these changes:

<graphics>
    <parameter name="fullscreen" value="true"/>
    <!-- PHY3250 LCD is 240x320 @16bpp -->
    <parameter name="xres" value="240"/>
    <parameter name="yres" value="320"/>
    <parameter name="backend" value="fbdev" />
    <parameter name="outputtype" value="stdfb"/>
    <parameter name="videolayerid" value="0"/>
    <parameter name="videolayerpixelformat" value="RGB16" />
    .....
    <parameter name="graphicslayerid" value="0"/>
    <parameter name="graphicslayerpixelformat" value="RGB16"/>
    .....
    <parameter name="touchrect.w" value="240"/>
    <parameter name="touchrect.h" value="320"/>
    <parameter name="pointer" value="true"/>
    .....
    <parameter name="extendedaccel" value="false"/>
    <parameter name="allocmethod" value="malloc"/>
    <parameter name="hideapplication" value="false"/>
</graphics>

Running Disko-Demos

Well, that’s it..If you have NFS-based system, just enable the $TARGET_DIR as NFS exported directory, and access it from your PHY3250. If you use SD-Card, copy these files into your SD-Card, plug into PHY3250, and boot.
Once you boot, and reach the shell, run Disko-Demos with:

# ./bin/demo&

4 Comments »

  1. Hello kunilkuda,

    you don’t need the patch for mmsinfo.cpp if you specify ‘destdir=…’ when building disko.

    Example:
    If your target environment is installed in /opt/lpc3250 you can build disko with ‘scons prefix=/usr destdir=/opt/lpc3250 ‘.

    Btw. nice series of tutorials that you are publishing here. I’ll stay tuned…

    Best regards,
    Matthias

    Comment by Matthias — November 26, 2010 @ 9:30 pm

  2. Hi Matthias,

    Thanks a lot for the tips =) Will rework my disko cross-compilation script and update this post

    -daniel

    Comment by kunilkuda — November 27, 2010 @ 12:18 am

  3. […] to your target directory (or to SD-Card), and copy all the library dependencies (as described in my last post, ‘Preparing Root Filesystem’ section). Then run […]

    Pingback by Disko ‘Firststeps’ Tutorial in LPC3250 « Embedded Freaks.. — December 2, 2010 @ 2:12 am

  4. Tested ‘destdir=..’ in Disko-1.7.0.

    The ‘prefix=..’ is basically used both in host and target system. Hence, compiling with

    # cd $BUILD_DIR/disko-1.7.0
    # CXX=arm-none-linux-gnueabi-g++ CXXFLAGS="-mcpu=arm926ej-s" \
    	PKG_CONFIG_PATH=$HOST_DIR/lib/pkgconfig \
    	scons graphics=fbdev destdir=$HOST_DIR prefix=/opt/disko cross=true install
    

    will make disko looking for ‘/opt/disko’ in host system for disko libraries (bug in ‘disko.pc’).

    But this one has been fixed in the GIT version of disko.

    Comment by kunilkuda — December 3, 2010 @ 10:04 am


RSS feed for comments on this post. TrackBack URI

Leave a comment