-
Host: VMWare--Fedora 9
-
Development board: Mini2440--64MB Nand, Kernel: 2.6.30.4
-
Compiler: arm-linux-gcc-4.3.2.tgz
-
u-boot:u-boot-2009.08.tar.bz2
2. Transplantation Steps
The features of this transplant include:
-
Support Nand Flash read and write
-
Support booting from Nor/Nand Flash
-
Support CS8900 or DM9000 network card
-
Support Yaffs file system
-
Support USB download (not yet implemented)
1. Understand the main directory structure and startup process of u-boot, as shown below.
#tar -jxvf u-boot-2009.08.tar.bz2 //Unzip the source code |
#cp -rf smdk2410/* my2440/ //Copy all the codes under 2410 to 2440 #cd my2440 //Enter the my2440 directory #mv smdk2410.c my2440.c //Rename smdk2410.c under my2440 to my2440.c #cd ../../../ //Back to u-boot root directory |
COBJS := my2440.o flash.o //Because we renamed smdk2410.c to my2440.c under my2440 |
3) Modify the Makefile file in the u-boot directory. Find the smdk2410_config, and create the compilation options of my2440_config according to the format of smdk2410_config. In addition, specify the cross compiler.
#gedit Makefile |
CROSS_COMPILE ?= arm-linux- //Specify the cross compiler as arm-linux-gcc smdk2410_config : unconfig //2410 compilation option format my2440_config : unconfig //2440 compilation option format *Description: arm: CPU architecture (ARCH) arm920t: CPU type my2440: corresponds to the directory where a new development board project is created under the board directory samsung: The parent directory of the new development board project directory. If you create a new development board project directory directly under board, this will be NULL s3c24x0: CPU model *Note: The second line of the compilation option format must start with the Tab key, otherwise the compilation will fail. |
4) Test and compile the newly created my2440 development board project
#make my2440_config //If Configuring for my2440 board... appears, the settings are correct #make //After compiling, the u-boot.bin file will appear in the root directory, and the first step of u-boot transplantation is completed |
So far, u-boot is of no use to my my2440 development board. The above transplantation only builds a u-boot framework for the my2440 development board. To realize its functions, the u-boot source code must be modified according to the specific resource conditions of the my2440 development board.
3. Analyze or modify and add the u-boot source code according to the steps of the u-boot startup flowchart to make it suitable for the my2440 development board (Note: the modified or added places are indicated in red).
1) Analysis of the stage1 entry point of the u-boot of the my2440 development board.
Generally, in embedded system software development, after all source code files are compiled, the linker needs to read a link allocation file, which defines the program entry point, code segment, data segment, etc. The link file of our my2440 development board u-boot is cpu/arm920t/u-boot.lds. Open the file and some of the code is as follows:
Knowing that the entry point of the program is _start, we open the first program to be run by the my2440 development board u-boot, cpu/arm920t/start.S (that is, the stage1 part of u-boot), and find the location of _start as follows:
From this assembly code, we can see that the program jumps to start_code and starts execution. Then the code at start_code is as follows:
/* start_code: bl coloured_LED_init //The two lines here are to initialize the LED on the AT91RM9200DK development board |
From this we can see that start_code is the real starting point of the u-boot startup code. The above is the process of the u-boot stage1 entry.
2) Initialization of hardware devices in stage 1 of u-boot of my2440 development board.
Since there are two lines of AT91RM9200DK LED initialization code in the u-boot startup code, but the LED resources on my2440 are inconsistent with those of the development board, we need to delete or shield the code there, and add the LED driver code of my2440 (Note: adding the my2440 LED function is only used to indicate the running status of u-boot, which is convenient for debugging. You can put this code anywhere you want to debug). The code is as follows:
/*bl coloured_LED_init//These two lines are the LED initialization of the AT91RM9200DK development board, comment out #if defined(CONFIG_S3C2440) //Different from other development boards //According to the mini2440 schematic diagram, the LEDs are controlled by ports PB5, 6, 7, and 8 of the S3C2440. The following are the base addresses of the PB port registers (check the DataSheet of 2440) //The following register operations refer to the S3C2440 DataSheet ldr r0,=GPBCON //Configure PB5, 6, 7, 8 as output ports, corresponding to bits 10-17 of the PBCON register ldr r0,=GPBDAT //This code turns on LED1 on the development board after u-boot is started, while LED2, LED3, and LED4 are off |
Add CONFIG_S3C2440 macro in include/configs/my2440.h header file
#gedit include/configs/my2440.h |
#define CONFIG_ARM920T 1 /* This is an ARM920T Core */ |
3) Add support for some registers of S3C2440, interrupt disable part and clock setting part in u-boot.
Since the registers and addresses of 2410 and 2440 are mostly the same, we can just add support for 2440 based on 2410. The code is as follows:
In addition to adding the clock part of S3C2440 in start.S, you also need to modify or add some codes in board/samsung/my2440/my2440.c and cpu/arm920t/s3c24x0/speed.c, as follows:
#gedit board/samsung/my2440/my2440.c //Set the main frequency and USB clock frequency parameters to be consistent with those in start.S |
#define FCLK_SPEED 2 //The default setting is 2, which means the red code below is valid #if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */ #define USB_CLOCK 2 //The default setting is 2, which means the red code below is valid #if USB_CLOCK==0 |
#gedit cpu/arm920t/start.S |
#if defined(CONFIG_S3C2400)|| defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440) # if defined(CONFIG_S3C2400) ldr r0,=pWTCON /* ldr r0,=INTSUBMSK # if defined(CONFIG_S3C2440) //Add the clock part of s3c2440# endif #define MPLLCON 0x4C000004 //System main frequency configuration register base address #define UPLLCON 0x4C000008 //USB clock frequency configuration register base address ldr r0, =MPLLCON //Set the system main frequency to 405MHz ldr r1, =0x7F021 //This value refers to the "PLL VALUE SELECTION TABLE" section of the chip manual str r1, [r0] ldr r0, =UPLLCON //Set USB clock frequency to 48MHz ldr r1, =0x38022 //This value refers to the "PLL VALUE SELECTION TABLE" section of the chip manual str r1, [r0] #else //The clock part of other development boards, don't worry about it here, we are now working on 2440 /* FCLK:HCLK:PCLK = 1:2:4 */ ldr r0,=CLKDIVN |
#gedit cpu/arm920t/s3c24x0/speed.c //Modify the function of obtaining the clock frequency according to the set frequency division coefficient FCLK:HCLK:PCLK = 1:4:8 |
static ulong get_PLLCLK(int pllreg) if(pllreg == MPLL) m =((r & 0xFF000)>> 12)+ 8; #if defined(CONFIG_S3C2440) return((CONFIG_SYS_CLK_FREQ * m)/(p << s)); /* return HCLK frequency */ #if defined(CONFIG_S3C2440) return((clk_power->CLKDIVN & 0x2)? get_FCLK()/2 : get_FCLK()); |
OK! After the modification is completed, we recompile u-boot and then download it to RAM to run the test. The terminal will output information and a command line similar to Shell will appear, which means that this part of the transplantation is complete. The schematic diagram is as follows:
Now compile u-boot, and a u-boot.bin file will be generated in the root directory. Then we use the original supervivi of mini2440 to download u-boot.bin to RAM to run the test (Note: when we use supervivi to download, the CPU and RAM have been initialized, so we need to block the initialization of CPU and RAM in u-boot), as follows:
/*#ifndef CONFIG_SKIP_LOWLEVEL_INIT //Shield u-boot from initializing CPU and RAM in the start.S file #make my2440_config #make |
After downloading and running, you can see that the first LED on the development board is on, and the other three are off. The test results meet the above requirements. The terminal running results are as follows:
#gedit cpu/arm920t/start.S |
.globl _start |
#gedit cpu/arm920t/u-boot.lds |
OUTPUT_FORMAT("elf32-littlearm","elf32-littlearm","elf32-littlearm") SECTIONS
. = ALIGN(4); |
Previous article:Detailed explanation of Uboot transplantation on S3C2440 (Part 2)
Next article:Detailed explanation of Uboot transplantation on S3C2440 (Part 3)
Recommended ReadingLatest update time:2024-11-16 15:37
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TI High-Speed Signal Conditioning Product Selection Guide
- STM32L051's ADC conversion is inaccurate after wakeup
- Sharing of experience in single board circuit design 3-selection of pull-up and pull-down resistor parameters
- LVDS Receive
- Create a GD32VF103 project using Visual Studio Code
- Circuit Playground Star Tree
- Principles and Applications of FPGA and Specialized DSP
- nRF52 series is coming, Nordic's low-power Bluetooth solution 52832
- EEWORLD University Hall----Live Replay: Beneng International launches millimeter wave radar module based on Infineon technology, perfectly solving the pain points of PIR market
- [NXP Rapid IoT Review] + Mobile Synchronizer 2