Mpc8313erdb Code Analysis of Uboot environment variables read from NAND flash in Linux[Email protected]One. Story causeDue to the increase of the file system, it has greatly exceeded the 8MB nor FLASH. Instead, the kernel, file system, and device tree files have to be saved to NAND flash.However, because of the use of
During kernel transplantation today, we are going to add the NAND Flash Driver to achieve MTD partitioning. When we think of a sentence we saw in a book, we say there is no gap between each partition during partitioning, the ending address of the previous area is the starting address of the next area. However, when I look at my Development Board tutorial, the partition is as follows:
Static struct mtd_parti
8.1 NAND Flash Introduction and NAND Flash Controller useNAND Flash has a similar position in embedded systems as a hard disk on a PCNAND Flash can still be saved after power-down8.1.1 Flash
, the spare area stores additional information, bad block ECC verification, and so on. The structure of NAND Flash is a NAND flash device, 1 (device) = xxxx (blocks), 1 (Block) = xxxx (pages), 1 (page) = 528 (bytes) = data block size (512 bytes) + OOB block size (16 bytes, data block is the main area, OOB is the spare
First, you need to understand the structure of NAND Flash.
Taking micron mt29f4g08bxb NAND Flash as an example, this flash (for example) uses four sectors (sector) to form one page and 64 pages) one block and 4096 blocks constitute the entire
OS-based electronic products usually burn kernel to norfash, because it can be read and written by byte, but norflash is more expensive than NAND Flash, in addition, NAND Flash is based on block read/write, for example, one-time read/write of 512 bytes (Block ). if the NAND
A friend's problem can be solved after analysis. In fact, I have encountered the same problem before. It takes a long time and I have not summarized it.
Incident: Linux kernel 2.6.14 is used on NAND Flash, and the Samsung 2440 board is used to continuously write files and delete the files to a certain size limit. The number of idle Files written to flash is not
dwnumsectors );
The psectorinfobuff parameter reads the corresponding sector status. If the psectorinfobuff parameter is null, the sector data is read and written. If the value of ctctorbuff is null, the read/write sector status is displayed.
Differences in address LoopsWhen reading data. The 16-bit low column address is 0, and the offset in the page is 0,Nf_addr (0); // column (A [7:0]) = 0Nf_addr (0); // A [11: 8]Nf_addr (blockpage) 0xff); // A [19: 12]Nf_addr (blockpage> 8) 0xff); // A [27
1) Why is there a bad block? Because the NAND flash process cannot guarantee the reliability of the memory array in its lifecycle, bad blocks are generated during NAND production and use. The bad block feature is that when the block is programmed/erased, some bits cannot be pulled up, which may cause errors during page program and block erase operations, the corr
Note: When the power supply voltage of k9f2g08u0b is 3.3 V, the fclk of the system is 400 MHz, and the hclk is 400/3 = 133 MHz.
1. NAND Flash Controller Initialization
Call nand_init () in the nbl1.lsb NAND function to initialize the NAND flash controller. The following des
For more information about nandflash, see.
Now I will post the code of Mr. Wei Dongshan for my learning.
@*************************************** ***************************************@ File: head. s@ Function: Set the SDRAM, copy the program to the SDRAM, and then jump to the SDRAM to continue execution.@*************************************** ***************************************. Text. Global _ start_ Start:@ Function disable_watch_dog, memsetup, init_nand, nand_read_ll defined in init. cL
I. Burn uboot. bin to NAND Flash
(1) J-link arm(2) r(3) Speed 12000 // set TCK(4) initialize SDRAMLoadbin D: \ init. Bin 0Setpc 0G(5) download the u-boot.bin_openjtag to SDRAM and runHLoadbin D: \ u-boot.bin_openjtag 0x33f80000Setpc 0x33f80000G(6) download u-boot.bin to SDRAMHLoadbin D: \ u-boot.bin 0x30000000G
(7) In the terminal through the u-boot.bin_openjtag to burn the u-boot.bin to the
A file system with QT was prepared a few days ago, and it was successfully mounted through NFS, but the interface flash badly. After analysis, it is concluded that the NIC conflicts with the VGA because the NIC is normally displayed when the network is closed, but the file system mounted through NFS cannot work without the NIC. After the NIC is disabled, it is displayed as normal, but the mouse and keyboard are no longer available. Therefore, you need
, booting LINUX ......
Undefined instruction
PC: [SP: 33d3ded4 IP: c0000000e FP: bfefdfdd
R10: ffffffff R9: fbfcb3dc R8: 33d3ffdc
R7: fbfbf725 R6: 00000000 R5: 000000a8 R4: 30008000
R3: c0001_c R2: 30008000 r1: 000000a8 R0: 00000000
Flags: nzcv irqs off fiqs off mode svc_32
Resetting CPU... * ** how does warning-bad CRC or NAND and using default environment do this? uboot is also written. Why is it different? Later I asked the group owner why, he said
Note: The power supply voltage of k9f1208u0b is 3.3 V, the fclk of the system is 533 MHz, and the hclk is 533/4 = 133 MHz.
NAND Flash Controller Initialization
Call nf_init () in the mian function of stepldr to initialize the NAND flash controller. The following describes this function.
Where
// Hclk = 100 MHz
# Def
(); // read 1 page of Data cyclicallyNfchipds (); // release nandflash}
Iii. write operation process
The write operation process is: 1. Sending the Write Start command; 2. Sending 1st Cycle addresses; 3. Sending 2nd Cycle addresses; 4. Sending 3rd cycle addresses; 5. Send 4th cycle addresses; 6. Write Data to the end of the page; 7. Send the write end command.
The following describes the read/write process by analyzing the code written to the page.
Static void writepage (u32 ADDR, u8 * BUF) //
(); // wait for the system to be busyFor (I = 0; I Buf [I] = rdnfdat (); // read 1 page of Data cyclicallyNfchipds (); // release nandflash}
Iii. write operation process
The write operation process is: 1. Sending the Write Start command; 2. Sending 1st Cycle addresses; 3. Sending 2nd Cycle addresses; 4. Sending 3rd cycle addresses; 5. Send 4th cycle addresses; 6. Write Data to the end of the page; 7. Send the write end command.
The following describes the read/write process by analyzing the cod
MTK NAND Flash configuration Support1. First confirm the Flash model, for example: SanDisk sd7dp24c_4g. 2. View Mediatek/build/tools/emigen/mt6572/memorydevicelist_ Mt6572.xls whether there is support for the chip, if not supported, you can go to the MTK official website to download the latest Memorydevicelist_mt6572.xls files. 3. Modify the Mediatek/custom/proje
checkcode cp0 ~ Cp5, remaining 2 position 1:
When writing data to NAND Flash, we generate a verification code and save it to the spare data area in flash. When reading data from flash, a new ECC verification code is generated, which is different from the old one read by the spare data area:
Result 0: The data is co
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.