Detailed analysis of Nand flash is specified when SDRAM is specified

When I first started learning ARM9's bare-metal programming and Linux system porting, I was puzzled by some specific addresses when programming Nand flash memory.

I have seen a lot of teaching videos. When I write the program to Nand flash, I usually specify an address of 0X3000_0000, and the official manual of S3C2440 indicates that the on-chip peripheral corresponding to 0X3000_0000 address is SDRAM. This can't help but raise questions: It is clear that SDRAM is specified but Nand flash is burned. Why is this?
Detailed analysis of Nand flash is specified when SDRAM is specified

To answer this question, we must first start with the structure of Nand flash itself. The structure of Nand flash is different from RAM. Its data lines are multiplexed, and there are enough address lines for addressing. The data access for it is usually in blocks. This is not the same as Nor flash. Nor flash has a RAM interface and there are enough address lines for addressing, so the CPU can access every byte inside Nor flash. The program can run in nor flash, but Nand flash does not work. So the program in Nand flash wants to run and must be copied to memory (usually SDRAM).

When we want to program the program to Nand flash, we will use a "transfer station", both SDRAM. The program is first programmed into SDRAM (this is why the 0X3000_0000 address is specified), and then copied from the SDRAM to the Nand flash, and this copying is done by the uboot program that implements the programming to Nor flash.

In addition, when we ported the Linux system to the 2440 development board, we would burn three files to Nand flash: uboot, Linux kernel and file system. The burning of each step also borrows SDRAM as the "transfer station" for burning. However, we did not specifically process the burning address of each step when we burned. How can we ensure that the following files will not be overwritten when three files are written? Personal understanding is: or the credit of the uboot program in Nor flash, it will guide the three files to be copied to different locations of the Nand flash.

Then after talking about the problem of Nand flash burning, it is natural to talk about the running of the program in Nand flash. As we said before, Nand flash can't execute programs, and when we choose to boot from Nand flash, S3C2440 will automatically copy the first 4KB of Nand flash code into a piece of Stepping Stone (usually called stepping stone) in memory. In the internal memory (this step is determined by the hardware inside the chip, we don't have to worry about it), the PC jumps to the 0 address to execute the code.

But this on-chip memory is only 4KB. What should we do when our program in Nand flash is larger than 4KB?

This is the time to copy the last 4KB code to work. This 4KB code will help us initialize the SDRAM, then copy the remaining code in the Nand flash to the SDRAM, and the PC will jump to the SDRAM to execute the remaining programs (so our bare metal program will generally not exceed 4KB). .

Although there are only a few steps to write, there are still a lot of knowledge points, which may be the characteristics of embedded.


Front Hydrogel Films

The hydrogel Screen Protector has super ductility and shrinkage, has a strong and effective self-repair function, impact resistance, durability, better toughness, and has a certain buffering effect on sharp objects. The use of hydrogel film can adapt to the contours of any device, so it can be attached to curved screens and rounded edges. The full-coverage screen protector can perfectly fit your screen and provide maximum protection.

The 0.14mm ultra-thin thickness is more sensitive to the touch, and the ultra-thin design gives you a bare-metal experience. The oleophobic and waterproof coating prevents fingerprints and dust, makes the hydrogel screen protector easy to clean, and makes your phone look more beautiful.

Hd Clear Hydrogel Protector Sheet,Anti Blue-Ray Hydrogel Protector,Matte Hydrogel Film,Privacy Hydrogel Film

Shenzhen TUOLI Electronic Technology Co., Ltd. , https://www.szhydrogelprotector.com