Learn about embedded development today from the first simple program "HelloWorld". Some Linux commands are used in this example, and these are the most basic commands for Linux. Before you begin, say what these commands mean.
The first step: Prepare for knowledge learning.
1. File View command ls.
With parameters: Ls-l
All properties of the file are displayed, such as file permissions, modification dates, and so on.
2. Create file Directory command mkdir.
Example: mkdir zhe
Create an empty directory with the file name Zhe. An empty directory named Zhe is created as shown.
3. Directory Switch Command CD.
Example: CD Zhe
Enter the directory named Zhe as shown.
4. Create a new file that does not exist command touch.
For example, Touch hello.c creates a file named hello.c.
Create a nonexistent file hello.c as shown in.
5, Text editor VI.
For example: VI hello.c Open File HELLO.C.
The VI Editor enters the reading mode by default and enters the insert mode by entering the lowercase letter I, which allows you to write to the file. As shown,
When the edits are finished, you need to save the edits to the content. When you need to switch the reading mode, press the "ESC" key to enter the reading mode. Enter ":" Into the command mode at this time. "Wq" means to save and eject the hello.c file. As shown
After the command input, press ENTER to complete the Save and launch the command. Back to the Linux command line.
6. Compile command: ARM-ANGSTROM-LINUX-GNUEABI-GCC
Example: Arm-angstrom-linux-gnueabi-gcc-o Hello hello.c
The hello after-O is the compiled file, which specifies that the hello file will be generated after compilation. Compile as shown. Note that the development Board comes with a GCC compiler. Simple *.c files can be run directly inside the Development board.
7. Implementation of the document.
As shown, if you want to execute the hello file, you need to enter the./hello, as shown in.
Step Two: The Bb-black Development Board comes with a GCC compiler. So there is no need to install a Linux virtual machine on the PC, and then install the cross-compilation environment, there is no need for such a complicated process, after all, the process is more painful for beginners. Wait until you have mastered the basics and then go back to the research, creating files directly here.
1. After logging into the Development Board, create a new empty directory to store your project files, and then create an empty file under the project file.
2, next need to edit the hello.c file through the vi command, edit complete, compile, run.
Such a simple Hello World program is done. This process has learned a lot of common Linux commands.
Bb_black_ Study Notes-(2) or start with HelloWorld C programming