GP32 Problems with the Debian cross toolchain


unit3

Member
Joined
Aug 8, 2003
Messages
151
Location
Canada
Website
demoni.ca
I just installed it from packages, but it doesn't seem to perform as expected. configure scripts die with errors that the C compiler is broken, tons of include files in sys/, gnu/ and bits/ are missing, and if I manually modify the Makefiles to match the example projects that come with it, I end up getting compile errors like the following:

arm-thumb-elf-g++ -nostartfiles -Wall -Wl,-Map,gp-ffplay.map -T lnkscript crt0.o -o gp-ffplay.elf ffplay.o cmdutils.o -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont -lavcodec -lavformat -lSDL
crt0.o: In function `_GpInit':
crt0.o(.text+0x68): undefined reference to `asm_user_entry'
crt0.o: In function `_fw_init_for_dbg':
crt0.o(.text+0x194): undefined reference to `asm_user_entry_path'
crt0.o: In function `CopyZIData':
crt0.o(.text+0x24c): undefined reference to `HEAPSTART'
crt0.o(.text+0x250): undefined reference to `HEAPEND'
crt0.o(.text+0x254): undefined reference to `Main'
ffplay.o: In function `decode_thread':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1310: undefined reference to `rtsp_pause'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1312: undefined reference to `rtsp_resume'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1256: undefined reference to `rtsp_demux'
ffplay.o: In function `opt_rtp_tcp':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1602: undefined reference to `rtsp_default_protocols'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_core.o): In function `GpKernelInitialize':
gpos_core.o(.text+0x194): undefined reference to `GpPredefinedStackGet'
gpos_core.o(.text+0x2b4): undefined reference to `GpMain'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_user.o): In function `GpTimerSet':
gpos_user.o(.text+0x280): undefined reference to `GpPredefinedStackGet'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_user.o): In function `GpNetThreadAct':
gpos_user.o(.text+0x45c): undefined reference to `GpPredefinedStackGet'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(utils.o): In function `av_open_input_file':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/utils.c:333: undefined reference to `rtp_demux'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(utils.o): In function `av_close_input_file':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/utils.c:971: undefined reference to `rtp_demux'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(allformats.o): In function `av_register_all':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/allformats.c:30: undefined reference to `avcodec_register_all'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/allformats.c:74: undefined reference to `dv1394_init'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(jpeg.o): In function `jpeg_read':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/jpeg.c:104: undefined reference to `mjpeg_decoder'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(jpeg.o): In function `jpeg_write':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/jpeg.c:186: undefined reference to `mjpeg_encoder'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondSignal':
SDL_syscond.o(.text+0x1c): undefined reference to `pthread_cond_signal'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondBroadcast':
SDL_syscond.o(.text+0x74): undefined reference to `pthread_cond_broadcast'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWaitTimeout':
SDL_syscond.o(.text+0x15c): undefined reference to `pthread_cond_timedwait'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWait':
SDL_syscond.o(.text+0x1c0): undefined reference to `pthread_cond_wait'
collect2: ld returned 1 exit status
make: *** [gp-ffplay.elf] Error 1


Can someone help me work out the issues I'm having? How do I track down this crap? I noticed that someone was talking about making a cross toolchain with Gentoo, would that serve me better?
 
my tuto is nearly finished....i must translate it.
but first of all you should call the SDL lib before gpstdio

sorry don't have much time to look to your log.

i'll come back soon
 
Pekele posted on Aug 21 2003 said:
my tuto is nearly finished....i must translate it.
but first of all you should call the SDL lib before gpstdio

sorry don't have much time to look to your log.

i'll come back soon
Thanks, I look forward to seeing your tutorial.

Andway, rearranging the libs (avcodec, then avformat, then SDL, then the rest) seems to have made a little difference, but there's still some weird errors. I'll take it issue by issue, and leave the table open for comments by people:

Code:
crt0.o: In function `_GpInit':
crt0.o(.text+0x68): undefined reference to `asm_user_entry'
crt0.o: In function `_fw_init_for_dbg':
crt0.o(.text+0x194): undefined reference to `asm_user_entry_path'
crt0.o: In function `CopyZIData':
crt0.o(.text+0x24c): undefined reference to `HEAPSTART'
crt0.o(.text+0x250): undefined reference to `HEAPEND'
crt0.o(.text+0x254): undefined reference to `Main'

