RTEMS serial 1 cross-compiled environment

xiaoxiao2021-03-06  38

RTEMS serial 1 cross-compiled environment

Author ray

RTEMS copyright, reproduced please indicate: Source http://www.rtems.net, author ray@rtems.net

Summary

This section mainly introduces the compilation environment of RTESM.

Although RTEMS has a detailed installation document, the installation process is more complicated. Don't think that RTEMS supports i386, you can compile with Linux, remember that when I first use, I will directly fix tar.gz compression package. Configure, then make, the result is impossible to know.

The most simple way to install RTEMS is to use FreeBSD (the author's favorite), use SysInstall and select Install Package, then select FTP image (recommended to use Korea or Japan FTP image, fast speed).

Select the DEVEL sub-directory and you can see the tool chain developed by RTEMS, including the i386 compilation environment, ARM compilation environment, I960 compilation ring mirror, etc. (file name is ARM-RTEMS-GCC, ARM-RTEMS-GDB, etc.), as shown below Show:

Select these development packs to automatically install. Of course, you can also use the PKG command to easily get RTEMS so tools, and cross-compiler, and dependence. Of course, considering that many people use Linux, here is still tired of tirement telling the installation process below Linux. In addition, the cross-compilation environment can be installed using BSD.

1 get the installation package code

The first is to obtain a variety of installation packages, you can choose to install using the RPM, or you can use the source code to install, because the RPM mode can only be used for Redhat 9, the author doesn't like to use Redhat, so the following will mainly introduce the source code Compile the installation. Source code can be obtained in ftp.rtems.com / pub / RTEMS / SOURCES / directory. The source code that needs to be obtained includes:

Binutils-2.15GCC-3.3.5Newlib-1.12.0GDB-Build

Get the source code, you need to get the patch files of each source code.

Binutils-2.15-RTEMS-20040519.DIFFGCC-3.3.5-RTEMS-20041030.DIFFGDB-6.0-RTEMS-20040217.DIFF

Let's start working, first organize the folder, my directory structure is as follows:

$ HOME / Embedded / Tools / Bin / Compilation Temporary Directory GCC-3.3.5 / GCC-Build / GCC compiled temporary directory GDB-6 / GDB-Build / GDB compiled temporary directory GCC-3.3.5-RTEMS-20040108.DIFF BinUTils-2.15-RTEMS-20040519.DIFF GDB-6.0-RTEMS-20040217.DIFF

2 play patch

Then patch each source code, take GCC as an example, use the following command:

$ CD GCC-3.3.5 $ cat ../gcc-3.3.5-rTems-20040108.diff | Patch -p1

3 Configuration and Compiling Binutils can start compiling, first compile binutils, first configure binutils, enter binutils-build / directory

$ ../Binutils-2.15/configure --target = i386-rtems / --prefix = / home / ray / Embedded / Toolchain /

If you want to compile the toolchain for the ARM, you need to use:

$ ../Binutils-2.15/configure --target = arm-rtems / - prefix = / home / ray / embedded / Toolchain /

Note that both binutils or GCC and GDB are configured by configuring Target to configure the generated cross-compiler type.

Then compile the installation:

$ Make $ make Info $ make install

Next, the compiled file will appear in the / Home / Ray / Embedded / Toolchain / bin directory, in order to make the GCC can use these files, the path name must be output:

Export Path = $ Home / Embedded / Toolchain / BIN: $ {pat}

Note that it is best to use an absolute path here, you can also write it to the startup profile of the shell:

Path = / home / ray / embedded / Toolchain / BIN: $ PATHEXPORT PATH

4 compilation GCC

First establish a NEWLIB-1.12.0 symbolic link

$ ln -s ../newlib-1.12.0/newlib

Note that this is very important, this step is also an important step in distinguishing the RTEMS cross-compilation environment and other compilation environments. Then establish a compilation directory for compilation:

Mkdir gcc-buildcd gcc-build ../ GCC-3.3.5 / configure --target = i386-rtems / - gnu-as --with-gnu-ld --with-newlib --verbose / Enable-threads --enable-language = "c, c " / - prefix = / home / ray / Embedded / Toolchain / Bin / makemake Infomake Install

5 Compile GDB:

Finally compile GDB, method is similar, first configured:

../gdb-6.0/configure --target = i386-rtems / - prefix = / home / ray / embedded / Toolchain /

After compiling, the compilation environment is configured: then enter the compile environment

$ CD / Home / Ray / Embedded / Toolchain /

It can be seen that should be established below:

[Ray @ localhost toolchain] $ lsbin gcc-3.3.5 gdb-build info newlib-1.12.0binutils-2.15 gcc-build i386-rtems lib sharebinutils-build gdb-6.0 include man software [ray @ localhost toolchain] $ cd bin [ ray @ localhost bin] $ lsi386-rtems-addr2line i386-rtems-gcc i386-rtems-objcopyi386-rtems-ar i386-rtems-gcc-3.3.5 i386-rtems-objdumpi386-rtems-as i386-rtems-gccbug i386- rtems-ranlibi386-rtems-c i386-rtems-gcov i386-rtems-readelfi386-rtems-c filt i386-rtems-gdb i386-rtems-sizei386-rtems-cpp i386-rtems-ld i386-rtems-stringsi386-rtems -g i386-RTEMS-NM I386-RTEMS-Strip Finally, set .bash_profile in the $ home directory, add the following statement:

Export Path Path = / Home / Ray / Embedded / Toolchain / BIN: $ PATHEXPORT PATH

Now I should re-log in, then run

$ I386-RTEMS-GCCI386-RTEMS-GCC: No Input Files

You can also write a .c file test if you can generate .o file

转载请注明原文地址:https://www.9cbs.com/read-63376.html

New Post(0)