ARM Development Tools Software command detailed---embedded regression third

Source: Internet
Author: User

Start with bootloader, because for now these will be bare-metal program related!

This is the Red Hat Linux virtual machine installed on VMwarm10.0. As can be seen from the following

Bare Metal Development process:


Here is the third step (the second step in the first step has been provided), the experience summarizes the arm bare metal development needs which tools, when used in detail.

To do the third step, first install the cross-compiler!

Locate the installation package, unzip it to the root directory (unzip the add-C/)


Here the Cross tool chain is automatically extracted to the root directory under the/usr/local/arm/directory


But this time can not be directly in any directory using tools such as ARM-LINUX-GCC (can not be used to see tab can be automatically filled), this is because the tool software installed in the/USR/LOCAL/ARM/4.3.2/directory, if you do not follow this absolute path, Our Linux does not know where to look for example: ARM-LINUX-GCC this command! So how can you use this tool software without using the full path in any directory?

Answer: Modify the PATH environment variable

Vi/root/.bashrc


Then execute SOURCE/ROOT/.BASHRC


Through the above days of command can see before and after the installation changes before and after the use of ARM-LINUX-GCC command change! In fact, a lot of tool software installation is similar, extract to the specified directory, and then modify the environment variables! Then source modifies the footstep to make it effective!


First of all, there are three files in this directory. One of the led.lds is the linker footstep, LED. s assembly file.

The three commands used in the back use the cross tool chain, the linker footstep

Then we make a clean, let it back to the initial only three files when made, and found the effect is the same, this is makefile engineering management


Next, how to download our application to the Nandflash on the Development Board, usually through the Norflash or SD card System installation Auxiliary program to help us write (is to establish a connection with the PC, and then download the program on the PC to Nandflash)

Then, the command used above is parsed!

Cross tool chain:

The first one is the crossover tool, the second is the chain.

Common Cross tools:

1. Cross compiler ARM-LINUX-GCC

2. Cross-linker arm-linux-ld

3. Crossover Converter Arm-linux-readelf

4. Cross elf file tool Arm-linux-objdump

5. Cross-Disassembler arm-linux-objcopy

With ARM-LINUX-GCC--help you can see


You can see the Arm-linux-gcc-g-C LEDs. S in-G is statically compiled,-C is only compiled without links! Go through this step to generate a LED.O file!

Then the second step: Arm-linux-ld-tled.lds-o led.elf LED.O here when using a linker script is the-t parameter, here is to link all the. o files into the. Elf format of the target file! Led.elf is the name of the target file to link to, there is only one led.o file that needs to be linked here.

Use the command arm-linux-readelf-a led.elf (here-a means to view all the information for the LED.EFL file)


From here you can see some very useful information, first of all with a fixed file header! Data line, you can see that this file is running in little endian, or small-end mode. And so on, there are some other useful information!

The program does not reach the expected results three questions are generally checked first:

1. Whether it is running on the arm platform, using the command: File target file name to view

2. Check to see if the size side is arm-linux-readelf

3. See if some of the libraries used by the program are to use commands: arm-linux-readelf-d the target file name (you can see which libraries the target files must use to run on the target board, and if the library is not on the board, it must not be running)


ARM Disassembler: It's very useful in the bottom-level programming! Can see the assembly code! (i.e. how to turn a program into a compiled version)

Command mode: arm-linux-objdump-d-S target file directly enter the disassembly code can be seen, but if the disassembly file is longer, you can

Export the disassembly to a file for easy viewing! Usage:arm-linux-objdump-d-S target file >dump (output to dump file under current directory) viewing disassembly code is useful for analyzing problems! (with ARM-LINUX-GCC compile with the-G option to make it easier to parse the disassembly file) here is no demonstration! Trouble! And these operations are mostly used more will be very handy! Analyze the problem to be quite to the force!

File format converters: Arm-linux-objcopy You can see from the previous example that the files that are connected and the files that are compiled can be seen in the ELF format, and the ELF format files cannot be run directly on the ARM board! The ARM board can run must be a binary file! The file converter is converting Elf-formatted files into a binary file that can be run on the ARM board!