Ok, this crt0.s is from the empty-sdk project distributed with the debian cross-tools. I just copied it as-is, did I miss some documentation that tells you how this needs to be modified to actually work properly? I don't really get why it wouldn't just work out of the box.

Code:
ffplay.o: In function `decode_thread':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1310: undefined reference to `rtsp_pause'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1312: undefined reference to `rtsp_resume'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1256: undefined reference to `rtsp_demux'
ffplay.o: In function `opt_rtp_tcp':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/ffplay.c:1602: undefined reference to `rtsp_default_protocols'

It looks like RealMedia support didn't get compiled into my libraries. Who knows what the cause of that is, I'll have to try and track it down... there may be a configure option I missed or something.

Code:
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(utils.o): In function `av_open_input_file':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/utils.c:333: undefined reference to `rtp_demux'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(utils.o): In function `av_close_input_file':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/utils.c:971: undefined reference to `rtp_demux'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(allformats.o): In function `av_register_all':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/allformats.c:30: undefined reference to `avcodec_register_all'
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/allformats.c:74: undefined reference to `dv1394_init'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(jpeg.o): In function `jpeg_read':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/jpeg.c:104: undefined reference to `mjpeg_decoder'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libavformat.a(jpeg.o): In function `jpeg_write':
/home/unit3/devel/ffmpeg-cvs-2003-08-20/libavformat/jpeg.c:186: undefined reference to `mjpeg_encoder'

I compiled the libs without encoding support, without dv1394 support, etc. This is mostly because none of those options will do much of anything on the gamepark itself, and it should keep the size down and speed up. However, it looks like the libraries are somewhat hardcoded to want these values. I'll doublecheck my configure settings and try re-encoding them, but I'm really not looking forward to having all the encoding options and stuff in the static lib... it just seems far too bloaty for my taste.

Code:
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondSignal':
SDL_syscond.o(.text+0x1c): undefined reference to `pthread_cond_signal'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondBroadcast':
SDL_syscond.o(.text+0x74): undefined reference to `pthread_cond_broadcast'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWaitTimeout':
SDL_syscond.o(.text+0x15c): undefined reference to `pthread_cond_timedwait'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWait':
SDL_syscond.o(.text+0x1c0): undefined reference to `pthread_cond_wait'

So.. it looks like pthreads aren't working when I compiled this... I'm not sure where the error is coming from, but I think I'll just wait until the new SDL port is out, and attempt to use it instead. Maybe this issue will magically disappear! :rolleyes:

Code:
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_core.o): In function `GpKernelInitialize':
gpos_core.o(.text+0x194): undefined reference to `GpPredefinedStackGet'
gpos_core.o(.text+0x2b4): undefined reference to `GpMain'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_user.o): In function `GpTimerSet':
gpos_user.o(.text+0x280): undefined reference to `GpPredefinedStackGet'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libgpos.a(gpos_user.o): In function `GpNetThreadAct':
gpos_user.o(.text+0x45c): undefined reference to `GpPredefinedStackGet'
collect2: ld returned 1 exit status

Ok, this baffles me. Why would the gamepark libraries be missing calls that they need? Am I missing a library that I should be linking too? Here's the compile statement:

Code:
arm-thumb-elf-g++ -nostartfiles -Wall -Wl,-Map,gp-ffplay.map -T lnkscript crt0.o -DSDL_USE_PTHREADS -DNO_SIGNAL_H -DENABLE_GP32 -o gp-ffplay.elf ffplay.o cmdutils.o -lavcodec -lavformat -lSDL -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont
 
Last edited by a moderator:
no gpstart.c ???

Link line no contains gpstart.o.

You need this source.

Code:
#include <gpdef.h>
#include <gpstdlib.h>
#include <gpfont.h>
#include <gpfont_port.h>
#include <gpfontres.dat>

#include <initval_port.h>

#ifdef USE_GP_MEM
#include <gpmem.h>
#endif

unsigned int HEAPSTART;
unsigned int HEAPEND;

void InitializeFont (void);
extern void GpKeyPollingTimeSet (int loop_cnt);

extern void GpMain(void *arg);

void Main (int arg_len, char * arg_v)
   {

   GM_HEAP_DEF gm_heap_def;

 _gp_sdk_init();

   // keyboard polling count setting
   GpKeyPollingTimeSet (KEYPOLLING_NUM);


#ifdef USE_GP_MEM
   gm_heap_def.heapstart = (void*)(HEAPSTART);
   gm_heap_def.heapend = (void *)(HEAPEND & ~3);
   gm_heap_init (&gm_heap_def);

   gp_mem_func.malloc = gm_malloc;
   gp_mem_func.zimalloc = gm_zi_malloc;
   gp_mem_func.calloc = gm_calloc;
   gp_mem_func.free = gm_free;
   gp_mem_func.availablemem = gm_availablesize;
   gp_mem_func.malloc_ex = gm_malloc_ex;
   gp_mem_func.free_ex = gm_free_ex;
   gp_mem_func.make_mem_partition = gm_make_mem_part;

   gp_str_func.memset = gm_memset;
   gp_str_func.memcpy = gm_memcpy;
   gp_str_func.strcpy = gm_strcpy;
   gp_str_func.strncpy = gm_strncpy;
   gp_str_func.strcat = gm_strcat;
   gp_str_func.strncat = gm_strncat;
   gp_str_func.gpstrlen = gm_lstrlen;
   gp_str_func.sprintf = gm_sprintf;
   gp_str_func.uppercase = gm_uppercase;
   gp_str_func.lowercase = gm_lowercase;
   gp_str_func.compare = gm_compare;
   gp_str_func.trim_right = gm_trim_right;
#endif /*USE_GP_MEM*/

        //Font initialize
   InitializeFont ();

  GpKernelInitialize ();
   GpKernelStart ();

   GpAppExit ();
   while (1) {};
   }

void InitializeFont (void)
   {
   BGFONTINFO mInfo;
   mInfo.kor_w = KORFONT_W;
   mInfo.kor_h = KORFONT_H;
   mInfo.eng_w = ENGFONT_W;
   mInfo.eng_h = ENGFONT_H;
   mInfo.chargap = FONT_CHARGAP;
   mInfo.linegap = FONT_LINEGAP;
   GpFontInit (&mInfo);
   GpFontResSet ((unsigned char*)fontresKor, (unsigned char*)fontresEng);
   }

int GpPredefinedStackGet (H_THREAD th)
   {
   switch (th)
      {
      case H_THREAD_GPMAIN:
         return GPMAIN_STACK_SIZE;
      case H_THREAD_NET:
         return NET_STACK_SIZE;
      case H_THREAD_TMR0:
      case H_THREAD_TMR1:
      case H_THREAD_TMR2:
      case H_THREAD_TMR3:
         return USER_STACK_SIZE;
      default:
         return 0;
      }
   }
 
chui posted on Aug 21 2003 said:
no gpstart.c ???

Link line no contains gpstart.o.
Ahhh, you're right. Now I've got gpstart, gp_redefines and gpmain from the empty-sdk project included, here's the errors I'm getting:

Code:
arm-thumb-elf-g++ -nostartfiles -Wall,-Wl,-Map,gp-ffplay.map -T lnkscript crt0.o -DSDL_USE_PTHREADS -DNO_SIGNAL_H -DENABLE_GP32 -o gp-ffplay.elf ffplay.o cmdutils.o gpstart.o gpmain.o gp_redefines.o -lavcodec -lavformat -lSDL -lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont

crt0.o: In function `_GpInit':
crt0.o(.text+0x68): undefined reference to `asm_user_entry'
crt0.o: In function `_fw_init_for_dbg':
crt0.o(.text+0x194): undefined reference to `asm_user_entry_path'
A few of the crt0.o errors went away, but I've still got these two. Any ideas what I'm missing?

Update: According to the ffmpeg guys, there're known problems with compiling w/o net and encoder support. Apparently this should be fixed this weekend, so I just have to sit back, relax, and wait for the next release (0.4.7, I think). That should fix all the little linking problems I'm seeing in the actual libs.

Code:
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondSignal':
SDL_syscond.o(.text+0x1c): undefined reference to `pthread_cond_signal'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondBroadcast':
SDL_syscond.o(.text+0x74): undefined reference to `pthread_cond_broadcast'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWaitTimeout':
SDL_syscond.o(.text+0x15c): undefined reference to `pthread_cond_timedwait'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWait':
SDL_syscond.o(.text+0x1c0): undefined reference to `pthread_cond_wait'
collect2: ld returned 1 exit status
make: *** [gp-ffplay.elf] Error 1
And then we have our pthread errors with SDL. Any ideas, chui? How should I be compiling this to avoid these errors?

I've tried adding -lpthread, but the compiler complains that it can't find the pthread library. I can't tell from the SDL makefile how I should be linking things differently. :(

Maybe you can send me a copy of the updated SDL you've been working on, I lost the previous e-mail you sent me.
 
Last edited by a moderator:
Heya Chui,

Grabbed beta2, it looks great! However, I'm still getting the same problems with SDL-lib:

Code:
arm-thumb-elf-g++ -nostartfiles -Wall,-Wl,-Map,gp-ffplay.map -T lnkscript crt0.o -DSDL_USE_PTHREADS -DNO_SIGNAL_H -DENABLE_GP32 -o gp-ffplay.elf ffplay.o cmdutils.o gpstart.o gpmain.o gp_redefines.o -lavcodec -lavformat -lgpos -lgpsound -lgpmem -lgpgraphic -lgpfont -lSDL_mixer -lSDL_image -lSDL -lpng -ljpeg -lz -lgpstdlib -lm -lgpstdio

--snip--

/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondSignal':
SDL_syscond.o(.text+0x1c): undefined reference to `pthread_cond_signal'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondBroadcast':
SDL_syscond.o(.text+0x74): undefined reference to `pthread_cond_broadcast'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWaitTimeout':
SDL_syscond.o(.text+0x15c): undefined reference to `pthread_cond_timedwait'
/usr/lib/gcc-lib/arm-thumb-elf/3.2.1/../../../../arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWait':
SDL_syscond.o(.text+0x1c0): undefined reference to `pthread_cond_wait'
collect2: ld returned 1 exit status
make: *** [gp-ffplay.elf] Error 1

The totally weird thing is that your sdltest compiles and runs fine with my setup, so obviously I'm not doing something right in my other linking process. You can see the command it's calling, any ideas why it's not working?

UPDATE:
I copied your makefile over directly from the sdltest project, and modified it slightly so that it would do the compile for me... and I'm still getting the same errors! So, does any of your code actually use the SDL_Cond* functions? Maybe there's some problems with it (like, the GP32 doesn't have a libpthread!), and you just haven't noticed it yet since you haven't tried to use those functions. :)

Let me know what you think!
 
¿?¿? Use gcc instead g++ for linking.

My c++ Makefile (used at my VisualBoyAdvanced project):


Code:
CC = arm-thumb-elf-gcc
CCPLUS = arm-thumb-elf-g++
AS = arm-thumb-elf-as
LD = arm-thumb-elf-gcc

.SFILES =       crt0.s

.CFILES =       gpstart.c

.CPPFILES =     gpmain.cpp src/gb/GB.cpp src/gb/gbCheats.cpp \
                       src/gb/gbGfx.cpp src/gb/gbGlobals.cpp src/gb/gbMemory.cpp \
                       src/gb/gbPrinter.cpp src/gb/gbSGB.cpp src/gb/gbSound.cpp \
                       src/gb/gbDis.cpp src/2xSaI.cpp src/tvmode.cpp src/pixel.cpp \
                       src/motionblur.cpp src/admame.cpp src/simple2x.cpp \
                       src/bilinear.cpp src/interframe.cpp src/Font.cpp \
                       src/unzip.cpp src/Cheats.cpp src/EEprom.cpp \
                       src/Flash.cpp src/GBA.cpp src/Gfx.cpp src/Globals.cpp \
                       src/Mode0.cpp src/Mode1.cpp src/Mode2.cpp \
                       src/Mode3.cpp src/Mode4.cpp src/Mode5.cpp \
                       src/Sound.cpp src/Sram.cpp src/Util.cpp src/armdis.cpp \
                       src/bios.cpp src/elf.cpp src/expr.cpp src/expr-lex.cpp \
                       src/exprNode.cpp src/debugger.cpp src/remote.cpp \
                       src/RTC.cpp src/agbprint.cpp src/scanline.cpp src/getopt.c \
                       src/getopt1.c src/memgzio.c

.OFILES =       $(.SFILES:.s=.o) $(.CFILES:.c=.o) $(.CPPFILES:.cpp=.o)

CFLAGS  =       -Iinclude-gp32 -Isrc -Isrc/gb -I/usr/arm-thumb-elf/include/SDL \
                       -I. -O2 -mtune=arm920 \
                       -DGFXST \
                       -Wuninitialized -Wno-import -Wchar-subscripts -Wformat\ 
                       -Wimplicit-int -Wimplicit-function-declaration \
                       -Wmultichar -Wreturn-type -Wswitch -Wunused -Wuninitialized
                       -Wsign-compare -msoft-float -mthumb-interwork \
                       -DYYTEXT_POINTER=1 -DHAVE_LIBPNG=1 \
                       -DHAVE_LIBPTHREAD=1 -DHAVE_LIBZ=1 -DSTDC_HEADERS=1 \
                       -DHAVE_MALLOC_H=1 -DHAVE_STRINGS_H=1 \
                       -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 \
                       -DHAVE_NETINET_IN_H=1 -D_REENTRANT -DSDL \
                       -DBKPT_SUPPORT -fno-exceptions -DC_CORE

%.o: %.cpp
        $(CCPLUS) $(CFLAGS) -c $< -o $@

LDFLAGS =       -L/usr/arm-thumb-elf/lib -T$(LDSCRIPT) user_init.o -nostartfiles \
                       -lgpos -lgpsound -lgpmem -lgpgraphic -lgpfont -lSDL_image -lSDL \
                       -ljpeg -lz -lm -lgpstdlib -lgpstdio -lgpstdlib -lstdc++

DEPENDFILE      =       Makedepend
MAPFILE         =       sdlgba.map
TARGET_ELF      =       sdlgba.elf
TARGET_BIN      =       sdlgba.gxb
TARGET_FXE      =       sdlgba.fxe
LDSCRIPT        =       lnkscript


$(TARGET_FXE): $(TARGET_BIN)
        b2fxec $< $@

$(TARGET_BIN): $(TARGET_ELF)
        arm-thumb-elf-objcopy -O binary $< $@

$(TARGET_ELF): $(.OFILES) Makefile $(DEPENDFILE)
        $(LD) -o $@ $(.OFILES) $(LDFLAGS)

.PHONY: all clean depend

all:    clean depend $(TARGET_BIN)

tags:   $(DEPENDFILE)
        ctags -e *.c *.s *.h *.S

clean:
        -rm -f $(.OFILES) $(DEPENDFILE) $(MAPFILE) $(TARGET_ELF) $(TARGET_BIN) TAGS

send: $(TARGET_FXE)
        gplink -c -x put $(TARGET_FXE) /GPMM

depend:
        $(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)

$(DEPENDFILE):
        $(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)

include $(DEPENDFILE)
 
chui posted on Aug 25 2003 said:
¿?¿? Use gcc instead g++ for linking.
I've been using gcc since I switched over to a Makefile based on yours from sdltest, and using g++ or gcc doesn't seem to make any difference.

The problem seems to be that SDL was linked to libpthread, but I don't *have* a libpthread in my dev kit. Where did you get yours from?

Anyway, here's my current Makefile:

Code:
CC = arm-thumb-elf-gcc
AS = arm-thumb-elf-as
LD = arm-thumb-elf-gcc
OBJCOPY = arm-thumb-elf-objcopy

.SFILES =       crt0.s

.CFILES =       gpstart.c ffplay.c cmdutils.c

.OFILES =       $(.SFILES:.s=.o) $(.CFILES:.c=.o)

CFLAGS  =       -Ilibavcodec/ -Ilibavformat/ -I. -O2 -mtune=arm920 -mcpu=arm9 \
                        -DGFXST -DGP32\
                        -Wuninitialized -Wno-import -Wchar-subscripts -Wformat -Wimplicit-int \
                        -Wimplicit-function-declaration \
                        -Wmultichar -Wreturn-type -Wswitch -Wunused -Wuninitialized -Wsign-compare \
                        -msoft-float -mthumb-interwork

LDFLAGS =       -L/usr/arm-thumb-elf/lib -T$(LDSCRIPT) user_init.o -nostartfiles \
                -lavcodec -lavformat -lgpos -lgpsound -lgpmem -lgpgraphic \
                -lgpfont -lSDL_mixer -lSDL_image -lSDL -lpng -ljpeg -lz \
                -lgpstdlib -lm -lgpstdio -lgpstdlib

DEPENDFILE      =       Makedepend
MAPFILE         =       ffplay.map
TARGET_ELF      =       ffplay.elf
TARGET_BIN      =       ffplay.gxb
TARGET_FXE      =       ffplay.fxe
LDSCRIPT        =       lnkscript


$(TARGET_FXE): $(TARGET_BIN)
        b2fxec $< $@

$(TARGET_BIN): $(TARGET_ELF)
        $(OBJCOPY) -O binary $< $@

$(TARGET_ELF): $(.OFILES) $(DEPENDFILE)
        $(LD) -o $@ $(.OFILES) $(LDFLAGS)

.PHONY: all clean depend

all:    clean depend $(TARGET_BIN)

tags:   $(DEPENDFILE)
        ctags -e *.c *.s *.h *.S

clean:
        -rm -f $(.OFILES) $(DEPENDFILE) $(MAPFILE) $(TARGET_ELF) $(TARGET_BIN) T
AGS

send: $(TARGET_FXE)
        gplink -c -x put $(TARGET_FXE) /GPMM

depend:
        $(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)

$(DEPENDFILE):
        $(CC) $(CFLAGS) -M $(.CFILES) > $(DEPENDFILE)

include $(DEPENDFILE)

and here's the current linking errors I'm getting with the newest version of ffmpeg:

Code:
arm-thumb-elf-gcc -o ffplay.elf crt0.o gpstart.o ffplay.o cmdutils.o -L/usr/arm-thumb-elf/lib -Tlnkscript user_init.o -nostartfiles -lavcodec -lavformat -lgpos -lgpsound -lgpmem -lgpgraphic -lgpfont -lSDL_mixer -lSDL_image -lSDL -lpng -ljpeg -lz -lgpstdlib -lm -lgpstdio -lgpstdlib
/usr/arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondSignal':
SDL_syscond.o(.text+0x1c): undefined reference to `pthread_cond_signal'
/usr/arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondBroadcast':
SDL_syscond.o(.text+0x74): undefined reference to `pthread_cond_broadcast'
/usr/arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWaitTimeout':
SDL_syscond.o(.text+0x15c): undefined reference to `pthread_cond_timedwait'
/usr/arm-thumb-elf/lib/libSDL.a(SDL_syscond.o): In function `SDL_CondWait':
SDL_syscond.o(.text+0x1c0): undefined reference to `pthread_cond_wait'
collect2: ld returned 1 exit status
make: *** [ffplay.elf] Error 1
 
