I recently decided that the time had come to build the calc.bin file for my WP-34S from source, on my own computer. Partly I wanted the satisfaction of doing it myself, and partly I wanted to try making a few (very small) changes to the way in which the calculator operates, now that the code seems to have reached almost its final form. There are some very helpful instructions available at wiki4hp. I used these, but I found that there were a number of things that didn't work correctly, probably due to changes in the project since that document was written. So I'm writing up what I did in case there is anyone else who wants to try this but has the same problems that I had in getting it to work.
For reference: my computer is running 64-bit Windows 7.
My first target was to build the windows emulator successfully. I followed the instructions at wiki4hp - building the emulator, installing svn, Perl, and MS Visual C++. I then ran svn as described to checkout a copy of the latest project files. This worked perfectly.
I then tried the GUI method of building the emulator (step 2 in the above document). This worked, but there were two minor problems. First, I got an error message when I compiled the program about the non-existence of "touch". Second, when I ran the emulator and checked the code version number it was blank. This seemed to be associated with an error message saying "Access denied", although the details were obscure.
"touch" is a standard Unix utility program. I'm ashamed to admit that I had not yet installed a set of these programs on my laptop, but this was easy to fix. On the next page of instructions (how to build flash) was a link to MinGW, which provides these tools along with the GNU compiler. Having installed them, I needed to add the path for the tools to the Windows PATH environment variable.
In the old days this used to involve editing autoexec.bat (or maybe config.sys - I can't remember!). Under Windows 7 PATH can be edited by right-clicking on Computer in the Start menu, choosing properties, and clicking on Advanced Settings and then on Environment Variables. I added c:\mingw\msys\1.0\bin to the path (msys in this path name stands for "minimal system", which includes a collection of standard UNIX utilities that work under Windows.) On opening a command prompt I found that "touch" now worked.
The problem with the version number was a little mysterious. A file called create_revision.c (in wp34s\trunk) contains code that deals with the version number. As part of this process it needs to write to a temporary file, make use of it, and then delete it. The problem was that the random names being chosen for the temporary file all started with "\s", and so the file could not be created (hence the "Access denied" error message). I couldn't see why this was happening so I edited create_revision.c to hard-wire in an acceptable file name:
Change
34: char tmpname[ 20 ];
to
34: char tmpname[ 20 ] = "rev_tmp.txt";and comment out the lines
// if (tmpnam( tmpname ) == NULL) {
// perror("Unable to create tempory file name");
// return 1;
// }
that follow shortly afterwards.
After these two changes the emulator compiled perfectly!
Now for the real challenge: building the calc*.bin files to be flashed to the calculator. The page how to build flash gives instructions for this. Having already installed MinGW (and MSYS) it only remained to install the ARM cross-compiler, called Yagarto. This went without a hitch. The instructions then told me to run "win-build-arm.cmd".
This file is only present in the 2.2 branch of the wp-34s code. The modern replacement is "flash.cmd". However, this gave errors. Specifically, the linker ld.exe wasn't being found. This, along with other compiler tools, are provided by MinGW but in a different folder from the utilities. I added the folder c:\mingw\bin to PATH and this solved the problem.
But it still wasn't working! I kept on getting an error about the file wp34s_asm.pl not being able to find the preprocessor (called wp34s_pp.pl) although this was obviously where it should be. I fixed this by editing the file wp34s_asm.pl:
I changed
185:my $preproc_fallback_dir = "";
to
185:my $preproc_fallback_dir="C:/Users/nd/wp34s/wp34s/trunk/tools/";
this being the folder where the preprocessor lives on my system. (I never did work out the cause of the problem.)
Everything now worked. Running flash.cmd built (eventually!) a complete set of files that could be successfully flashed to the calculator.
Why do all of this? Apart from the fun, I wanted to make a few changes to the calculator. I have (at last!) implemented the One True Fraction separator _| (as used on early Casio machines) as a replacement for the standard WP-34S symbol. I have made pressing EEX with no command line enter PI rather than entering 1E000 (another early Casio feature which I miss on modern machines.) Finally, I've made 3..4 enter 3/4, rather than 3 0/4 (as on the HP-32SII). The source code is impressively well-commented, although I feel like a mouse in a cathedral as I wander through the files! If you really like the WP-34S you should expose yourself to the source code. You will feel awe.
Nigel (UK)