Re: NAND Flash drive in CE 6.0



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 -

.



Relevant Pages

  • Re: Nand Flash Data Lost
    ... While you mentioned not only registry but also the files are lost after reboot and the bootloader did not repartition your flash, it is believe the OS wipes the Flash. ... Have you tried to build a Image only mount the NAND as an ordinal external storage but not for storing Hive nor mounting as root file-system and to see if files still lost after rebooting? ...
    (microsoft.public.windowsce.platbuilder)
  • Re: 4Gbit NAND flash driver question
    ... bootloader boot up and i can use bootloade command from hyperterminal is ... format nand flash disk. ... bootloader call nandflash driver to format. ... that the Bootloader is reading to and writing from NAND flash ...
    (microsoft.public.windowsce.platbuilder)
  • Re: NAND Flash drive in CE 6.0
    ... I am not using EBOOT or any part of the CE OS as my bootloader. ... I assume that you are using FAL-FMD structure to use your NAND. ... image onto the Flash. ... the OS into a flash partition. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: File system is not working in Retail Version in WinCE 5.0
    ... I am using the NAND Flash for FAT File System only and I am using the ram ... debug and retail versions after that the loading sequences differs for each. ... As per your suggestion if there is problem in our FMD, for NAND file system ...
    (microsoft.public.windowsce.embedded)
  • Re: Block device:: NAND
    ... If all the application data handling is not done in the bootloader, ... NAND(address is maintained in terms of table in NAND). ... As i have FMD Nand driver i want to make use of block API to write ... to sector and read to sector. ...
    (microsoft.public.windowsce.platbuilder)