Last edited by a moderator:
i don't know how i can help!

Do you can disable threads at mplayer?
 
chui posted on Aug 25 2003 said:
i don't know how i can help!

Do you can disable threads at mplayer?
I'm not building mplayer, just ffplay (a much more compact playing app that comes with FFMPEG). In any case, it really isn't using threads, just making calls to SDL... it's SDL that's complaining about thread issues.

The file that contains the problems is in SDL-1.2.5/src/thread/gp32/SDL_syscond.c. However, the files in SDL-1.2.5/src/thread/generic/ don't contain any reference to pthreads...

I tried taking out the -DSDL_USE_PTHREADS, but then I get a whole bunch of IPC errors. I think the real issue here is that the GP32 doesn't really have an OS, and it certainly doesn't support multiple processes and threads. I guess I'll just have to try and remove all thread references from FFPlay.

If you have any other ideas, let me know.
 
Last edited by a moderator:
UPDATE:

Chui, I recompiled your latest SDL, but I changed the makefile slightly: I changed all entries that said src/thread/gp32 to src/thread/generic, and now all my linking errors are gone! The program compiles with 0 errors!

It makes sense, since the GP32 doesn't have multiple processes, and so can't do process-threads!

I'm pretty excited, I'll be testing ffplay tonight, and posting it tomorrow if it works. :D
 
Back
Top