Usage: arm-linux-objcopy-o binary led.elf led.bin (arm-linux-objcopy-o option represents the output file binary means the output file format is binary led.elf represents the elf file to be converted, l Ed.bin indicates the name of the output target file, the general file format is. bin suffix)

Here are the most commonly used 5 commonly used tools are finished! The name of the compiler may not be the same at work! But the following key names such as Objcopy, LD and so on are all the same! Generally unfamiliar with the use of the Word tool name--help will tell you how to use! In short, more hands-on practice!

Here is a brief introduction to the Makefile Project management used above:

Using the GNU make tool to manage programs is a skill that every Linux engineer must master. Make makes it possible to compile and link the entire program with just one command made.


Above can be seen compiling a program can be a command of a command of the progressive compilation! You can do it with just one make! When you need to compile a lot of source files, a single command to compile will be quite troublesome! Then the Makefile Project management is born!

Here to paste a Web site, about makefile blog written is still very good: http://blog.csdn.net/huiguixian/article/details/7049804

The following is a brief look at the contents of the makefile file above:


In fact, this is the above single use of the command in accordance with certain rules combined together!

Makeflie use: Make's work relies mainly on a file called Makefile, makefile file describes the whole process of compiling, linking and other rules, including: The project of those source files need to compile and how to compile, how to finally produce the executable file we want.

Makeflie Composition---Rules

The most important component of Makefile is "rules"

Rules: Used to illustrate how to generate a target file, the format of the rule is as follows:

Targets:prerequistes

Command

Target dependent commands

Special Note: The command needs to use the TAB key space


Makefile constitute---pseudo-target

In makefile, those objects that contain only commands and no dependencies are called "pseudo-targets" (phony targets)

. Phony:clean

Clean

Rm-f Hello main.o ...

". Phony "clean" target declared as pseudo-target


Makefile constitute---ultimate goal

1. How do I execute a rule individually when there are multiple rules in a Makeflie? If the user does not specify a rule to execute, make defaults to the first rule in Makefile, and the goal in this rule is called: the final target

Makeflie Rules---Variables

In Makelife, users can also use default variables that are already defined in the system, in addition to defining their own variables.

$^: On behalf of all dependent files

[email protected]: represents the target

$<: Represents the first dependent file

For example, before use:

Led.o:led. S

Arm-linux-gcc-g-O led.o-c led. S

After use:

ARM-LINUX-GCC-G-o [email protected]-C $^

Makefile Use tips---go back to display

The content after the "#" character in Makefile is treated as a comment

"@" in Makefile means canceling echo

Makefile Tips---file names

The make command finds the project file named Makeflie or makefile by default in the current directory, and when the name is not for either of these, you can specify the following method: Make-f file name


The magical role of linker scripting

It's important to have a lot of contact with the linker script in bare-metal programs, kernels, drivers, and uboot learning!

Here is a brief introduction to the above used LED.LDS linker script, first look at the above used Led.lds script


Let's step through the analysis below:



Linker Script---Segment

An executable program is usually made up of code snippets, data segments, BSS segments, and also in the linker script used to link the program, which will reflect the information in these paragraphs.

Generally writing linker scripts is divided into the following steps:

1. Create linker Script--segment information

2. Set the start link address

3. Alignment settings

4. Using variables

5. Set the first file of the code snippet

This is not very complicated either! It's not going to be explained here! Or that sentence! Be sure to practice more! This knowledge can be Baidu search! Look at blogs written by others! The above-mentioned more detailed!

Configuration of the Eclipse integrated development environment! This is mostly on PC Linux with some configuration! The whole several times, the steps a little bit of trouble, but also in the company did not feel more useful! I still write C code conveniently with notepad++! Personal habits! Let's not dwell on it! But there is an online debugging simulation function is quite powerful, especially when debugging the program is simply an artifact!

ARM Development Tools Software command detailed---embedded regression third

Related Article

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.