Building WP-34S calc.bin from source - long post (sorry!)



#7

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)


#8

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.

#9

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


#10

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

Thanks!
bruce

#11

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.

#12

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34S] Unfortunate key damage with update to V3 :( svisvanatha 5 353 12-10-2013, 11:37 PM
Last Post: Les Bell
  WP-34S (Emulator Program Load/Save) Barry Mead 1 193 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  DIY HP 30b WP 34s serial flash/programming cable Richard Wahl 2 265 12-04-2013, 11:14 AM
Last Post: Barry Mead
  WP 34S/43 ?'s Richard Berler 3 290 11-10-2013, 02:27 AM
Last Post: Walter B
  My FrankenCulator (wp-34s) FORTIN Pascal 4 299 11-09-2013, 06:18 PM
Last Post: FORTIN Pascal
  WP 34S Owner's Handbook Walter B 5 441 11-09-2013, 05:34 PM
Last Post: Harald
  wp 34s overlay and programming. FORTIN Pascal 6 370 11-08-2013, 01:28 PM
Last Post: Nick_S
  HP Prime: Long integers (continued) Helge Gabert 2 202 11-07-2013, 11:24 AM
Last Post: Helge Gabert
  m.dy in display of WP-34S Harold A Climer 3 212 11-05-2013, 11:28 AM
Last Post: Andrew Nikitin
  WP 34s : An old problem coming back Miguel Toro 2 214 11-05-2013, 03:00 AM
Last Post: Marcus von Cube, Germany

Forum Jump: