MINI HOWTO: Psion EMU under Wine/Linux

Sun Apr 8 20:31:21 BST 2001 by Tim Baverstock

I am able to run the Psion emulator under Wine/Linux, with certain limitations.

Initially, I started trying to follow the Epoc SDK for Linux HOWTO, but my free ISP had an automatic two hour cut-off, just preventing me from downloading CPPER5four.zip (36.5M). I asked Symbian whether they could split the file in two (since that part of their web site doesn't handle byte ranges [restartable http transfer]) but they instead generously sent me a free SDK CD. I then found a posting by Joachim Laier [copy here] about running the Psion Emulator under Wine, and decided to try getting that to work instead. Joachim did the real work - this document is mostly a tidy-up of his post, to make it easier for people like me who prefer step-by-step instructions.

You will need

Wine

I don't know the earliest compatible version, Joachim used 2000/08/01 with the options wine --dll gdi,gdi32=n,b epoc.exe, but this didn't work with the earlier version of Wine I already had (which may have had to do with my genuine W95 partition - I didn't try it with a blank c:\windows\system directory).

I downloaded and compiled Wine_0.0.20010326, which works happily for me. In addition to telling Wine about the directory where you put the emulator, you'll need to tell it that the emulator libraries should be loaded as native. I just set native,builtin,so as the default in my .wine/config.

I also effectively created the WINE directory C:\WINDOWS\SYSTEM in the directory which is my normal mount point for my DOS C: drive (but without actually mounting that partition beforehand), and was happy to discover that minimal C: drive sufficed.

The Psion SDK CD or CPPERsix and CPPERnine

With my sparkly new cable modem, I've been able to raid the Symbian site for the C++ EPOC Release 5 SDK files and it would seem that you should be able to get this working just from CPPER5six.zip (11M) and CPPER5nine.zip (21M), but I've not confirmed this except by inspection.

Method

  1. Find somewhere with at least 64M free. I'm using my favourite 760M partition.
  2. Tell Wine about it as a drive letter (I'm going to assume G: from here on, but you can use any drive).
  3. The emulator expects everything to be within the G:\EPOC32 directory.
  4. Copy /mnt/cdrom/EPOC32/Release/WINS to G:\EPOC32\Release\WINS (or get it from CPPER5nine.zip)
  5. Copy /mnt/cdrom/EPOC32/Data to G:\EPOC32\Data (.INI and .BMP files) (or get them from CPPER5six.zip)
  6. Make a new directory structure G:\WINS\C\System. (It will be populated with the default new files on the first run, as with a normal Psion.)
  7. Go and sit in the EPOC32/Release/WINS/Deb/ directory
  8. Run wine EPOC.EXE

Problems

Joachim reported these issues:

> - When the emu switches to powersave mode it does not wake up again
> - Sound and COM1 don't work
> - Word is missing
> - If the epoc directory c:\system\apps\shell exists the emulator does
> not start, wine complains about missing dlls (but they exist)
> - if an application is installed in c:\system\apps\ the emulator does
> not scan for installed applications, well, sometimes it does and the
> extras bar is useble but when you select an application it tells you
> 'Not found'.
> - The EMU seem to scan for Apps only at startup, i.e. does not
> recognise other apps which are copied onto the disc during execution

In addition to Joachim's removal of /EPOC32/WINS/C/System/Apps/Shell, I've found it necessary to remove .../C/System/(Apps/,Temp/,Data/,System.ini) before each run, otherwise the emulator can't find any programs to run, usually failing to find the program icons too. I think this is down to .INI files, but haven't spent much time to prove it to myself.

I think shell.ini appears if you fiddle with the control panel.

Word seems happy to run for me so long as I run something like Sketch beforehand.

I can't save back to files I've opened by clicking their icons: applications complain 'Unexpected end of file'. I can, however, save to other filenames or revert the file and exit.

The end

I've written this scruffy script to do the deletion and stuff, in case anyone really wants it.

Next

My next trick will be to try and get the GCC compiler working for the emulator, because my Psion transformer cable is dodgy. So far, it looks to be a fairly simple case of following Rudi König's Psion SDK on Linux Quick HOWTO [copy here] but using --target=i386-pe and ignoring ./configure's complaint that gdb doesn't know anything about i386-pe. Oh, and copying the WinS directories instead of the MARM directories.

I found while compiling that some things complained about `no arguments supplied to strdup/strstr macro' - this can be fixed (messily) by putting -D_HAVE_STRING_ARCH_strdup or strstr at the end of the CC= line and restarting the compile, and/or by cding into the binutils directory and typing make there before restarting it from the src/ directory. If you compile from within the binutils directory, change the makefile in there; if you compile from src, then add both -D_HAVE_STRING... flags to the CC=gcc line in that directory's makefile. I haven't really tried to pin this down carefully.

I've also fixed enough of the tk build problems and some later duplicate case statements in tcl that I could just run install from the src directory itself, and found myself with more than just the minimal toolset that Rudi's guide results in: as, c++, c++filt, dlltool, g++, gasp, gcc, ld, nm, objcopy, objdump, ranlib, size, strings, strip. Whether these turn out to be useful or not depends on whether I can get the wretched thing building properly. :)

Trying to compile a minimal C program for the emulator:

int main ( int argc, char** argv ) {
	;
}
works (duh) producing .o output with -c on the command line. Since I have some experience compiling with Windows, I'm still surprised I tried linking against the DLL files instead of the .LIB files.. :) Olaf Flebbe's EPOC SDK 4 Linux [copy here] document gives some specific compile and link lines, although currently I'm still having problems with missing symbols. I hope I just need to diddle with which .OBJ files represent a consistent runtime environment.

This:

./i386-pe-ld -s -e _E32Startup /mnt/hdb10/EPOC32/Release/WINS/Deb/EEXE.OBJ /mnt/hdb10/EPOC32/Release/WINS/Deb/ECRT0.OBJ /mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB foodle.o
gets me this:
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB(ESTLIB.DLL): warning: ignoring duplicate section `.text'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB(ESTLIB.DLL): warning: ignoring duplicate section `.text'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB(ESTLIB.DLL): warning: ignoring duplicate section `.idata$5'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.text'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.idata$5'
.
.
.
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.text'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.idata$5'
/mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL)(.idata$2+0x0): multiple definition of `idata$2'
/mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB(ESTLIB.DLL)(.idata$2+0x0): first defined here
/mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL)(.idata$2+0x0): multiple definition of `idata$5'
/mnt/hdb10/EPOC32/Release/WINS/Deb/ESTLIB.LIB(ESTLIB.DLL)(.idata$2+0x0): first defined here
./i386-pe-ld: warning: cannot find entry symbol _E32Startup; defaulting to 00400010
foodle.o(.text+0x4):foodle.c: undefined reference to `__main'
Leaving out ESTLIB does this:
.
.
.
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.text'
./i386-pe-ld: /mnt/hdb10/EPOC32/Release/WINS/Deb/EUSER.LIB(EUSER.DLL): warning: ignoring duplicate section `.idata$5'
./i386-pe-ld: warning: cannot find entry symbol _E32Startup; defaulting to 00400010
/mnt/hdb10/EPOC32/Release/WINS/Deb/ECRT0.OBJ: In function `?E32Main@@YAHXZ':
..\..\STDLIB\U:6: undefined reference to `?__crt0@@YAXAAHAAPAPAD1@Z'
..\..\STDLIB\U:8: undefined reference to `exit'
foodle.o(.text+0x4):foodle.c: undefined reference to `__main'
leaving out EUSER is even worse.

Since I had problems with the emulator toolchain, I decided to return to Rudi's instructions and try building the same do-nothing program for the Psion proper... which links quite happily thankyouverymuch. So either something's fairly wrong with the i386-pe target, or I'm not supposed to be linking with those libraries, or something else.

Of course, one thing that now drifts to mind is that C++ compilers have intentionally incompatible name-mangling systems, so you can't mix and match libraries between them. That kinda stymies using gcc against the VC-compiled emulator libraries.

Perhaps I should read up on the EPOC library interface and start implementing FREPOC? :)

I'll maybe write to Symbian about it, when I have a moment, and find out how benevolent they're feeling.