The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Building WP-34S calc.bin from source - long post (sorry!)
Message #1 Posted by Nigel J Dowrick on 13 July 2012, 3:01 p.m.

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)

      
Re: Building WP-34S calc.bin from source - long post (sorry!)
Message #2 Posted by Harald on 13 July 2012, 5:13 p.m.,
in response to message #1 by Nigel J Dowrick

Thanks for your post. I might give it another try on my windows 7 computer. I had no success on a windows XP machine and gave up eventually.

      
Re: Building WP-34S calc.bin from source - long post (sorry!)
Message #3 Posted by Dominic Richens on 13 July 2012, 10:25 p.m.,
in response to message #1 by Nigel J Dowrick

Being a wiki, all you have to do is register for an account and you can add you Windows 7 experiences to the pages themselves.

Dominic "vladhed" Richens

            
Re: Building WP-34S calc.bin from source - long post (sorry!)
Message #4 Posted by Bruce Bergman on 15 July 2012, 1:05 a.m.,
in response to message #3 by Dominic Richens

I've enabled write access for Nigel, so he should be good to go now.

Thanks! bruce

      
Re: Building WP-34S calc.bin from source - long post (sorry!)
Message #5 Posted by Marcus von Cube, Germany on 14 July 2012, 7:12 a.m.,
in response to message #1 by Nigel J Dowrick

Nigel, thanks for your post! I felt immediately at home. :-)

Your "preprocessor not found" problem should go away if you add another entry to PATH, pointing to the tools directory.

You should add to the Wiki or write an article in this forum so that your experience is not lost with the post going to the archives.

      
Re: Building WP-34S calc.bin from source - long post (sorry!)
Message #6 Posted by Paul Dale on 14 July 2012, 7:41 a.m.,
in response to message #1 by Nigel J Dowrick

Definitely add your experiences to the wiki.

We would consider including your changes in the firmware too -- conditionally compiled I suspect.

I like the early CASIO fraction marker too. I can live either way on the EEX/PI issue.

Pauli


[ Return to Index | Top of Index ]

Go back to the main exhibit hall