Got ScummVM booting remotely on the Wiz via a terminal using the stock USB cable and have printf output (haven’t tried GDB yet). Continuing work on the loader, I’ll post again once it’s in a shape where I can start testing. Once it’s working, abstracting a more generic ELF-loader should be quite simple 🙂
Category: Uncategorized
After a small amount of testing/altering of the PS2 code, I began work on the GP2x-Wiz this week! On the debug front, I’ve gotten some help from the GP2x forums to get the Wiz to “pretend” to be a USB serial converter and I’ve successfully logged onto my Wiz via kermit. Booting ScummVM from remote via kermit isn’t quite working well yet, but it’s close. On the coding front, I’ve written a plugin linker script (I don’t think I’ll have to use a custom linker for the main engine like I did with the PS2 code). I’ve also decided to prototype the custom ELF loader for the Wiz using a Makefile instead of configure since I might be making significant changes to building. I have a Makefile now that successfully builds ScummVM for the Wiz with static plugins, and am working on the loader.
Work went much better after getting debugging facilities running on the PS2. I discovered the problem seemed to be in how the plugins were linked. After making changes to plugin.ld over the weekend, dynamic modules seem to work correctly, at least for the SCUMM and SKY engines, on the PS2. I’ll be doing a bit more testing, but things look good!
I’ve been hitting problem after problem getting good debugging support going on the PS2. Lesson learned, I’ve sent off e-mails to the porters for GP2X-Wiz and DS so I’ll be more prepared when it comes to how to print debug output, etc. on those systems 🙂
A summary of my work so far on ScummVM:
- After a bit more hassle than expected (which involved things like changing some toolchain installation scripts to use older svn revisions), I got the necessary toolchains/libraries to successfully cross-compile ScummVM for the PS2, DS, and GP2x-Wiz.
- I copied the psp-provider, elf32.h, and psploader code into the ps2 backend and began tweaking them for the PS2.
- The simplest of these “tweaks” was just changing references to “PSP” to “PS2” 🙂
- Tweaks so far also included removing psp-specific things from the ps2 loader (like code that I believe was there to ensure the psp didn’t suspend during a load) and in some cases replacing calls to code in the psp toolchain with calls to code in the ps2 toolchain (also being sure to replace “includes” that reference psp toolchain files with “includes” that reference ps2 toolchain files).
- I got the default ps2 cross-compiler ld linker script using ee-ld –verbose and tweaked it in a similar fashion to the way the default psp linker was tweaked for the psp plugins (Yotam provided the default psp linker) to generate plugin.ld (for linking together game engine plugins) and main_prog.ld (for linking together the main engine).
- I tested main_prog.ld with static plugins and found that ScummVM didn’t launch on the PS2 using the modified default ps2 linker. I saw in the PS2 Makefile that the default linker was switched out using -T with a “linkfile” in the PS2 toolchain. I remade main_prog.ld and plugin.ld by modifying this instead and it successfully launched again.
- I modified the main (in systemps2.cpp) to check if Dynamic Modules are enabled and, if so, to call PluginManager::instance().addPluginProvider(new PS2PluginProvider()).
- I have spent much of my time making tweaks to Makefile.ps2 (i.e. learning how different compiler flags/Defines affect the building, adding plugin variables, directing that the linker use my linker scripts, ensuring that the ps2loader is compiled and linked, etc.)
- I was getting linker errors concerning the GP-relative data section being over-filled when I enabled Dynamic Modules. I don’t see a good reason why this is the case but for now I have used -G0 flags in the Makefile to direct the cross-compiler not to put anything in the GP-relative section.
Got ScummVM on the PS2 building with dynamic modules enabled (plugins linking, too!) Now to start actually testing on the PS2.
Finally got the main engine linking without errors when dynamic modules are turned on for the PS2! Now to get everything else working… I think I’ll be working this weekend 🙂
I’ve been having trouble getting the modified “plugin.ld” script to work when compiling the PS2 port with dynamic modules enabled. I’m going to spend a couple of hours now reading a hundred pages of GNU linker documentation. Having a more thorough understanding of the linker should help since I don’t completely get what the default linker is doing 🙂
Some hard truths I learned during this, my first week of working on an open-source project:
- Everything will take more time than you predict it will 🙂
- This Summer will be a learning experience. I think things will go a lot smoother now that I’ve been humbled a bit and am more comfortable with taking some time to read documentation/ask for advice from other devs when I hit a bottleneck.
- Panera Bread has free wifi and tasty food 🙂
- Got MUCH more comfortable with linux (specifically Ubuntu).
- Got the PS2 port of ScummVM to compile and updated the wiki page concerning the process.
- Learned a bit about how GNU linker scripts work.
- Got comfortable merging trunk changes into my branch and communicating with the ScummVM porters (nice people!)
- Modified the PSP loader to work for PS2 and made special PS2 linker scripts (as of now, these are untested).
Spent today trying to get ScummVM builds compiled on my machine for all the platforms I’ll be working with this summer.
Having a fair bit of trouble with the ps2 build 🙂
Turns out tweaks made to the ps2toolchain over the past year make it incompatible with ScummVM’s ps2 code, but even when checking out a previous revision of the toolchain, the script that builds the toolchain updates everything to the current revision 😛
So I manually tweaked the scripts to check out an earlier revision, which would have worked out fine if ps2dev.org wasn’t down ALL day. Luckily my mentor had a link to another site hosting the same code and I was able to make some more tweaks to get the correct revision.
Now I just need some libraries (tremor specifically) and it should be built before bedtime.
Made some progress on getting the others built as well 🙂