# HP Calculator Wiki

### Site Tools

34s:windows_7_64bit

## Building the WP-34s firmware on a computer running 64-bit Windows 7

This file details my recent (July 2012) experiences building the calc.bin file for my WP-34S from source, on a computer running 64-bit Windows 7. I found that when following the instructions in the earlier wikis on this site (HOWTO build the Windows emulator from source and HOWTO build a new flash load (calc.bin) from source) there were a number of things that didn't work correctly for me, probably due to changes in the project since those documents 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.

What follows is completely based on those earlier wikis. I have tried to give a complete set of instructions here, but readers should certainly consult the other wikis as well.

### Building the Windows emulator

1. Decide where you are going to install the WP-34s project code. I created a directory called c:\users\nd\wp34s; you can choose something different, but its name should include no spaces.
2. Open a command prompt (Start Menu - run - cmd) and chage to the directory that you have just created.
3. Run the command svn co https://wp34s.svn.sourceforge.net/svnroot/wp34s wp34s. This will download the WP-34s project files and install them in the directory wp34s in your current folder. This may take a while.
• Next, you need to install the GNU tools - commands which exist on UNIX systems and are needed for some of the above software to work properly. These can be obtained from http://www.mingw.org . There are two parts to this software: MSYS (short for minimal system) is the part needed here, but MINGW provides compilers and tools needed later for building the firmware for the calculator. I downloaded a file called mingw-get-inst-20120426.exe which was able to download and install both parts of the software for me. If you are intending to build calculator firmware, you should certainly install both parts. My installation directory was C:\MINGW; yours may, of course, be different.
• However, as it stands, the MINGW software will not work with the other software. To allow other software to find the tools and programs that you have just installed, their paths need to be added to the Windows path variable. The steps to follow are:
1. Right-click on Computer in the Start menu; select Properties.
2. Click on Advanced System Settings, followed by Environment Variables.
3. Scroll down and select the Path system variable, and click on Edit. You now need to add to the list of directories the locations of the MSYS tools and (if you have installed them) the GNU compiler tools. For me, this involved adding the string c:\mingw\bin;c:\mingw\msys\1.0\bin; to the start of the list of paths.
4. Click “OK” several times, and then restart any command prompt window that you have open. The GNU tools should now be available: you can check this by typing (for example) touch<Enter> and checking that you get an error message (touch - missing file operand) from the touch program.
• Finally, I found it necessary to change two of the source files in order to get the correct version number to appear in the emulator program. First, the code in the file wp34s\trunk\create_revision.c creates and deletes a temporary file. I found that, for some reason, the name being generated for the temporary file was invalid. To fix this problem, in the file create_revision.c use a text editor (e.g., Notepad) to change
34:	char tmpname[ FILENAME_MAX ];

to

34: 	char tmpname[ FILENAME_MAX ] = "rev_tmp.txt";

and comment out lines 39-42 by adding double forward slashes to the start of each line, like this:

//	if (tmpnam( tmpname ) == NULL) {
//		perror("Unable to create tempory file name");
//		return 1;
//	}
• Second, I also had to change one line in the file wp34s\trunk\wp34s_asm.pl. I changed line 186 from
my $preproc_fallback_dir = ""; to my$preproc_fallback_dir = "C:/Users/nd/wp34s/trunk/tools/";

where the long path name is simply the full address of the tools folder on my system. Change this to whatever is correct on your system.

• All should now be ready to build the Windows WP-34s emulator without errors! I used the GUI method detailed in howto_build_emulator, paragraph 2 of the section Building a Windows binary. It should work without a hitch.

### Building ''calc.bin'' (and the other .bin files) from source

So: you've successfully compiled the Windows emulator. However, since you can download this from the svn repository anyway you are probably intending to do more than this. You almost certainly want to explore the source code and perhaps change it, and ultimately to upload such changes to your calculator.

This section deals with producing the files calc.bin, calc_full.bin, and so on.

• Make sure that you have carried out everything needed to build the Windows emulator without errors, and that you have installed both parts of the MINGW software mentioned above.
• The next thing to install is a cross-compiler that produces code for the processor in the calculator. This is provided by the Yagarto GNU ARM toolchain, downloadable from www.yagarto.de. Download and install this software.
• One thing remains to be done. Add the tools directory to the Windows path environment variable. On my machine the full path to this directory is C:\users\nd\wp34s\wp34s\trunk\tools; use the correct folder for your machine. Without this path entry the assembler for the WP-34s cannot find its preprocessor.
• Now, you are ready to build the calculator firmware. Open a Command Prompt window (Start → Run → cmd) and change to the wp34s top level directory. This should contain a file called flash.cmd. Run this file by typing flash at the command prompt command line. Everything should now work. The files calc.bin, calc_full.bin, etc., should all be built and should appear in wp34s\trunk\realbuild\.

Having done all of this you are free to try making changes to the calculator source code. You should try out any changes on the emulator first, so that you can debug them (and to avoid draining your calculator batteries!). Good luck!