Analysis and Application of Motorola microprocessor bootloader

Source: Internet
Author: User
Tags codewarrior
Article Title: Analysis and Application of Motorola microprocessor bootloader. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Introduction

?? Bootloader is a program used to complete system startup and system software loading. It is a middleware software between the underlying hardware and the upper-layer application software. It initializes the processor and peripheral circuit for normal operation. It can shield the differences between the underlying hardware, this makes it easier to write and transplant upper-layer application software. It not only features similar to the Basic Input Output System (BIOS), which is commonly used on PCs, it can also have certain debugging functions. At present, there are a variety of bootloaders available for embedded system development, among which Motorola's bootloader named dBUG is superior. It can be transplanted to all the microprocessors of the Motorola MC68000, ColdFire, and PowerPC series. It has powerful debugging functions and supports single-step, download, and network updates; its good software architecture allows users to easily modify their code and expand new functions. This article takes the coldfire5307C3 development board used for network data storage as an example to analyze the structure and running mechanism of dBUG bootloader on it, and provides an example of actual modification.

I,Source code structure of bootloader

1. file organization of bootloader

The source code of dBUG bootloader can be obtained from the website of Motorola. It is an example program. By modifying the corresponding configuration file and processor-related files, it can be easily transplanted to different processor systems. The source code consists of two parts: a lib project and a separate processor project for each type of Motorola microprocessor. For example, ColdFire 5307 uses the MCF5307C3 project and the lib project together to generate the final dBUG code. The lib project contains some commands or functions unrelated to the processor, and each independent processor project is closely related to each different processor. During compilation, compile the lib project to generate standard library functions (that is, encapsulate some common commands and functions first ). Then, compile the MCF5307C3 project and combine the compiled lib project with the MCF5307C3 project to generate the final code.

The architecture of the entire dBUG bootloader code is complicated. The source code can be divided into three modules by function [1]: User Interface Component, CPU-specific Component, and Board-specific Component. After you enter the dBUG directory, you will see three subdirectories, as shown in [1, 2].


DBUG source code tree

① The first directory is the bin directory, which contains a simple TFTP Server software. TFTP is a simple FTP (file transfer protocol ). It is based on the UDP protocol and is mainly used to download the program target code.

② The second directory is the prog directory. Below are the project organization files and part of the source code of the lib project and MCF5307C3 project. In the libdbug directory under the prog directory, there is a project management File libdbug. mcp for the lib project. You can use CodeWarrior to open the project file and compile the project. The M5307C3 directory under the prog directory is the project file of the ColdFire 5307 system, and the obj directory under the directory is the generated dBUG target code. The src directory contains the project management files of the 5307 project. You can use CodeWarrior to open the/src/dbug/mwerks/M5307C3. mcp project management file in the m5307c3 directory to compile the code.

③ The third directory is the src directory, which is the main source code of dBUG.

To sum up, you only need to open the m5307c3. mcp and libdbug. mcp project files to view all the source code of dBUG.

2. Files related to processor and peripheral hardware configuration

① Entry file: vector. s.
There is a processor reset initial entry address, jump command, and interrupt vector table.

② Initialize the assembly language file: mcfxxxx_lo.s.
Function: Pre-initialize the processor, call the initialization function, and jump to the main function. Xxxx indicates a specific processor model, such as 5307.

③ Initialize the c language file: Sysinit. c.
Multiple initialization functions are provided to initialize the processor and underlying hardware.

④ System configuration files: Config. h and Board. h.
Config. h
Set the processor type and other module functions on the board.
Board. h
Set parameters on the board, for example, the size, type, data width and address range, memory space range on the partition board, system clock size, system bus rate, and other system constants to be used for off-chip Flash and SDRAM.

⑤ Connection configuration file: Flash. lcf.
Set the function space address and memory allocation during connection.

6. Pre-contained header files: mxxxx_mwerks.h and mwerks. h.
These two functions are included by all C and assembly functions. They set the constants and compiler compilation options used by the CodeWarrior Preprocessor.

[1] [2] Next page

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.