A program to build the right SPI.BIN file for your tablet

I have had a bad experience in reprogramming the SPI flash of my tablet (a new one), due to wrong BIN file used (it was suited for ANOTHER tablet, with different RAM arrangement). After a couple of tries “in the blue”, I stopped working that way and decided to write my own software to merge the U-Boot.bin and the W-Load.bin that are in FirmwareInstall folder of specific update microSD, then create the right output BIN file to be used with external programmer for SPI flashing.

The SPI flash

SPI means Serial Peripheral Interface and “flash” is a particular type of memory, capable to be written (and rewritten) in fast mode and able to retain informations even if power supply is removed, so this kind of memory is part of the “non-volatile” devices.

What’s the purpose of SPI flash in our Android Tablet ? It’s like the (ancient) floppy disk in old computers. The floppy, in VERY old computers, was the device containing the Initial Program Loader, the first program the processor runs to start the whole system. In our tablets, the processor (I’m speaking about the WM8650, in this case) tries to load a boot program from this device. The SPI flash memory is small and simple device. Usually has 8 pins (contacts) and isn’t too miniaturized… it’s still at “human” dimensions and this is the reason we can remove it from the circuit, reprogram and resolder it on place. If your tablet is “bricked”, you can immediatly recover, simply restoring a valid boot program in it.
The hardware and the procedures for rewriting the SPI flash have been described in a very good article 🙂 by me on another page of my site, so, look around if interested in. But… what’s stored in the SPI flash of our tablet ?

There are two programs: the W-load and the U-Boot. The U-Boot can execute commands you supply via serial terminal or you have stored in the microSD, by means of the wmt_scriptcmd script file. U-Boot is the tool for handle the very low-level of your tablet. Btw, the NAND flash is another basic component of your system, ‘cause is your device’s HARD DISK. As in very old computers, the floppy loads the system skeleton and then the Hard Disk starts the programs with usual user interface (or GUI when is Graphical User Interface).

Ok, we turn ON the button, the processor starts, executes the program written in the W-load section. The U-boot then starts the system that’s on NAND memory and you have your tablet working.

When you try to unbrick your tablet rewriting the SPI flash, you must use the right version of U-Boot and W-Load, ‘cause if you choose a wrong version, all the process can’t start. A very important section (usually don’t mentioned) is the W-load program. There is a particular version for any RAM arrangment in your tablet. Not all the RAMs are the same: even if your “global” ram size is a certain number of MB, the rams can be arranged in different ways. For different arrangements, there are different W-loads.

How can I understand what’s my specific W-Load ?

You can take a look on the serial output that comes out from your tablet at power on. Obviously… you must do it before upgrading (and possibly bricking) your tablet ! The serial interface is a VERY powerful tool and I highly recommend to you to purchase (or build) one for modding and better understanding your tablet.
Look at this example :

WonderMedia Technologies, Inc.
W-Load Version : 0.15.00.01
UPDATE_ID_1_4_4_0_2_256MB_0150001
ethaddr............found
wloader finish

U-Boot 1.1.4 (Aug 24 2011 - 10:14:10)
WonderMedia Technologies, Inc.
U-Boot Version : UPDATEID_0.04.00.00.10
U-Boot code: 03F80000 -> 03FC3190  BSS: -> 03FCD724
boot from spi flash.
SF0: ManufID = 37, DeviceID = 3013 (Missing or Unknown FLASH)
Use Default - Total size = 8MB, Sector size = 64KB

There are some very useful infos: these are W-Load version and UPDATE_ID, U-Boot Version and UPDATEID. With such informations you can easily “build” your own SPI flash and it will be EXACTLY the one that fits your tablet. You also have infos on which type of SPI flash is mounted in the tablet. In the example before, the memory has ID 0x373013 (that is unknown to the system, so it starts with default values that are good for all memories).

How to build your BIN file for writing a new SPI flash.

Usually, the SPI flash has 512KB (kilobytes) space, but if you look on the datasheet it’s called a 4 megabit memory; that’s exactly the same, ‘cause 4Mbits = 512KBytes.
In our tablets, the SPI flash memory is divided into 2 areas: the first, starting at address 0x00000 and ending at 0x6FFFF (not fully used) is the U-Boot program; the second, starting at address 0x70000 and ending at 0x7FFFF (almost fully used) is the W-Load program.

I wrote a small program that can build for you the my-spi.bin file, the BIN file of 512KB you need to re-flash your SPI memory. The program is written in FreeBasic (under Windows), and doesn’t need for installation. Just decompress the .ZIP you can download from attachments in a folder, for example spi-flash and you have the executable to run.
In order to create your my-spi.bin file, you need, obviously, for the submentioned files u-boot.bin and w-load.bin. So, go to the FirmwareInstall folder of your Uberoid upgrade folder (or to the same folder of original rom) and copy the u-boot.bin you find there in the new created folder. For the w-load, you have (often) different file names that all starts with w-load prefix and finishes with .bin suffix, but the right file is the one has inside the same signature you have read in the serial terminal (in our example is UPDATE_ID_1_4_4_0_2_256MB_0150001). If you are in doubt, simply try copying all of them in your new folder and then rename it, one at a time, in w-load.bin. The program is “stupid” and looks for input files u-boot.bin and w-load.bin and produces as output my-spi.bin .
When you start the buildspi.exe, the program generates the output file and shows to video the actual versions of U-Boot and W-Load programs; if some of that versions isn’t the one you need for, simply load another and try again.

Once the file is created and the versions are both identical to the ones you read from serial terminal at the device boot, you have the right SPI file to program into the chip.

The executable file (zipped) can be downloaded here.

In the picture below, you can have a look to a working program screenshot. Hope this will help you.

 

3 thoughts on “A program to build the right SPI.BIN file for your tablet

  1. Thank you for appreciating my work ! 🙂
    I’m going to add to the program the memory area for env variables. I will publish the new one in few days…

Comments are closed.