The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

Wp34s Flash backup/restore
Message #1 Posted by Cristian Arezzini on 6 June 2011, 1:34 a.m.

Hello, I'm trying to understand how to backup/restore program data so that I don't loose my programs when I upgrade the firmware. Here's what I'm doing:

  1. On+B+B to backup to Flash;
  2. On+S+S to enter Samba;
  3. In Samba, save from 0x11F800, 0x800 bytes, to a file on the PC;
  4. Update the firmware as usual;
  5. send the saved backup file to the calc, from address 0x11F800.
This worked partially, in that I had two programs on my calculator, and now I only have one. Could it be because in memory, the program labeled "A" came after the program labeled "B"? Or did I do something wrong?

Also, I have a suggestion... When you press On+S, it writes "SAM-BA? Boot" on the display, showing what you're going to do if you press S again. This is great. Instead, when you press On+B to backup (or On+R to restore), you get no message at all; the only message you get is "Cancelled" if you don't press B (or R) again. It would be really nice if it could show, after the first press, i.e. "Backup?" or "Restore?" and then, if the operation is carried on, "Backup OK" or "Restore OK", or "Cancelled" otherwise. Does this make sense? :)

Cristian

      
Re: Wp34s Flash backup/restore
Message #2 Posted by Marcus von Cube, Germany on 6 June 2011, 2:52 a.m.,
in response to message #1 by Cristian Arezzini

Cristian, the docs aren't up to date. Go to the FLASH.TXT file for the correct commands. Here is the contents again:

Commands to handle the flash memory on the real calculator
==========================================================

Hold down ON (EXIT) and press one of the following keys:

STO - Backup: This creates a copy of the RAM in flash memory.

RCL - Restore: This restores a previously created backup.

S - SAM-BA: Clears the GPNVM1 bit and turns the calculator off. S is on the '6' key. ATTENTION: You can now only boot into SAM-BA mode! Without the SAM-BA software and the cable, you're lost!

These ON key combinations have to be pressed twice in a row without releasing the ON key to be executed.

Do an ON+STO before you want to flash a new release! After flashing, your backup should still be in place if you didn't accidentally press the ERASE button on the cable but used ON+S instead to get into SAM-BA boot mode.

There are additional commands in the I/O catalogue (f+STO):

PSTO n Store program in region n. n is 0 to 3. A region is a block of flash memory that can hold a copy of the user program area. Alphanumeric labels in flash can be called with XEQ. This allows creation of libraries. Use the new label browser (f+RCL) to see the labels. Region 0 is the same region that is stored with the backup.

PRCL n Restore region n to the program area where data can be edited.

P<> n Swap the current program with the contents of region n.

LOAD Executes ON+RCL. This is available on the emulator, too.

SAVE Executes ON+STO. See above.

RRCL Recall the register data only from a previously created backup.

SRCL Recall the setup data only from a previously created backup.

You can recall a group of registers from the backup with the command R-COPY from the program catalogue. Just give it a negative value in X and the source block will be fetched from flash instead of RAM.

Single registers in flash can be read with RCF and its arithmetic variants (RCF+, etc.)

Mapping from memory regions to emulator state files ===================================================

Region Flash address state file Remark --------------------------------------------------------------------- unnamed 0x11fc00 wp34s-R.dat Registers and state of the backup 0 0x11f800 wp34s-0.dat User program of the backup 1 0x11f400 wp34s-1.dat Generic user Program region 2 0x11f000 wp34s-2.dat ditto 3 0x11ec00 wp34s-3.dat ditto RAM wp34s.dat Emulator image of the RAM area

wp34s.dat is only written on exit of the emulator software. wp34s-?.dat is written each time a flash command is executed. All files are only read into memory on emulator startup. If we find enough free space in flash we may increase the number of regions.

How to transfer data between the calculator and your PC =======================================================

The whole RAM is saved to address 0x11f800 (relative address 0x1f800) with ON+STO. This can be copied to your PC or loaded from it.

1. From calculator to PC

a) Do an ON+STO, then ON+S, then RESET with the cable connected. b) Press ON once and start SAM-BA on the PC. It should connect. c) Set the start address to 0x11F800 and the size to 0x800 d) Enter a file name in the receive field. e) You can now receive the file with SAM-BA. f) Move it under the name wp34s.dat into your emulator directory. g) The emulator should accept the file. Your registers and programs will than be in place. h) To get your calculator back in business, start the "Boot from flash" script in SAM-BA, the same procedure you should know from flashing the firmware. i) Reset and power the calculator up and perform a restore with ON+RCL. The latest version does the restore automatically when RAM is lost.

2. From PC to calculator

a) Perform steps (a) to (c) from above. No need to set the size. b) Point SAM-BA to your wp34s.dat file from the emulator. c) You can now send the short file with SAM-BA. d) Perform steps (h) and (i) from above.

The program regions accessible with the commands PSTO, PRCL and P<> are stored at addresses 0x11f000 and above (see table above) and have a length of 0x400 (1 KB) each. The emulator creates files 'wp32s-?.dat', '?' being the region number. You can handle these files the same way as the complete state file from the emulator. The regions have identical formatting and can be swapped by copying their data to the "wrong" place. The register and state portion of the backup area at 0x11fc00 is formatted differently.

If you want to get your emulator data into the calculator in one go, do the following in Windows:

copy /b calc.bin+wp34s-2.dat+wp34s-1.dat+wp34s.dat calc-full.bin

As an alternative the following will copy the backup data instead of the RAM state file:

copy /b calc.bin+wp34s-2.dat+wp34s-1.dat+wp34s-0.dat+wp34s-R.dat calc-full.bin

The resulting file can be programmed into flash and all data is readily available.

Edited to reflect latest updates.

Edited: 6 June 2011, 6:55 a.m. after one or more responses were posted

            
Re: Wp34s Flash backup/restore
Message #3 Posted by Walter B on 6 June 2011, 3:44 a.m.,
in response to message #2 by Marcus von Cube, Germany

A revised version of this text will be in the next manual :-)

Walter


[ Return to Index | Top of Index ]

Go back to the main exhibit hall