SAM-BA Padding Binaries?

Microchip in-system programming solution: SAM-BA

Moderators: nferre, fab

Posts: 3
Joined: Mon Sep 10, 2007 7:07 pm

SAM-BA Padding Binaries?

Wed Nov 21, 2007 6:57 pm

I'm having an issue where it looks like SAM-BA is padding binaries. I can't find any information about it in the documentation, so was hoping that someone here could help.

I'm using a AT91SAM9263-EK for developement, with the included DataFlash and onboard NANDFlash.

Due to some regulatory agencies, any unused space on the NAND Flash must be full of 0x00, it cannot contain 0xFF.

So my first step is to write a 256MB binary full of all zeroes to the NANDFlash using the SAM-BA utility.

Then I read back the first 16MB and verify that it is all 0x00. So far so good.

Then I write a 0x13c630 byte long binary image to the NANDFlash beginning at offset 0x0.

Then when I read back the first 16MB of data on the NANDFlash the binary comes with data up to 0x140000. The extra 0x39d0 worth of data appears to be random, and the first 0x13c630 bytes is identical to the image stored on my PC.

So is SAM-BA padding the binary to reach the 0x140000 point? If so, why, and how can I stop it from doing so?

Thanks in advance,
Location: Artec Design LLC, Tallinn, Estonia
Posts: 106
Joined: Thu Aug 09, 2007 10:48 am

Fri Nov 23, 2007 11:18 pm

Flash is based on blocks. All erased blocks are 0xFF; When you write the whole flash with zeroes, all bits get programmed. Now when writing a image, blocks of flash have to be erased back to 0xff and then the bits needed to be programmed back to zeroes. It seems that the nand is written block-by-block and it is assumed that all images are padded to an integer number of blocks. (so it does not have to read back the other area). As flashes are always partitioned to partitions of integer number of blocks and you use sam-ba to initialize your partitions, then it is not needed to write only partial blocks. Having readback writes makes things slower and it is not wise just to implement something very rarery used that makes things slower.

Solution: check your flash block size from datasheet and pad your image to a block boundary. Or just pad it to the end of the flash with zeroes. It can be done with just a shell script on linux - use dd to copy zeroes from from /dev/zero.

Return to “SAM-BA”

Who is online

Users browsing this forum: No registered users and 3 guests