Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

The goal of the document is to illustrate how to build SP7021 Linux image for booting from SPI-NOR flash on SP7021 boards. SP7021 build (make) system supports two types of root file-system for SPI-NOR flash. One is initramfs file-system and other is jffs2 file-system. If you choose initramfs file-system, build system merges root file-system into Linux kernel. The whole kernel (kernel + root file-system) is loaded into and operates in DRAM directly. The advantage of initramfs file-system is that accessing speed is very fast. But since it is stored in DRAM, all changes disappear when power off. If you choose jffs2 file-system, root file-system is compressed and is stored in rootfs partition of SPI-NOR flash. The drawback of jffs2 file-system is that accessing speed is slow. But all changes are kept in SPI-NOR flash when power off.

To build image of SPI-NOR flash, first, you need to get source files of SP7021 from git server of SP7021. Second, you need to run make to build all images of SP7021. After make processes complete successfully, it will create a binary file named spi_all.bin. Third, you need to use flash programmer to write the spi_all.bin to SPI NOR flash. Finally, plug the written SPI-NOR flash into socket of SPI-NOR (SOC-8) on your SP7021 board, set DIP-SW to “boot from SPI-NOR flash”. You are ready to turn on SP7021 power to boot Linux from SPI-NOR flash. For details, please follow the following steps.

1. Download source files

Get latest source files from git server of SP7021 (2. HOW TO GET SOURCE FILE AND PACKAGE). Refer to report of ll command for the contents of top folder of source of SP7021:

wellslu@scdiu3:~/q628/nor$ ll
total 52
drwxr-xr-x 12 wellslu sp 4096 Oct 15 12:01 ./
drwxr-xr-x 19 wellslu sp 4096 Oct 15 11:53 ../
drwxr-xr-x  8 wellslu sp 4096 Apr 27 18:51 boot/
drwxr-xr-x  4 wellslu sp 4096 Aug 25 12:05 build/
drwxr-xr-x  7 wellslu sp 4096 Jul 27 12:23 crossgcc/
drwxr-xr-x  6 wellslu sp 4096 Apr 27 18:51 eCos/
drwxr-xr-x  9 wellslu sp 4096 Jun  5 09:30 freertos/
drwxr-xr-x  8 wellslu sp 4096 Aug 11 16:40 ipack/
drwxr-xr-x  7 wellslu sp 4096 Apr 27 18:51 linux/
-r--r--r--  1 wellslu sp   23 Apr 27 18:51 Makefile
drwxr-xr-x  4 wellslu sp 4096 Apr 27 18:51 nonos/
drwxr-xr-x  7 wellslu sp 4096 Apr 27 18:51 .repo/
drwxr-xr-x  3 wellslu sp 4096 Jun 29 09:44 yocto/

2. Configure environment

Run make config command on top folder. After configuration menu pops up, first, choose a board you want to build image for. For example, press 1 to choose “SP7021 Ev Board”. Second, press 1 to choose to use C chip (quad core CA7). Finally, press 3 (jffs2) or 4 (initramfs) to choose to boot from SPI-NOR flash and then enter to start to configure building environment. Refer to screenshot below,

make config starts to build compiler environment. It may take a few minutes. Please wait for make config completing the processes.

3. Build NOR image

Run make all command to start to create all images of SP7021. It may take several minutes to complete. At almost final stage of building processes, make will ask you to select the use of iBoot,

Please press x and enter to continue the processes. After make all completes, you will see screenshot like:

The final binary spi_all.bin is built and copied to folder out. Refer to screenshot of output of ll out command:

4. Write your SPI NOR flash

Put your SPI-NOR flash chip into socket of flash programmer. Be careful about the pin 1 position of the chip. It should be at the same corner of pin 1 of socket. Refer to picture below, an SPI NOR flash is placed at socket of a GZUT USB flash programmer.

Run flash programmer application, for example, run GZUT_OnePro in Windows. After application window pops up, then load binary file, spi_all.bin. Press “Auto” to start to write processes automatically (including erase, write and verify). Refer to screenshot below, a WINBOND 128 Mibit (16 MiB) flash chip (W25Q128) has been programmed and verified successfully.

Remove the SPI NOR flash chip from socket. Note that the size of 'spi_all.bin' is about 14.2 MiB. So, size of SPI NOR flash chip should be 16 MiB (or 128 Mibit) or greater.

5. Set DIP-SW to “boot from SPI-NOR flash”

Plug the written SPI-NOR flash into socket of SPI NOR flash of SP7021 board. Set DIP-SW (boot-select switch) to “boot from SPI-NOR flash”. For example, if you are using SP7021 Ev Board, please set DIP-SW to OFF-OFF-ON-OFF-ON-OFF (1-1-0-1-0-1) for booting from SPI-NOR flash. Refer to picture below, DIP-SW is set to OFF-OFF-ON-OFF-ON-OFF.

Now, you are ready to boot SP7021 Linux from SPI-NOR flash. Turn on power of SP7021 board to boot system.

Appendix. Layout of partitions of SPI-NOR flash

Refer to layout of partitions of a 16 MiB SPI-NOR flash. There are 6 partitions in SPI-NOR flash. The figures in parenthesis of each partition is the size of the partition. Note that root file-system of Linux is built into kernel.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.