How to extract currently used ECC parameters

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

moonsea
Posts: 4
Joined: Wed Jan 08, 2020 10:04 am

How to extract currently used ECC parameters

Wed Jan 08, 2020 10:40 am

I want to create a boot sector on my nand device.
To do this I need to create a header with the ECC parameters in a 32-bit data (repeated 52 times) followed by the actual boot code.

We don't use the ONFI-parameters for the ECC but they are configured at startup. The ECC-parameters might vary from unit to unit, so therefore I need a way to read the currently used parameters to create the 32-bit data.

How do I read these parameters from Linux. I can do this either via a script or via som c- or c++-code, whichever is possible.

/Mats
blue_z
Location: USA
Posts: 2023
Joined: Thu Apr 19, 2007 10:15 pm

Re: How to extract currently used ECC parameters

Fri Jan 10, 2020 4:25 am

moonsea wrote: How do I read these parameters from Linux.
If you mean to read the existing header already stored in NAND, then you first need to identify the device node that represents the MTD partition that includes the start of the chip.
The /proc directory does not seem have files (e.g. mtd or partitions) that report the starting displacement of the partitions.
The boot log (i.e. the dmesg command) would report the salient information (i.e. the start, end, and name):
nand: device found,
...
7 fixed-partitions partitions found on MTD device atmel_nand
Creating 7 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "bootstrap"
0x000000040000-0x000000100000 : "bootloader"
0x000000100000-0x000000140000 : "bootloader env redundant"
...
After confirming that MTD partition 0 actually does start at displacement 0, check that there is a device node, e.g. /dev/mtdblock0, for it.
Then simply use the dd command to read the header data to a file.

Code: Select all

# dd bs=208 count=1 if=/dev/mtdblock0 of=header.dat  

Regards

Return to “LINUX”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests