Although u-boot-2011.06 supports some common development boards, if u-boot-2011.06 does not support the development board we have, we need to find a development board that is closest to our development board and transplant it based on this development board. The smdk2410 development board supported by u-boot-2011.06 is the closest to my development board, so I modified and transplanted it based on this.
Before porting, we also need to install and configure eldk for compiling u-boot. Below we will introduce the installation and configuration of eldk:
1. Download eldk
Select any version of eldk at ftp://ftp.denx.de/pub/eldk/ and download it. I chose the arm-2008-11-24.iso file of eldk4.2. Download the file to the /home/zhaocj/download/ directory.
2. Install eldk with root privileges
Create a mount point:
mkdir /mnt/dvdrom
Mount the optical drive:
mount –o loop /home/zhaocj/download/arm-2008-11-24.iso/mnt/dvdrom
Install eldk:
cd /mnt/dvdrom
./install –d /opt/eldk4.2/
In this way, eldk is installed in the /opt/eldk4.2 directory.
3. Set environment variables
cd ~
gedit .bashrc
Add the following at the end:
export CROSS_COMPILE=arm-linux-
export PATH=/opt/eldk4.2/bin: /opt/eldk4.2/usr/bin:$PATH
Save and exit, then execute:
source .bashrc
Restart the computer to complete the installation of eldk.
The following is an introduction to the transplantation of u-boot-2011.06. Here I name my development board gq2440:
1. Download u-boot
Download the latest u-boot version (u-boot-2011.06.tar.bz2) from ftp://ftp.denx.de/pub/u-boot/ to my user home directory.
2. Unzip u-boot
cd ~
Unzip u-boot-2011.06 to the current directory
tar –xvjf u-boot-2011.06.tar.bz2
cd u-boot-2011.06
3. Add my development board information in u-boot
emacs boards.cfg
Open the boards.cfg file and add a line below line 70 (smdk2410 arm arm920t – samsung s3c24x0) with the following content:
gq2440 arm arm920t – samsung s3c24x0
Save and exit.
4. Add my development board header file by copying
cp include/configs/smdk2410.h include/configs/gq2440.h
5. Add my development board folder by copying
cp –r board/samsung/smdk2410 board/samsung/gq2440
Change the file name
mv board/samsung/gq2440/smdk2410.c board/samsung/gq2440/gq2440.c
Modify the Makefile
emacs board/samsung/gq2440/Makefile
Open the Makefile file and in line 28, change COBJS := smdk2410.o to:
COBJS:=gq2440.o
Save and exit.
6. Compile
make distclean
make gq2440_config
make
If the above process goes well, a new u-boot.bin file will appear in the u-boot directory.
2 NorFlash boot migration method
.Modify macro definition
Open include/configs/gq2440.h file
Change line 38 "#define CONFIG_S3C2410" to:
38: #define CONFIG_S3C2440
The purpose is to tell the system that this development board uses the S3C2440 processor.
Change line 131 "#define CONFIG_SYS_PROMPT "SMDK2410 # " to:
131: #define CONFIG_SYS_PROMPT "gq2440# "
The goal is to make the command line prompt display as "gq2440#".
Line 185 "#define CONFIG_FLASH_CFI_LEGACY" is changed to:
185: #define CONFIG_SYS_CFI_FLASH_CONFIG_REGS {0xFFFF}
Because in u-boot-2011.06, the NorFlash interface of CFI is used, there is no need to define CONFIG_FLASH_CFI_LEGACY, but CONFIG_SYS_CFI_FLASH_CONFIG_REGS.
Change line 191 "#define CONFIG_SYS_MAX_FLASH_SECT (19)" to:
191: #define CONFIG_SYS_MAX_FLASH_SECT (35)
Because the NorFlash used in this development board is EN29LV160AB, it has 35 sectors.
Change line 212 "#define CONFIG_NAND_S3C2410" to:
212: #define CONFIG_NAND_S3C2440
Change line 213 "#define CONFIG_SYS_S3C2410_NAND_HWECC" to:
213: #define CONFIG_SYS_S3C2440_NAND_HWECC
2. Modify the system clock frequency
Open the arch/arm/cpu/arm920t/start.s file
Change line 164 "# if defined(CONFIG_S3C2410)" to:
164: # if defined(CONFIG_S3C2440)
Line 165 "ldr r1, =0x3ff" is changed to:
165: ldr r1, =0x7fff
The purpose is to mask all sub-interrupts.
Change line 173 "mov r1, #3" to:
173: mov r1, #5
The purpose is to make FCLK:HCLK:PCLK = 1:4:8.
Open the board/samsung/gq2440/gq2440.c file
Change lines 42 to 44 to:
42: #define M_MDIV 92
43: #define M_PDIV 1
44: #define M_SDIV 1
The input crystal frequency of this development board is 12MHz. With the above modification, the MPLL frequency is 400MHz.
Change lines 54 to 56 to:
54: #define U_M_MDIV 56
55: #define U_M_PDIV 2
56: #define U_M_SDIV 2
With the above modification, the UPLL frequency is 48MHz.
3. Modify the memory SDRAM timing
Open the board/samsung/gq2440/lowlevel_init.s file
Change lines 54 to 126 to:
54: #define B1_BWSCON (DW16)
55: #define B2_BWSCON (DW16)
56: #define B3_BWSCON (DW16)
57: #define B4_BWSCON (DW32)
58: #define B5_BWSCON (DW16)
59: #define B6_BWSCON (DW32)
60: #define B7_BWSCON (DW32)
61:
62:
63: #define B0_Tacs 0x3
64: #define B0_Tcos 0x3
65: #define B0_Tacc 0x7
66: #define B0_Tcoh 0x3
67: #define B0_Tah 0x3
68: #define B0_Tacp 0x1
69: #define B0_PMC 0x0
70:
71:
72: #define B1_Tacs 0x1
73: #define B1_Tcos 0x1
74: #define B1_Tacc 0x6
75: #define B1_Tcoh 0x1
76: #define B1_Tah 0x1
77: #define B1_Tacp 0x0
78: #define B1_PMC 0x0
79:
80: #define B2_Tacs 0x1
81: #define B2_Tcos 0x1
82: #define B2_Tacc 0x6
83: #define B2_Tcoh 0x1
84: #define B2_Tah 0x1
85: #define B2_Tacp 0x0
86: #define B2_PMC 0x0
87:
88: #define B3_Tacs 0x1
89: #define B3_Tcos 0x1
90: #define B3_Tacc 0x6
91: #define B3_Tcoh 0x1
92: #define B3_Tah 0x1
93: #define B3_Tacp 0x0
94: #define B3_PMC 0x0
95:
96: #define B4_Tacs 0x1
97: #define B4_Tcos 0x1
98: #define B4_Tacc 0x6
99: #define B4_Tcoh 0x1
100: #define B4_Tah 0x1
101: #define B4_Tacp 0x0
102: #define B4_PMC 0x0
103:
104: #define B5_Tacs 0x1
105: #define B5_Tcos 0x1
106: #define B5_Tacc 0x6
107: #define B5_Tcoh 0x1
108: #define B5_Tah 0x1
109: #define B5_Tacp 0x0
110: #define B5_PMC 0x0
111:
112: #define B6_MT 0x3
113: #define B6_Trcd 0x1
114: #define B6_SCAN 0x1
115:
116: #define B7_MT 0x3
117: #define B7_Trcd 0x1
118: #define B7_SCAN 0x1
119:
120:
121: #define REFEN 0x1
122: #define TREFMD 0x0
123: #defineTrp 0x1
124: #defineTrc 0x1
125: #define Tchr 0x2
126: #define REFCNT 1268
4. Modify NandFlash related content.
Although NandFlash is not involved in this transplantation, the following content related to NandFlash must be modified in order to compile successfully.
Enter the u-boot-2011.06 directory and execute the following commands:
cp drivers/mtd/nand/s3c2410_nand.c drivers/mtd/nand/s3c2440_nand.c
Open the drivers/mtd/nand/s3c2440_nand.c file and change all references to "2410" to "2440".
Then open the drivers/mtd/nand/Makefile file
Change line 48 "COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o" to
48: COBJS-$(CONFIG_NAND_S3C2440) += s3c2440_nand.o
Compile u-boot and burn the new u-boot.bin generated by the compilation into NorFlash. After the development board is powered on, the result displayed in the hyperterminal (or similar software) is:
U-Boot 2011.06 (Jul 30 2011 - 23:40:44)
DRAM: 64 MiB
Flash: 2 MiB
NAND: raise: Signal # 8 caught
raise: Signal # 8 caught
raise: Signal # 8 caught
raise: Signal # 8 caught
raise: Signal # 8 caught
raise: Signal # 8 caught
No NAND device found!!!
0 MiB
*** Warning - bad CRC, using defaultenvironment
In: serial
Out: serial
Err: serial
Net: CS8900-0
gq2440#
From the above displayed content, we can see some basic information of this development board, such as DRAM is 64M, NorFlash is 2M. Since I did not set NandFlash, the system did not detect NandFlash, and the command prompt has been changed to "gq2440 #".
Enter flinfo at the prompt to display more detailed information about NorFlash:
Bank # 1: CFI conformant flash (16 x16) Size: 2 MB in 35 Sectors
AMDStandard command set, Manufacturer ID: 0x1C, Device ID: 0x2249
Erase timeout: 16384 ms, write timeout: 1 ms
Sector Start Addresses:
00000000 RO 00004000 RO 00006000 RO 00008000 RO 00010000 RO
00020000 RO 00030000 RO 00040000 RO 00050000 RO 00060000 RO
00070000 RO 00080000 00090000 000A0000 000B0000
000C0000 000D0000 000E0000 000F0000 00100000
00110000 00120000 00130000 00140000 00150000
00160000 00170000 00180000 00190000 001A0000
001B0000 001C0000 001D0000 001E0000 001F0000
3. Support NandFlash reading and writing
We copy the drivers/mtd/nand/s3c2410_nand.c file to s3c2440_nand.c file, and change all the places related to "2410" in the file to "2440". This modification only allows the system to compile successfully, but does not really realize the reading and writing of NandFlash. Here, we will introduce how to make u-boot support the reading and writing of NandFlash.
Since the NandFlash controllers of s3c2410 and s3c2440 are different, the s3c2440_nand.c file cannot be directly applied and needs to be modified appropriately. The main modification is the related registers of s3c2440.
First, redefine the registers to be used, remove the macro definitions between lines 27 to 37 in the original text, and change them to the following form:
#define S3C2440_NFCONT_SECCL (1<<6)
#define S3C2440_NFCONT_MECCL (1<<5)
#define S3C2440_NFCONT_INITECC (1<<4)
#define S3C2440_NFCONT_nCE (1<<1)
#define S3C2440_NFCONT_MODE (1<<0)
#define S3C2440_NFCONF_TACLS(x) ((x)<<12)
#define S3C2440_NFCONF_TWRPH0(x) ((x)<<8)
Previous article:ALSA sound card 10_Data transmission from scratch_Study notes
Next article:Camera driver learning
Recommended ReadingLatest update time:2024-11-14 15:45
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Red Hat announces definitive agreement to acquire Neural Magic
- 5G network speed is faster than 4G, but the perception is poor! Wu Hequan: 6G standard formulation should focus on user needs
- SEMI report: Global silicon wafer shipments increased by 6% in the third quarter of 2024
- OpenAI calls for a "North American Artificial Intelligence Alliance" to compete with China
- OpenAI is rumored to be launching a new intelligent body that can automatically perform tasks for users
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- ASML provides update on market opportunities at 2024 Investor Day
- Arm: Focusing on efficient computing platforms, we work together to build a sustainable future
- AMD to cut 4% of its workforce to gain a stronger position in artificial intelligence chips
- "Dating Spring" + A cherry tree in full bloom
- 【Silicon Labs Development Kit Review】+ Key Program Test
- Welcome to join the open source project--Aurora
- Looking for a software and hardware embedded engineer who works from home, salary is optional
- TMS320F28335——SCI serial port
- The sensor amplifier circuit has no output
- No phase difference? Two channels output simultaneously? This is a dual-channel power amplifier!
- mpy's LoRa driver library uPyLora
- Java Development: Map Introduction
- Can I create a C program with only a hex file?