Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
Hi, I have managed to build a kernel and suitable flash drivers to run on a system using an MCS8144, and S25FL512S flash memory chips. On power up I can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    39

    Flash corrupted after a single running session


    Hi,

    I have managed to build a kernel and suitable flash drivers to run on a system using an MCS8144, and S25FL512S flash memory chips.

    On power up I can load u boot, linux version 2.6.24.4, and file system into flash, and then run. When Linux boots I get numerous error messages such as:

    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00d80120: 0xf018 instead

    Further such events for this erase block will not be printed

    Empty flash at 0x00da12c4 ends at 0x00da12cc
    Old JFFS2 bitmask found at 0x00e2a6d8

    You cannot use older JFFS2 filesystems with newer kernels

    Eventually the Linux command prompt appears and I can navigate through directores, run apps etc, although I do still get errors such as those shown above, and like the ones below:


    JFFS2 error: (282) __jffs2_dbg_dump_node: wrong common header CRC.
    Error garbage collecting node at 030bbe64!


    When I reboot the system it fails to start, the only way to recover is to enable iBoot in the MCS8144, and start again.

    Does anyone have any Idea what is causing this problem and how it can be fixed please

    Kind regards

    Andrew
    Last edited by AJEllisuk; 08-28-2012 at 09:57 AM.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,411
    Have you disabled memory swapping? That may be necessary on this system. You will have to do that in the kernel configuration before you build it.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Aug 2012
    Posts
    39
    Quote Originally Posted by Rubberman View Post
    Have you disabled memory swapping? That may be necessary on this system. You will have to do that in the kernel configuration before you build it.
    Hi Rubberman,

    I have checked the make config menu, and the make files in my project, but I cannot find any reference to memory swapping.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,411
    In the kernel sources directory where you start the build process, look for this line in .config: CONFIG_SWAP=y
    Comment it out with a leading '# '. Another thing for embedded systems is that you should build a minimized kernel - disable all kernel options that you are sure you don't need. A lot of cruft that you don't need gets built into them by default. Anyway, no guarantee that turning swap off will work, but what the heck, at least you'll learn something!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Aug 2012
    Posts
    39
    Thanks for the pointer. I found the line, and found it was already commented out. So something else is causing my issue. I have tried my code on a evaluation board that has a different flash and it runs without any problems. There is something about the structure of the flash I'm using on my own board. The EVB has a m25p128 (16MB) fitted where as my board has S25FL512S fitted (64MB). In the flash driver file (m25p80.c) there is a macro PAGE_SIZE which had to be set for 256 bytes for the 16mb flash, but 512mb for the larger flash, both flashes have a sector size of 256k. I suspect that either there is a problem with when I build the flash image, or there is a problem when uboot copies the flash image into flash. In both cases I've not found a way to specify flash page sizes.

    Do you have any further suggestions as to what could be going wrong please?

  6. #6
    Just Joined!
    Join Date
    Aug 2012
    Posts
    39
    Thanks for the pointer. I found the line, and found it was already commented out. So something else is causing my issue. I have tried my code on a evaluation board that has a different flash and it runs without any problems. There is something about the structure of the flash I'm using on my own board. The EVB has a m25p128 (16MB) fitted where as my board has S25FL512S fitted (64MB). In the flash driver file (m25p80.c) there is a macro PAGE_SIZE which had to be set for 256 bytes for the 16mb flash, but 512mb for the larger flash, both flashes have a sector size of 256k. I suspect that either there is a problem with when I build the flash image, or there is a problem when uboot copies the flash image into flash. In both cases I've not found a way to specify flash page sizes.

    Do you have any further suggestions as to what could be going wrong please?

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,411
    What is the OS file system block size? Also, are you sure you are placing data on the flash properly aligned?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Just Joined!
    Join Date
    Aug 2012
    Posts
    39
    Quote Originally Posted by Rubberman View Post
    What is the OS file system block size? Also, are you sure you are placing data on the flash properly aligned?
    I'm not near a system at the moment. Can I determin the block size from the source code? If so where? I'm using JFFS2.

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,411
    I'm home right now where I have my embedded kit, so let me check and get back to you.

    Ok, I'm back. There is nothing in the kernel about the block size specifically for JFFS2; however, there is this comment about JFFS2 write-buffering support:
    JFFS2 write-buffering support (JFFS2_FS_WRITEBUFFER)

    This enables the write-buffering support in JFFS2.

    This functionality is required to support JFFS2 on the following
    types of flash devices:
    - NAND flash
    - NOR flash with transparent ECC
    - DataFlash
    That option is enabled on my ARM embedded system. So, I would suspect that if your flash is a NOR flash without transparent ECC, or something not on that list, you may have a problem. I know this is probably a red-herring, but I'm trying (very, my wife would say)...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,411
    Here is another entry that mentions a needed option for JFFS2 devices:
    Caching block device access to MTD devices (MTD_BLOCK)

    Although most flash chips have an erase size too large to be useful
    as block devices, it is possible to use MTD devices which are based
    on RAM chips in this manner. This block device is a user of MTD
    devices performing that function.

    At the moment, it is also required for the Journalling Flash File
    System(s) to obtain a handle on the MTD device when it's mounted
    (although JFFS and JFFS2 don't actually use any of the functionality
    of the mtdblock device).

    Later, it may be extended to perform read/erase/modify/write cycles
    on flash chips to emulate a smaller block size. Needless to say,
    this is very unsafe, but could be useful for file systems which are
    almost never written to.

    You do not need this option for use with the DiskOnChip devices. For
    those, enable NFTL support (CONFIG_NFTL) instead.
    I'll keep looking...
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •