The transplantation method of PPCBoot on MPC8250

Publisher:Serendipitous55Latest update time:2012-06-02 Source: 国外电子元器件 Keywords:Bootloader  PPCBoot  MPC8250 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1
Introduction Bootloader is a piece of code executed after the CPU is reset and before entering the operating system. It is mainly used to complete the transition from hardware startup to operating system startup and provide a basic operating environment for the operating system, such as initializing the CPU, stack, memory system, etc. Bootloader code is related to factors such as the core structure and specific model of the CPU, and its function is similar to the BOIS program of a general PC. In addition to relying on the CPU architecture, Bootloader actually also depends on the configuration of specific embedded board-level devices. In other words, for two different embedded boards, even if they are built with the same CPU, if you want the Bootloader program running on one board to run on the other board, you usually need to modify the source program of the Bootloader. Therefore, it is impossible to have a universal Bootloader in the development of embedded systems. When developing, users need to transplant according to specific system design requirements.

From the perspective of actual development of embedded systems, the boot, configuration and even the running status of embedded operating systems are all related to Bootloader. It can be said that mastering Bootloader transplantation is an important tool for the smooth development of embedded systems. In embedded Linux systems, PPCBoot is a powerful boot-loader that supports multiple CPU architectures, but it is also relatively complex.

This article takes the MPC8250 microprocessor and embedded Linux as the background, and provides a targeted transplantation method for PPCBoot on the development board, which can be applied in the application development of embedded Linux systems based on MPC82xx series processors.

2 Introduction to PPCBoot
PPCBoot is a bootloader developed by the German DENX team for a variety of embedded CPUs. It is mainly maintained and developed by German engineer Wolfgang Denk and a group of freelance developers on the Internet. It supports multiple processor platforms such as PowerPC, ARM, MIPS, and m68K, and is easy to tailor and debug.

PPCBoot follows the GPL (General Public License) convention and is completely open source. The PPCBoot source code can be obtained from the community server of the sourceforge website. Its project homepage is http://sourceforge.net/projects/ppcboot, and it can also be downloaded from the DENX website http://www.denx.de. The version used by the author is PPCBoot-2.0.0.

The main features of PPCBoot are listed in Table 1.

3 Operation flow of PPCBoot
When MPC8250 is powered on or a reset signal is applied, the CPU determines its state by reading the value on the data bus D[0:31] or according to the internal default constant D[0:31]=0x00000000. If RSTCONF# is low when the CPU reads the bus value, the hard reset configuration word (HRCW) is read from the bus. If RSTCONF# is high, HRCW uses the internal default value. After power

-on, the startup storage controller CSO# (corresponding to the chip select signal of Flash) is valid, Flash is selected, and the CPU address line outputs the address 0x00000100 corresponding to the hardware reset interrupt vector, and starts reading the first instruction. In PPCBoot, this instruction corresponds to the _start: label in /ppcboot/cpu/mpc8260/start.S. The following describes the specific startup process.

(1) Run start.S (/ppcboot/cpu/mpc8260/start.S) and execute from the start: label. After completing the basic initialization of the CPU itself, it mainly initializes some states of the CPU internal registers, mainly setting IMMR, ICTRL, D-cache, I-cache, etc. Execute from in_flash:, set the C language working environment, and then transfer to the code bl cpu_init_f (step 2) and bl board_init_f (step 3).

(2) CPU bottom-level initialization (/ppcboot/cpu/mpc8260/epu_init.C) Jump from start.S to the function cpu_init_f (volatileimmap_t*immr) to perform CPU bottom-level initialization, mainly setting the watchdog, SIUMCR register, timebase register, PIT (periodic interrupt register), phase-locked loop, system timer, storage controller and CPM, etc. [page]

(3) The first initialization of the board (/ppcboot/lib_ppc/board.c) After completing step 2, the return address is placed in the LR register, and then jump from start.S to the function board_init_f (ulong bootflag), which implements the first initialization of the board, completes SMC initialization and some hardware tests. In particular, RAM is initialized, and memory space is allocated to save board information and prepare to redirect code in RAM. Then call the relocate_code function to move PPCBoot to RAM for execution.

(4) Move code to memory (/ppeboot/cpu/mpc8260/8tart.s)
Jump from the function board_init_f to the relocate_code() function in /ppcboot/cpu/mpc8260/start.S, then move the code to SDRAM, adjust the GOT table, do some relocation, and start running the code in RAM.

