1 Introduction
The use of embedded real-time operating systems can enhance system performance, ensure system stability and reliability, and facilitate maintenance and development of applications. Therefore, it is increasingly used in various embedded systems. eCos (Embedded Cofigurable Operating System) is an open source, royalty-free, real-time embedded operating system, suitable for deeply embedded applications, and is mainly used in consumer electronics, communication products, automotive electronics and other fields. Unlike other embedded real-time operating systems, eCos has unique configurability and configuration mechanisms. At the same time, eCos has good openness, compatibility, stability, scalability and portability, and supports many microprocessors such as ARM, MIPs, M68K, and PowerPC. Therefore, ecos has attracted increasing attention from embedded designers and is being increasingly used in embedded products.
2 Introduction to eCos architecture
ecos uses a multi-task preemption mechanism, has small interrupt delay, supports same-priority scheduling, supports all synchronization primitives required by embedded systems, and has flexible scheduling strategies and interrupt processing mechanisms. Moreover, ecos provides complete embedded development functions, including device drivers, memory management, exception handling, standard library functions, GNU compilation toolset, etc.
eCos adopts a modular design, dividing software with different functions into different components. These components are reusable and located at different levels of the system. This layered structure makes eCos have good configurability, portability, Compatibility and scalability. The hierarchical structure of eCos is shown in Figure 1.
The lowest level in the eCos system is the hardware abstraction layer HAL (Hardware Abstraction Layer), which is responsible for operating and controlling the target system hardware platform, including hardware initialization, interrupt and exception handling. HAL shields the differences in underlying hardware and provides a unified interface for the upper layer. In the transplantation of eCos, the key is to modify the HAL, so that the entire eCos system can be transplanted to the new hardware platform. HAL can be divided into architecture abstraction layer (Architecture HAL), variant abstraction layer (Variant HAL) and platform abstraction layer (Platform HAL) according to the different hardware objects described.
Figure 1 Hierarchical structure of eCos
RedBoot is a Boot Loader program provided by eCos. RedBoot can boot the eCos system, load eCos applications, provide debug support, manage the target system environment parameters, etc.
The device driver is responsible for controlling and managing hardware devices and completing read and write operations of device data. The driver provides API functions for upper-layer software, and the application layer uses API functions to access the device. Complete the operation of the device.
The kernel is the core of eCos. It is responsible for task scheduling, synchronization primitives, handling interrupts and exceptions, memory management, timing mechanism, and ensuring the real-time performance of the system.
The OS abstraction layer implements TCP/IP network protocols, file systems, standard library function calls, etc., and provides API interface functions for embedded application layer software and applications.
The layered structure of eCos makes the entire software structure clear and has good maintainability and portability.
3 LPC2294 hardware platform
LPC2294 is an embedded microprocessor chip from NXP Company. Belongs to ARM7TDMI-S series. LPC2294 has rich on-chip resources and low power consumption. It is cost-effective and can be used in various embedded fields such as communication gateways, industrial control, and medical equipment. Figure 2 is the structural block diagram of the hardware platform:
Figure 2 Hardware platform block diagram
The hardware platform takes the LPC2294 processor as the core, and peripheral devices include 8MB NOR nash (SST39VF6401B), 512kB SRAM (IS61LV51216), standard 20-pin JTAG interface, RTL8019 network card chip, RS232 serial port, etc. This article is based on this hardware platform. This article introduces the transplantation work of eCos and provides an example for the transplantation and development of eCos using ARM core as the processor.
4 Transplantation of eCos on LPC2294
Since eCos supports most embedded CPUs and has strong portability, the transplantation work of eCos is mainly HAL transplantation. Among them, the transplantation of the platform abstraction layer is the focus of HAL transplantation, including modifications such as memory layout, platform initialization, interrupt controller, and serial port driver. During the migration process, if you want to transplant eCos to a CPU architecture that does not yet support it, a simple and efficient method is to use the hardware platform of the CPU with the same architecture that eCos already supports as a template to create a CDL file. Register in ecos.db to adapt to the new target platform and then carry out the transplantation work. The latest version of eCos already supports the LPC2294 processor, so the main task of transplanting ecos to the LPC2294 is to modify the relevant files of the platform abstraction layer. Use graphical configuration tools to configure, compile and generate image files to complete debugging and transplantation.
4.1 Establish cross-compilation environment and configuration tools
The source code of eCos can be downloaded from the website of eCos maintenance company eCosCentric. The address is http://www.ecoscentric.com. Because eCos uses the GNU tool set for compilation. Therefore, the host of this article uses the RedHat9.0 operating system, and installs the gcc-3.2.1, binutils-2.13.1, newlib-1.11.0, insight-5.3, wxGTK-2.4.0 tools, and also installs the cross-compiler arm-elf -tools tool to establish eCos cross-compilation environment for ARM platform.
In addition, the steps to generate the eCos configuration tool according to the host environment are as follows:
Unzip eCos into the /opt directory, and create the src, wxbuild, infra-build, ecos-tools, and configtool-build directories in the /opt directory. First, configure wxWidget static link support, compile and install wxGTK, and execute the following command: cd /opt/wx build; /opt/src/wxGTK-2.4.0/configure disable-shared disable sockets prefix=/opt/wxGTK-2.4. 0; make; make install
To configure, compile and install the basic host environment of eCos, execute the following commands:
cd /opt/infra -build; /opt/ecos/host/configure prefix=/opt/ecos-tools; make; make install
Compile and install the ecos configuration tool and execute the following command:
cd /opt/configtool -build; make f /opt/ecos/host/tools/configtool/standalone/wxwin/makefile. gnu install WXDIR=/opt/wxGTK2.4.0 ECOSSRCDIR=/opt/ecos/host INSTALLDIR=/opt/ ecos-tools
In this way, the eCos configuration tool installation is completed. It is located in the /opt/ecos-tools/bin directory and includes the graphical configuration tool configtools and the command line configuration tool ecosconfig.
4.2 Configure the basic hardware platform
The files related to LPC2294 are in the ecospackageshalarmlpc2xx directory, run the graphical configuration tool configtools in /opt/ecos-tools/bin, and select a template similar to LPC2294 in the Templates of the huild option. You can perform specific platform-level configuration. This article selects the phyCORE-LPC2294/92 development board HAL template as the basic configuration platform, and modifies the options in ecos according to the actual target system platform. The main modifications include:
a) Modify the value of the ARM vector at 0x14 option. The LPC2XXX series processors use the value at ox14 as a valid user code judgment condition. It should meet the requirement that the cumulative sum of the 32-bit data in the vector table is 0;
b) Modify the value of the CPU xtal frequency option. This is the CPU crystal oscillator value. The default is 10MHz. Modify it to 11059200 according to the actual situation;
c) Modify the value of the CPU PLL multiplier option. The internal PLL multiplier value defaults to 6 and is modified to 4;
d) Modify the value of the eCos kernel option and delete unnecessary options in the kernel as needed;
e) Modify the value of the I/O sub-system option and configure the I/0 option according to the actual I/0 device;
f) Modify other configuration options to suit the target system platform.
In this way, most options of eCos are configured through the graphical configuration tool. However, the graphical configuration tool cannot complete all eCos configuration functions. Therefore, it is also necessary to modify the memory distribution file and Flash driver file.
4.3 Modify memory layout
The memory layout file is in the ecos/packages/hal/arm/lpc2xxx/phycore229x/current/include/pkgconf directory. It contains configuration files for two different startup methods: RAM and ROM, and each startup method corresponds to three file formats. , respectively:
ldi file, link script file, defines the starting address, length and segment address of the memory domain of LPC2294, which is used when linking the program.
h file, using c macro definition to describe the starting address and size of the LPC2294 memory. Specify the starting address and size of the heap when the program is running.
mlt file, a file saved by the configuration tool, can only be generated and changed by the configuration tool and cannot be modified manually.
Taking LPC2294 as an example, the definition in the mlt_arm_lpc2xxx_phycore229x_rom.h file needs to be modified when the ROM is started. Taking the off-chip ROM allocation and heap address allocation as an example, the code is as follows:
#define CYGMEM_REGlON—flash (0x80000000)
#define CYGMEM_REGl0N_flash_SIZE (CYGHWR_HAL_ARM_PHYCORE229X_FLASH_SIZE)
#define CYGMEM_REGlON_flash_ATTR (CYCMEM_REGION_ATTR_R)
Previous article:LPC2294 chip forms an intelligent controller to realize remote monitoring of smart home appliances
Next article:Design of digital UPS based on LPC2214 microprocessor
- Popular Resources
- Popular amplifiers
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- MSP430 MCU Development Record (18)
- TI C6000 DSP Basics: GPIO
- Multi-UART Expansion Based on IP Core and Its FPGA Implementation
- PCB drawing issues
- Research on Hybrid Programming of TMS320C6000 DSP
- Oscilloscope probe compensation principle - explain the fundamental reason for oscilloscope probe compensation calibration
- What is the principle of this negative pressure module in the circuit?
- Types of defects in the EMC packaging forming process
- Application of millimeter wave radar technology in corner radar
- Smart Camera Structural Design--Physical Assembly