How to start the Linux Kernel Based on NAND Flash (share a piece of practical, simple code similar to the bootloader function)

Source: Internet
Author: User

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 flash of MLC is read by PAGE and a page contains about 4 K bytes, how can we start the content based on NAND Flash? The steps are as follows:

1. at present, some NAND flash controller chips will read The 0th page content of The 0th block of NAND flash into the Controller buffer by default, so that a small program (IPL) can be placed on the 0th page of The 0th block) read the Linux kernel code to the memory.

2. the Linux kernel is generally about 2 MB. After reading the memory at a time, start the kernel function to start the operating system. After the operating system is started, it can be mounted to the root file system.

 

Next, let's take a look at the compilation code of the Startup Program Based on ARM9:

 

_ Start: <br/>; @ set up stack to end of MEMC <br/> movsp, #-4 <br/>; @ reloc Params: destination = MEMC + 0x1000 source = nfc_buf, size = 4kb <br/> ldrr0, = ldr_base <br/> ldrr1, = nfc_buf <br/> movr2, #0x1000 <br/> blburst8 <br/> adrlr, l_main <br/> movlr, LR, LSL #20 <br/> movlr, LR, LSR #20 <br/> ldrr11, = ldr_base <br/> addlr, LR, R11 <br/> bburst8 <br/> l_main: <br/> blmain <br/>; @ loop forever <br/> l_end: <br/> bl_end < /P> <p> burst8: <br/> mongodbsp !, {R4-r10} <br/> l_burst8_next: <br/> ldmiar1 !, {R3-r10} <br/> stmiar0 !, {R3-r10} <br/> subsr2, R2, #32 <br/> bgtl_burst8_next <br/> ldmiasp !, {R4-r10} <br/> movpc, LR 

 

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.