(5) The second initialization on the board (/ppcboot/lib_ppc/board.C) After the relocate_code() function, it will jump to the board_init_r() function to perform the second initialization, mainly completing the initialization of some data structures, high-end modules and system devices.

(6) Command analysis and execution (/ppcboot/commom/main.C) After initialization, PPCBoot will execute the main_loop() function loop in the function board_init_r(), that is, the monitoring program. The monitoring program of PPCBoot will complete the pre-set work according to the user's input from the console. This function is in /ppebooffeommom/main.c. In the function main_loop(), the run_command() function in /ppeboot/com-mom/main.C will be called to complete the command analysis and then execute the corresponding processing function.

4 Modification and compilation of PPCBoot source code
To port PPCBoot to a new development board, the source code of PPC-Boot should be modified according to the specific system design requirements and the system hardware configuration.

The porting mainly includes two levels of porting. The first level is the porting for the CPU. The CPU types supported by PPCBoot are in the directory /cpu, and MPC8250 corresponds to the directory /cpu/mpe8260; the second level is the porting for the specific board, which mainly modifies the code according to the developer's own specific design. In order to reduce the workload, you can select a board with hardware similar to your own development board from the demo board supported by PPC-Boot as a template. Here, the author selects the MPC8260ADS board as the reference board and directly modifies the source code files related to the board. 4.1 Development board hardware Before modifying the PPCBoot source code, you must understand the hardware configuration of the development board and make corresponding modifications to the configuration values ​​in the source code according to the hardware configuration. Table 2 lists the basic hardware information of the board. In addition, the peripheral device interfaces of the MPC8250 development board mainly include 10/100M adaptive network card interface, RS232 serial port, PCI interface and full-function JTAG debugging interface. 4.2 Modify PPCBoot source code From the perspective of the minimum requirements for porting PPCBoot and the normal startup of PPCBoot, and after comparing the similarities and differences between the MPC8260ADS board and the development target board, the following files are mainly considered for modification. (1) Modify the header file mpc8260ads.h. mpe8260ads.h is the board configuration file. It configures the board's CPU, system clock, SDRAM, Flash system and all other development board information. It is the most important file that needs to be modified. Set the IMMR CPU register base address in this file. Note that this value must be the same as the operating system setting. #define CFG-IMMR 0xF0000000 Set CPU clock #define CONFIG_8260_CLKIN 33333333 /*in Hz */ Setting: Flash, SDRAM, including base address, size, offset and size of environmental parameters, and memory refresh cycle, should be set according to the specific situation of the target board; set environmental parameters for network download and startup; in addition, memory control values ​​such as BR0, OR0, BR1, OR1, Watch.dog and some target board specific parameters should also be set according to the actual situation. (2) When Linux starts, it needs to obtain memory base address and size, clock frequency, baud rate, IP address and other parameters from PPCBoot, so the member order of the structure bd-info defined in the ppcbooth file must be consistent with the definition of the Linux operating system to achieve correct parameter transmission. (3) Modify mpc8260ads.c. mpe8260ads.c configures the I/O port table, initializes SDRAM, and completes the board verification work. Among them, the I/O port table configures the network port and some other general I/O ports on the board. The function initdram completes the initialization of SDRAM according to the configuration of SDRAM registers. (4) Modify config.mk. Modify ppcboot/board/mpc826Oads/config.mk and set TEXT_BASE=0xEF000000 so that the value of TEXT_BASE is the same as the value of CFG_FLASH_BASE in the header file. This value defines the boot address.



















4.3 Compile PPC-Boot
After the code modification is completed, it is necessary to recompile. The compilation of PPC-Boot requires the establishment of a PowerPC cross-compilation environment on the Linux host. It is usually complicated to establish a cross-compilation environment step by step by yourself. The easiest way is to use the cross-compilation tool compiled by others. The author uses the complete development tool set CDK provided by MontaVista. [page]

