Get the Flash Erase Block Size
From Texas Instruments Embedded Processors Wiki
Contents |
Determining Erase Block Size
This section will describe how to determine the erase block size of your Flash device. The steps for both NOR and NAND are presented as well as how to determine the size for each from both u-boot and Linux.
NOR
Using U-Boot
To determine the erase block size of your NOR Flash from u-boot connect to the EVM and enter the following dommand at the u-boot prompt.
EVM# flinfo
You should see output similar to the following:
EVM # flinfo
Bank # 1: MY AMD 29LV256M (256 Mbit)
Size: 16 MB in 256 Sectors
Sector Start Addresses:
02000000 02010000 02020000 (RO) 02030000 (RO) 02040000
02050000 02060000 02070000 02080000 02090000
.
.
.
02FA0000 02FB0000 02FC0000 02FD0000 02FE0000
02FF0000
You can calculate the erase size in Bytes by either:
- (size/sectors) * 1024 * 1024 = (16/256) * 1024 * 1024 = 65536 bytes (0x10000)
- NOTE that size and sectors are obtained from the "Size:" line in the flinfo output
- Observing the difference between two adjacent sectors. i.e.
- 0x2010000 - 0x2000000 = 0x10000
Using Linux
If you have booted to a Linux kernel with Flash support enabled you can perform the following steps to determine the erase block size. For more information on enabling Flash support in the TI kernel please see the Flash configuration in the Kernel page.
Login to the target as "root" and query the Flash device on your system
target$ cat /proc/mtd
You should see output similar to the following:
target$ cat /proc/mtd dev: size erasesize name mtd0: 00020000 00010000 "bootloader" mtd1: 00020000 00010000 "params" mtd2: 00400000 00010000 "kernel" mtd3: 00bc0000 00010000 "filesystem"
The above output displays the erase block size for the various partitions in the erasesize field. For this example the erase block size woulde be 0x10000.
NAND
Using U-Boot
To determine the erase block size of your NAND Flash from u-boot connect to the EVM and enter the following dommand at the u-boot prompt.
EVM# nand info
You should see output similar to the following:
EVM # nand info Device 0: NAND 64MiB 1,8V 8-bit, sector size 16 KiB
The above output displays the erase block size for the NAND device as the sector size. For this example the erase block size would be 16KB. E.g. above is from DVEVM using the Samsung K9K1208Q0C at 0x2000000 (64 MB, 16 kB sector). NAND flash requires that I/O operations be done in increments of sector size.
Using Linux
If you have booted to a Linux kernel with Flash support enabled you can perform the following steps to determine the erase block size. For more information on enabling Flash support in the TI kernel please see the Flash configuration in the Kernel page.
Login to the target as "root" and query the Flash device on your system
target$ cat /proc/mtd
You should see output similar to the following:
target$ cat /proc/mtd dev: size erasesize name mtd0: 00040000 00004000 "bootloader" mtd1: 00020000 00004000 "params" mtd2: 00400000 00004000 "kernel" mtd3: 03ba0000 00004000 "filesystem"
The above output displays the erase block size for the various partitions in the erasesize field. For this example the erase block size woulde be 0x4000.
Leave a Comment