Tuesday, June 17, 2008

port SDL to arm s3c2440

SDL is a multi-platform graphic interface.I move SDL programs can running on arm through just a few commands.

./configure --enable-release --target=arm-linux-gcc --host=arm-linux --disable-esd --disable-video-opengl

make

make install

copy your lib(something like libSDL-1.2.so.0.11.2) to arm's lib.
timer is one of sample program in SDL src which is /SDL/test
/* Test program to check the resolution of the SDL timer on the current
platform
*/

#include
#include

#include "SDL.h"

#define DEFAULT_RESOLUTION 1

static int ticks = 0;

static Uint32 SDLCALL ticktock(Uint32 interval)
{
++ticks;
return(interval);
}

static Uint32 SDLCALL callback(Uint32 interval, void *param)
{
printf("Timer %d : param = %d\n", interval, (int)(uintptr_t)param);
return interval;
}
int main(int argc, char *argv[])
{
int desired;
SDL_TimerID t1, t2, t3;

if ( SDL_Init(SDL_INIT_TIMER) < desired =" 0;" desired =" atoi(argv[1]);" desired ="="" desired =" DEFAULT_RESOLUTION;" desired =" %d" actual =" %f" t1 =" SDL_AddTimer(100," t2 =" SDL_AddTimer(50," t3 =" SDL_AddTimer(233," desired =" 1" actual =" 10.493179" param =" 2" param =" 2" param =" 1">

4 comments:

Gaurav said...

1. Can you explain the compilation process of the test program too? I am guessing all I need to do is link to this compiled library during compilation. Just want to doublecheck on that though.

2. Is it just the library that I need to copy over to ARM? Is there anything else that I need to copy too (include files etc?)

Thanks in advance!

Shawn the R0ck said...

Hey Gaurav,

1, I just used the cross compilers(arm-gcc) to get a ARM-runable binary execution file. Then copy it onto ARM.

2, Yes, all you need to copy is SDL libs.

Gaurav said...

Cool! Thanks for the help!

Anonymous said...

That is very fascinating, You are an excessively skilled blogger.
I have joined your rss feed and sit up for in the hunt for more of your
magnificent post. Also, I've shared your website in my social networks

Feel free to visit my blog post How to get free Minecraft