Re: NAND Flash drive in CE 6.0
- From: "Andrew at Plextek (www.plextek.co.uk)" <ams@xxxxxxxxxxx>
- Date: Thu, 28 May 2009 01:53:50 -0700 (PDT)
Bevan,
When the OS mounts the flash filing system, it will attempt to format
the NAND Flash if you have the auto-format option enabled in the
registry. When it formats the Flash for the first time it will erase
all blocks that it finds, providing that they are not marked as bad,
or marked as reserved.
Blocks are marked as bad by the manufacturer of the NAND part. These
markers are located in the "spare" area of one (or more) of the NAND
flash pages in the block. Unfortunately, how this is done varies
between manufacturer and the page size of the NAND part. What the MS
code expects is that Byte offset 5 in the spare area is used as the
bad block mark (which is where many manufacturers put their bad block
marks).
In fact, the MS code overlays a structure called "SectorInfo" into the
spare area of each page of the NAND (a page is synonimous with a
sector). This can be found in PUBLIC\COMMON\OAK\INC\FMD.H. As well as
defining byte offset 5 as bBadBlock, it defines byte offset 4 as
bOEMReserved. If this byte is zero, then the Flash filing system will
detect the page as reserved and will skip over it.
So, to protect your bootloader from being erased, you need to ensure
that when the bootloader is written into the NAND, that byte offset 4
in the spare area of the NAND is programmed as zero. (There may be
other tricks to make this work fully, but this is the gist of it.)
Another way of doing this which doesn't involve modifying the spare
area is to add a shim driver (or hook) into the FMD which does a
simple block number translation, so that when the MS upper layers of
the driver call for sector 0, your shim adds an offset (sufficient to
protect the bootloader) before calling the lower layer. You will need
to override FMDHOOK_GetInfo, FMDHOOK_GetBlockStatus,
FMDHOOK_SetBlockStatus, FMDHOOK_ReadSector, FMDHOOK_WriteSector,
FMDHOOK_EraseBlock, FMDHOOK_OEMIoControl(IOCTL_FMD_LOCK_BLOCKS). The
GetInfo function will have to read the flash info from the lower
layer, and reduce the reported size of the NAND device by the size of
the bootloader. Example shim drivers for the FMD are in PUBLIC\COMMON
\OAK\DRIVERS\BLOCK\MSFLASHFMD\HOOK.
Good luck,
Andrew.
On May 28, 7:31 am, B-Dawg <BD...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi,
I am using the FAL-FMD structure for my NAND driver. Do you want more info
about it / source code etc?
I am not using EBOOT or any part of the CE OS as my bootloader. I am using
a bootloader called Vivi. The nk.nb0 OS image itself is not being written
over the bootloader it is just the flash drive partition that I make using
Storage Manager in CE 6 Explorer, Control Panel on which I want to store my
files.
Bevan
"harry" wrote:
Hi,
I assume that you are using FAL-FMD (FTL) structure to use your NAND.
The Blocks for the Boot-loaders are needed to be reserved, so as no
other application can Write or Erase these blocks.
However it looks like that Blocks where Boot-loader resides are not
reserved hence OS image is getting written onto it.
You can verify the EBOOT, which is responsible for writing the OS
image onto the Flash.
EBOOT should check that it is not writing or erasing any reserved
block.
Kindly furnish the FTL details so as you can get the precise
answer. :)
Regards,
Harsh
On May 27, 1:15 pm, B-Dawg <BD...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have a Samsung SMDK2440 based system with 64MB of RAM and 64MB of NAND
Flash. I have a smartmedia driver that formats the NAND space not used by
the OS into a flash partition. This works OK and I can put files onto it etc.
However, when creating the partition it overwrites the bootloader that is
also situated in the NAND flash so that the device will not boot the second
time. The bootloader is not part of the CE OS and so CE will not know about
it and therefore I presume does not protect those sectors. If I reflash the
bootloader back on the OS is then able to start up and is not corrupted but
the new partition that I had created is gone. This is what leaves me to
believe the NAND storage partition and the bootloader are occupying the same
sectors somewhere on the NAND.
Can someone point me in the right direction about how to resolve this? Do I
put a reserved entry into Config.bib, or do I need to code this into my
driver? Any help would be appreciated.- Hide quoted text -
- Show quoted text -
.
- References:
- NAND Flash drive in CE 6.0
- From: B-Dawg
- Re: NAND Flash drive in CE 6.0
- From: harry
- Re: NAND Flash drive in CE 6.0
- From: B-Dawg
- NAND Flash drive in CE 6.0
- Prev by Date: ShellExecuteEx "Batch file on SD Card" failing: CE 5
- Next by Date: Re: unload ndis miniport
- Previous by thread: Re: NAND Flash drive in CE 6.0
- Next by thread: Missing Bootloader File Causes Build to Fail
- Index(es):
Relevant Pages
|