# HP Calculator Wiki

### Site Tools

34s:windows_7_64bit

# Differences

This shows you the differences between two versions of the page.

 34s:windows_7_64bit [2013/06/21 08:50]njdowrick Change to wp34s_asm.pl added 34s:windows_7_64bit [2014/05/04 13:37] (current)njdowrick [Building ''calc.bin'' (and the other .bin files) from source] Both sides previous revision Previous revision 2014/05/04 13:37 njdowrick [Building ''calc.bin'' (and the other .bin files) from source] 2013/06/21 08:50 njdowrick Change to wp34s_asm.pl added2012/07/22 14:27 njdowrick Completed page; formatting corrections.2012/07/21 16:03 njdowrick Formatting changes2012/07/21 15:59 njdowrick Syntax fixes and small text changes2012/07/21 15:46 njdowrick created 2014/05/04 13:37 njdowrick [Building ''calc.bin'' (and the other .bin files) from source] 2013/06/21 08:50 njdowrick Change to wp34s_asm.pl added2012/07/22 14:27 njdowrick Completed page; formatting corrections.2012/07/21 16:03 njdowrick Formatting changes2012/07/21 15:59 njdowrick Syntax fixes and small text changes2012/07/21 15:46 njdowrick created Line 1: Line 1: + =====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 ([[34s:​howto_build_emulator|HOWTO build the Windows emulator from source]] and [[34s:​howto_build_flash|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==== + + * Install an SVN client. I used Slik's subversion client downloaded from http://​www.sliksvn.com/​en/​download - the svn command line tool is all that is needed. Download and install this. + - 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. + - Open a command prompt (Start Menu - run - cmd) and chage to the directory that you have just created. + - 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. + + * Install Perl: the recommended package is http://​www.activestate.com/​activeperl/​downloads. + + * Install MS Visual C++. This is a download link to the latest 2010 version: http://​www.microsoft.com/​visualstudio/​en-us/​products/​2010-editions/​visual-cpp-express. + + * 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: + - Right-click on Computer in the Start menu; select Properties. + - Click on Advanced System Settings, followed by Environment Variables. + - 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. + - 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 + + <​code>​ + 34: char tmpname[ FILENAME_MAX ]; + ​ + + to + + <​code>​ + 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: + + <​code>​ + // 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 + + <​code>​ + my $preproc_fallback_dir = "";​ + ​ + + to + + <​code>​ + 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 [[34s:​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\''​. ​ + + * You can now transfer these files to your calculator in the normal way (e.g., using ''​MySamba''​). See [[34s:​howto_build_flash|HOWTO build a new flash load from source]] for details. + + 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!