Question

Trying to get a working directfb for use in an embedded system based on an i.MX53 processor (which is an ARM Cortex-A8 core) running Linux 2.6.35.3 (as supplied by Freescale).

I have installed a cross compiler on my i686 debian host system. The cross compiler came from the embedian.org archive, and is the gcc-4.3-arm-linux-gnueabi package (arm-linux-gnueabi-gcc (Debian 4.3.2-1.1) 4.3.2). This is supplied with glibc 2.7. This is a different version from the version on my target system, which is glibc 2.11, although my reading suggests that they should be compatible.

After much experimentation with the libraries already existing on the system image, I have managed to successfully compile directfb 1.6.2. This was complicated by the fact that I do not have working pkg-config info for the already-installed libraries, but I eventually managed to persuade it to compile using the following configure command line:

TOP=`realpath ../..`
PKG_CONFIG_PATH=${TOP}/ext/libpng-1.5.13/ \
LIBPNG_CFLAGS=-I${TOP}/include \
LIBPNG_LDFLAGS="-L${TOP}/libs -lpng15 -lz" \
FREETYPE_CFLAGS=-I${TOP}/include \
FREETYPE_LIBS="-L${TOP}/libs -lfreetype" \
LIBS="-lgcc_s -lgcc -ldl -lstdc++ -lz" \
CFLAGS="-march=armv7-a" \
CXXFLAGS="-march=armv7-a" \
./configure CC=arm-linux-gnueabi-gcc CPPFLAGS=-I${TOP}/include LDFLAGS=-L${TOP}/lib \
   --build=i686-linux --host=arm-linux-gnueabi \
   --enable-static --disable-shared \
   --disable-freetype --enable-fbdev --disable-x11 \
   --with-gfxdrivers=none --with-inputdrivers=none

This successfully builds, and I can compile and link a sample application based on the simple tutorial application at http://directfb.org/docs/DirectFB_Tutorials/simple.html -- unfortunately, when run on the target system, the application crashes with SIGSEGV. So too do some of the tools included with directfb, e.g. dfbinfo.

Here is a stack trace of my test application crashing (when run with command line arg "--dfb:fbdev=/dev/fb0"):

#0  direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298
#1  0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev",
    value=0xdfd76 "/dev/fb0") at conf.c:542
#2  0x0009edc0 in dfb_config_set (name=0xdfd70 "fbdev",
    value=0xdfd76 "/dev/fb0") at conf.c:2024
#3  0x000a2dcc in parse_args (args=0x7ea80d53 "fbdev=/dev/fb0") at conf.c:297
#4  0x000a305c in dfb_config_init (argc=0x7ea80968, argv=0x7ea80964)
    at conf.c:2159
#5  0x0000cd58 in Display::Display ()
#6  0x0000ba94 in main ()

For reference, the only directfb-related code to execute in the application prior to the crash is directly copied from the tutorial code:

Display::Display(int argc, char ** argv)
{
   DFBSurfaceDescription dsc;       
   DFBCHECK (DirectFBInit (&argc, &argv));  
   // ... crash occurs during execution of the line above
}

This is called directly from my main function, passing the original unmodified argc and argv.

I have installed the directfb libraries on the target system in /usr/local/lib and binaries in /usr/local/bin, and created /usr/local/share/directfb-1.6.2 (containing cursor.dat and decker.dgiff) as well as /etc/fb.modes as suggested in the documentation.

Any suggestions as to what I've done wrong?

Was it helpful?

Solution

Reading source codes for conf.c and maps.c from git.directfb.org and checking your stack...

#0  direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298
#1  0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev", value=0xdfd76 "/dev/fb0") at conf.c:542

map is null. Which should assert at map.c:295 but looks like that's disabled but instead crashes at 298

hash = map->hash( map, key, map->ctx );

Previous call is in conf.c:542,

ConfigOption *option = direct_map_lookup( config_options, name );

which means config_options was null. Searching in that file only place it gets assigned to a file is __D_conf_init().

I don't know anything about directfb, but it looks like you need to call __D_conf_init directly or indirectly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top