views:

406

answers:

4

I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues).

Does anyone know a good text, book or something to get some insight on porting libraries?

The only documentation this project offers on porting seems too dedicated to major OS's.

+1  A: 

Porting is very platform specific, so I don't think you will find much general literature on the subject.

Off the top of my mind, some things you may encounter:

  • endianness
  • word size
  • available libraries
  • compiler differences
  • linker differences (you've already seen that one)
  • peripheral hardware differences
  • ...
Thomas
+1  A: 

Look at other libraries that were ported over to the PSP. Doing diffs between a linux version of a library, and a PSP version should show you.

Also, try to get to know how POSIX compatible the PSP is, that will tell you how big the job of porting the library over is.

Jonathan Arkell
A: 

I did some more research and found this post at ps2dev forum:

The PSP is not a Unix system, and the pspsdk is not POSIX compliant. It's close in some places, but you can't expect to just take any code that compiles fine on a POSIX system and have it work. For example:

  • pspsdk uses newlib, which lacks some of glibc's features and headers.
  • libc is not linked by default, so typical autoconf tests will fail to build
  • autoconf knows nothing about the PSP
  • defining PSP_MODULE_INFO and running psp-fixup-imports on the executable are required, otherwise it won't run

You should look at all of the other libraries and programs that have been ported (in the psp and pspware repositories). All SDL libs use autoconf, for example.

I think this delivers more detail into what I was looking for, and also show the @[Jonathan Arkell] point of looking into libraries that already been ported.

Thanks for your replies.

mrlinx
+1  A: 

The PSP is not UNIX and is not POSIX compliant, however the open source toolchain is composed by gcc 4.3, bintutils 1.16.1 and newlib 1.16.

Most of the C library is already present and can compile most of your code. Lots of libraries have been ported just by invoking the configure script with the following arguments:

LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" ./configure --host psp --prefix=$(pwd)/../target/psp

However you might need to patch your configure and configure.ac scripts to know the host mips allegrex (the PSP cpu), to do that you search for a mips*--) line and clone it to the allegrex like:

mips*-*-*)
    noconfigdirs="$noconfigdirs target-libgloss"
    ;;
mipsallegrex*-*-*)
    noconfigdirs="$noconfigdirs target-libgloss"
    ;;

Then you run the make command and hope that newlib has all you need, if it doesn't then you just need to create alternatives to the functions you are missing.

Paulo Lopes