This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SDL 1.2 on AM335x Starter Kit

Hello,

I am doing development on an AM335x Starter Kit and am trying to get SDL 1.2 working.

I have installed SDL (cross compiled for arm-linux) and am trying to run a game which uses SDL.

I am finding that the game errors out with the following in the log file:

"Can't initialize SDL: No available video device"

I have tried to setup SDL to use the framebuffer, but i still have no luck in getting the game to run.

I have run fbset and the results are:

mode "480x272-57"
    # D: 9.091 MHz, H: 16.992 kHz, V: 57.021 Hz
    geometry 480 272 480 576 32
    timings 110000 43 8 12 4 4 10
    rgba 8/16,8/8,8/0,8/24
endmode

I can output to the framebuffer using

cat ~/test.bmp > /dev/fb0

and some sort of an image appears although it is not correct. which tells me that the frame buffer is at least functional in some way.

Has anyone had any experience with running SDL? Any pointers?

Thanks,

Tim

  • I've looked through that and haven't found a solution.

    I am facing a couple of issues. One, I wasn't sure if my make file was calling the host's installation or the targets installation of SDL. I modified the targets installation of SDL to do a printf when SDL_Init is called. Compiled it and installed in on the target. Which appeared to go well.

    I then compiled my test code again and ran it calling the SDL_Init. No printf occured. I then went through the process of uninstalling SDL from the host computer.

    I then modified my make file to include the -nostdinc switch on the compiler. which failed. when i tried to build. Rightly so as I had removed all references to the include. I think went through the process of manually adding each library that I wanted and then finally added the SDL library from the target. Which compiled.

    Now when I run the test code I still don't get the printf.

    the following is the script i use to make SDL

    ARCH=arm
    export TOOLCHAIN_DIR=/home/tim/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin
    export CROSS_COMPILE=arm-linux-gnueabihf-
    export CC=${TOOLCHAIN_DIR}/${CROSS_COMPILE}gcc
    export NM=${TOOLCHAIN_DIR}/${CROSS_COMPILE}nm
    export LD=${TOOLCHAIN_DIR}/${CROSS_COMPILE}ld
    export CXX=${TOOLCHAIN_DIR}/${CROSS_COMPILE}g++
    export RANLIB=${TOOLCHAIN_DIR}/${CROSS_COMPILE}ranlib
    export AR=${TOOLCHAIN_DIR}/${CROSS_COMPILE}ar
    export DESTDIR=/home/tim/ti-sdk-am335x-evm-06.00.00.00/targetNFS/
    
    SDL_CONFIG="/home/tim/ti-sdk-am335x-evm-06.00.00.00/targetNFS/usr/local/bin/sdl-config" ./configure --prefix=${DESTDIR}/usr/local/ --disable-video-qtopia --dis$
    make

    Make sense?

    the following is the code for my test app

    #include <SDL/SDL.h>
    #include "/home/tim/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/armv7ahf-vfp-neon-3.2-oe-linux-gnueabi/usr/include/stdio.h"
    
    int main( int argc, char* args[] )
    {
            fprintf(stderr,"START TEST ENTRY\n");
            SDL_ClearError();
    
            if (SDL_getenv("SDL_VIDEODRIVER") == NULL)
            {
                    printf("SDL_VIDEODRIVER IS NULL\n");
                    SDL_putenv("SDL_VIDEODRIVER=fbcon");
            }
            printf("SDL_VIDEODRIVER=%s\n",SDL_getenv("SDL_VIDEODRIVER"));
            printf("DISPLAY=%s\n",SDL_getenv("DISPLAY"));
            SDL_putenv("DISPLAY=0");
            printf("DISPLAY=%s\n",SDL_getenv("DISPLAY"));
            printf("SDL_FBDEV=%s\n",SDL_getenv("SDL_FBDEV"));
            SDL_putenv("SDL_FBDEV=/dev/fb0");
            printf("SDL_FBDEV=%s\n",SDL_getenv("SDL_FBDEV"));
    
            SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"),SDL_INIT_VIDEO);
    
            printf("Error: %s\n", SDL_GetError());
    
            if (SDL_Init( SDL_INIT_EVERYTHING ) != 0)
            {
                    printf("Error Initializing: %s\n", SDL_GetError());
                    exit(1);
            }
            printf("SDL Initialized");
            //Quit SDL
            SDL_Quit();
    
            return 0;
    }
    

    The following is the makefile for my test app

    INCLUDE = -nostdinc -I /home/tim/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/lib/gcc/arm-linux-gnueabihf/4.7.3/include/ -I /home/t$
    LIBS = -nostdinc -L /home/tim/ti-sdk-am335x-evm-06.00.00.0/targetNFS/usr/local/lib -l SDL
    
    CXX = arm-linux-gnueabihf-g++
    
    LINK = $(CXX) $(LINK_OPTS) -o $@ $^ $(LIBS)
    LINK_OPTS =
    
    .cpp.o :
            $(CXX) $(CXX_OPTS) -c -o $@ $< $(INCLUDE)
    
    all : test
    
    test :  test.o
            $(LINK)
    
    
    
    clean:
            rm -f test test.o
    

    finally, in the SDL_Init function i have added

    printf("INIT SDL Tim")

    Thoughts?

  • Forgot to mention the output of my test app

    START TEST ENTRY
    SDL_VIDEODRIVER IS NULL
    SDL_VIDEODRIVER=fbcon
    DISPLAY=(null)
    DISPLAY=0
    SDL_FBDEV=(null)
    SDL_FBDEV=/dev/fb0
    Error: No available video device
    Error Initializing: No available video device

    Note.. fbcon is the driver, it appears to be setup, but when i try to initialize with it it fails.

    I know the issues is with SDL because I have been able to write an app on its own that successfully writes to the framebuffer. and unfortunately re-writing a whole game to use the framebuffer directly isn't really in the cards.

    Thanks for your help. Tim