After establishing the cross-compilation tool on the RedHat Linux9.O host, modify the Makefile file in the PPCboot directory, specify the full path name of the cross compiler, and then use the following command to configure and compile:
#make MPC8260ADS_ config
#make
After the compilation is completed, 3 files are obtained:
* ppcboot: This is an ELF (Executable and Link Format) format file that can be recognized by most Debug programs.
*ppcboot.bin: This is a binary bin file, pure ppeboot binary execution code, does not contain ELF format and debugging information. This file is generally used to install and burn ppcboot to the user's development board.
*ppcboot.srec: Motorola's S-Record format. It is a file that can be downloaded to the development board through the serial port. 5. Transplant the ppcboot.bin file compiled by PPCBoot and download it to the starting address of Flash through the JTAG interface. After powering on again, you can see the startup information of PPCBoot: PPCBoot 2.0. O(Jul 12 2005-18:21:391 RewinTeeh: Fengjunping&&Huangjianzhong MPC8260 Reset Status: External Soft.Extemal Hard MPC8260 Clock Configuration —Bus—to—C0re Mull 5x.VCO Div 2,60x Bus Freq 20—60, Core Freq 100-300-dtbrg 0, coreen f Oxob, busdf 5, cpmdf 1, plldf 0, pnmf 2 - vco__out 199999998, scc_elk 49999999, brg_elk49999999 - cpu_clk 166666665, epm_clk 99999999, bus_clk33333333 CPU: MPC8260 (Rev 14, Mask unknown [immr = 0x0064, k = 0x002d]) at 166.666 MHz Board: Motorola MPC8260ADS I2C: ready DRAM: 16MB F1ash: 16 MB ***Warning—bad CRC. using default environment In: serial Out: serial Err: serial stan linux now (y/n): => Input help to get a list of all commands. Help command lists the functions of the command. Then test the Flash and network card. If they work properly, it means that the work of porting PPCBoot is basically completed. You can then debug the kernel and file system. In the actual process, it may be necessary to modify it several times due to inconsideration. After the porting is successful, you can also add some other functions (such as LED driver, etc.). It is relatively easy to add functions on this basis.























6 Conclusion
Bootloader is the hub of operating system and hardware in embedded development. It provides necessary conditions and parameters for the startup of operating system kernel. In the process of porting, developers should not only master the structure and workflow of Bootloader, but also have a certain understanding of related hardware. At present, the PPCBoot ported by the author can run stably on the development board, and can load the kernel and file system through FIash and network, which lays a good foundation for subsequent development, especially the development of driver. For different CPUs and development boards, the basic methods and steps are the same. The author hopes that his experience can help relevant embedded designers.

Keywords:Bootloader  PPCBoot  MPC8250 Reference address:The transplantation method of PPCBoot on MPC8250

Previous article:The pitfalls of crossing data types
Next article:Design of Bidirectional Silicon Controlled Rectifier Trigger Circuit

Recommended ReadingLatest update time:2024-11-16 21:34

Unable to use DFU method of built-in Bootloader for firmware upgrade
1 Introduction This article will analyze the problem that customers cannot use the DFU method of the built-in Bootloader to upgrade the firmware. 2 Problem Description The customer used STM32F205VET6 and made a minimum system test board. When connected to the PC with BOOT0=1 and BOOT1=0, the DFU device could not be d
[Microcontroller]
Unable to use DFU method of built-in Bootloader for firmware upgrade
AVR MCU BootLoader function application source code and detailed introduction
1. Title: Application of BootLoader Function of AVR MCU 2. Introduction of Featured Chip Technology and Instructions: Most Mega series MCUs in AVR MCU have the function of self-programming of on-chip boot program, namely BootLoader function. MCU realizes self-programming by running a BootLoader program resident in
[Microcontroller]
Use J-Link to burn bootloader to Mini2440 Nor Flash
1 Development Environment     Host: Windows + VMWare + Ubuntu16.04     Development board: Mini2440     Emulator: JLink V8 2 Wiring and drive     The wiring diagram is shown below:                           Figure 1 J-Link and Mini2440 wiring diagram Download the driver and install it, then open J-Link Commander. If
[Microcontroller]
27. Operation of lighting up LED
Led can be used as a tool for debugging programs: In the early stages of development of embedded system software, such as Bootloader and kernel, since hardware such as serial ports have not yet been initialized, the debugging methods are quite limited. At this time, Led can be used as a debugging method. OK6410
[Microcontroller]
27. Operation of lighting up LED
What is the boot loader for automotive MCU?
Bootloader The bootloader of an automotive MCU is a software used to load and update applications on an automotive electronic control unit (ECU). It has the following main functions and implementation points: Bootloader: The bootloader is responsible for starting and loading the application on the MC
[Embedded]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号