Embedded Linux Learning Notes (based on s5pv210 TQ210)

Source: Internet
Author: User
Tags gmp spl posix

Based on s5pv210, TQ210 platform.

This article is more about how we learn!

Include the following:

1. Preface

2. Construction of development environment

3. Make Cross Compiler

4. Bare Metal Programming

4.1. Compilation study
4.2. s5pv210 Start-up process
4.3. Light an LED
4.4. Serial port
4.5. Implement printf
4.6. Clock configuration
4.7. Re-positioning
4.8. DDR
4.9. NAND read and write
4.11, LCD operation

5, transplant U-boot (based on u-boot-2014.4 version)

5.1. Overview
5.2. U-boot Configuration Process Analysis
5.3, u-boot compilation process Analysis
5.4. SPL
5.5. Add your own veneer
5.6. Transplant U-boot-spl.bin
5.7. Transplant U-boot.bin
5.7.1, U-boot.bin Memory layout analysis
............

6. Porting the kernel

7. Making File System

8. Drive

9. Comprehensive Application

4. Bare Metal Programming


1 Preface

Learning embedded, the first need to learn C language, recommend everyone to see Hao bin C language Video tutorial, do not ask me where the video. Here quoted a netizen's words: I searched the internet a lot of C language teaching video, but are talking about a mess, some are scripted, never knock code, do a good PPT read, that a special talk about it. However, Hao teacher speak of C language is too sharp, simple and clear do not say, the teacher every bit of things are still used to knock out the keyboard, if the difficulties encountered the teacher will carefully explain the analysis of ideas, so you do not accept, also have to accept. Think of the university, the teacher is really tragic, talking about the foaming, in the end few people really understand the C language this course.

In addition, you need to be familiar with the use of Linux distribution, recommended to use Ubuntu, because the installation of software is very convenient, more information on the Internet. Familiar with the basic command operation of Linux system, familiar with the basic operation of Makefile, we recommend you see "bird Brother's Linux private dishes _ Basic Study (third edition)" and "GNU make Chinese Manual."

This article takes s5pv210 as the learning platform, uses the TQ210 Development Board.

Personal qq:809205580

Technology Exchange Group: 153530783

Personal blog: http://blog.csdn.net/zjhsucceed_329

This article all source code, tool: Http://pan.baidu.com/s/1fEfG6


2 Development Environment Construction

How to use vmware-workstation virtual machine +linux System

First download the vmware-workstation (http://pan.baidu.com/s/1pJyk0gr) and press the default installation.

Then install Ubuntu system, you can download the Ubuntu image file from Http://pan.baidu.com/s/1eQziJh4, refer to my Blog "ubuntu-10.10 Embedded development environment building" to build Ubuntu environment.

or download the Ubuntu image file I made right from HTTP://PAN.BAIDU.COM/S/1DDIHDG1

Ubuntu-10.10-x86-bk.rar, download and unzip to the appropriate location, such as my own environment is:


Then open vmware-workstation.


Set First, select Edit->preferences


Set the virtual machine location.

Select View->autofit window so that the size of Ubuntu will automatically change to the appropriate size when the vmware-workstation size changes, provided that VMware Tools is installed.

Select File->open, locate the folder you just unzipped, select Ubuntu.vmx, and then open it.


Then click to launch Ubuntu System, dialog box appears


Select I moved it


User name is root, password is zjh329


If you do not have VMware Tools installed, start the installation now, select Vm-> install VMware Tools, and then perform the following commands in Ubuntu:

[Email protected]:~# cp/media/vmware\ tools/vmwaretools-*. Copy to current directory

[Email protected]:~# tar-zxvf vmwaretools-*

[Email protected]:~# cd vmware-tools-distrib/

[Email protected]:~/vmware-tools-distrib#./vmware-install.pl

Next all the way Yes and enter until the installation is complete.

[Email protected]:~# rm-r vmwaretools-* vmware-tools-distrib/

Restart the system, now feel free to change the size of the Vmware-workstation window, Ubuntu window size will automatically adapt.

To create a folder share for Windows to Ubuntu:

Vm->settings, select options, choose Shared Folders,


Click Add in the lower-right corner to share the folder, select Always enabled above, and confirm the Ubuntu system restart. You can then access the folders under Windows under Ubuntu. For example I share the E-drive:

[Email protected]:~# ls/mnt/hgfs/e/

3 Making cross-compilation toolchain 3.1 Download tool crosstool-ng http://www.crosstool-ng.org/3.2 Installing the Crosstool-ng software dependency package

Apt-get Installbison Flex texinfo automake libtool CVS libncurses5-dev aria2 g++ Subversiongawk cvsd

3.3 Compiling and installing Crosstool-ng

Because Crosstool-ng by default can only use ordinary users to make cross-compiler, if you want to use root user operation, you can modify the Crosstool-ng source code scripts/crosstool-ng.sh.in This file, which has a line "# Check Running as root", add ct_allow_build_as_root_sure=trueabove it so that you can use the root operation.

Start compiling the installation below:

[Email Protected]:/home/work/crosstool-ng-1.19.0#./configure

[Email protected]:/home/work/crosstool-ng-1.19.0#make && make install

3.4 Start making cross compilers now

[Email protected]:/home/work#mkdir crosstool First create a working directory:

[Email PROTECTED]:/HOME/WORK#CD Crosstool

[Email protected]:/home/work/crosstool#ct-ng list-samples See which default configuration

With a default configuration of Arm-cortex_a8-linux-gnueabi, we'll configure this as a template

[Email protected]:/home/work/crosstool#ct-ng Arm-cortex_a8-linux-gnueabi Apply this configuration

Here's how to start customizing:

[Email Protected]:/home/work/crosstool#ct-ng menuconfig

Paths and Miscoptions--->

(/home/work/crosstool/src) Local Tarballs Directory

This specifies the directory where you downloaded the tar package so that it will not be downloaded again at the time of production.

(/opt/${ct_target}-4.7.3) Prefix Directory

This specifies the installation path of the cross compiler:/opt/arm-cortex_a8-linux-gnueabi-4.7.3

(2) Number of parallel jobs

Specify 2 simultaneous jobs to speed up compilation

Targetoptions--->

Floatingpoint: (softfp (FPU))--->

Specify to use soft floating point

Toolchainoptions--->

(cortex_a8) Tuple ' s Vendor string

Add custom information, such as:

Cortex_a8, post-fabricated cross compiler name such as: arm-cortex_a8-linux-gnueabi-

ZJH, post-fabricated cross compiler name such as: arm-zjh-linux-gnueabi-

Not set, after the created cross compiler name such as: arm-unknown-linux-gnueabi-

(arm-linux) Tuple ' s Alias

Set the alias so that a soft link is created for each tool, such as:

ARM-LINUX-GCC Link to ARM-CORTEX_A8-LINUX-GNUEABI-GCC

OperatingSystem--->

Linuxkernel version (3.10.2)--->

Select the kernel version, it is better to choose a larger, the Linux kernel is backwards compatible.

Ccompiler--->

Gccversion (4.7.3)--->

[*] Compile Libmudflap

Libmudflap is used to check for memory leaks, including heaps and stacks, and how to use the Internet to check data.

C-library--->

Glibcversion (2.13)--->

[*] Force unwind Support (READ help!)

Companionlibraries--->

Pplversion (0.11.2)--->

Cloog version (0.15.11)--->

Note: In the production process, if a version mismatch error occurs, reconfigure the correct version of the software, and then proceed with the production.

Save analternate Configuration File

Save as configuration file. config, and then exit.

Configuration in the above configuration of the source package storage directory for /home/work/crosstool/src so you need to

Create directory under/home/work/crosstool directory src

[Email protected]:/home/work/crosstool#mkdir src

Depending on the software version configured above or view the. config file, review the required software version, and then use your own high-speed download tool (such as Thunderbolt) to download all the required software and then copy it to the/HOME/WORK/CROSSTOOL/SRC directory:

[Email Protected]:/home/work/crosstool#ls src/

binutils-2.20.1a.tar.bz2expat-2.1.0.tar.gz glibc-ports-2.13.tar.bz2 ltrace_0.5.3.orig.tar.gz Ppl-0.11.2.tar.lzma cloog-ppl-0.15.11.tar.gz gcc-4.7.3.tar.bz2 gmp-4.3.2.tar.bz2 mpc-1.0.1.tar.gz strace-4.5.19.tar.bz2 dmalloc-5.5 .2.tgz gdb-6.8a.tar.bz2 libelf-0.8.13.tar.gz mpfr-2.4.2.tar.xz duma_2_5_15.tar.gz glibc-2.13.tar.bz2 li NUX-3.10.2.TAR.BZ2 ncurses-5.9.tar.gz

Execute Ct-ng Build to start production:

[Email Protected]:/home/work/crosstool#ct-ng Build


During the production process, you can open a different terminal to view the detailed process of making and compiling:

[Email protected]:/home/work/crosstool#tail-f build.log

After the production is complete, you will see the following information:

[INFO] Build completed at 20140612.004712

[INFO] (elapsed:74:49.55)

[INFO] Finishing installation (may take a fewseconds) ...

The cross-compiler is then installed in the installation directory that we specified:

[Email protected]:/home/work/crosstool#ls/opt/arm-cortex_a8-linux-gnueabi-4.7.3/

Arm-cortex_a8-linux-gnueabi bin build.log.bz2 include Lib Libexec share

Configure environment variables: Add a line at the end of the/etc/profile file:

Exportpath=/opt/arm-cortex_a8-linux-gnueabi-4.7.3/bin: $PATH

Execution . /etc/profile make configuration effective

Note: The command executed here is . , equivalent to Source/etc/profile, which is only in effect at the current terminal, to make all effective, but also to restart the system.

[Email protected]:/home/work/crosstool#arm-linux-gcc-v

Using Built-inspecs.

collect_gcc=arm-linux-gcc

collect_lto_wrapper=/opt/arm-cortex_a8-linux-gnueabi-4.7.3/libexec/gcc/arm-cortex_a8-linux-gnueabi/4.7.3/ Lto-wrapper

Target:arm-cortex_a8-linux-gnueabi

Configured With:/home/work/crosstool/.build/src/gcc-4.7.3/configure--build=i686-build_pc-linux-gnu--host= I686-build_pc-linux-gnu--target=arm-cortex_a8-linux-gnueabi--prefix=/opt/arm-cortex_ a8-linux-gnueabi-4.7.3--with-sysroot=/opt/arm-cortex_a8-linux-gnueabi-4.7.3/arm-cortex_a8-linux-gnueabi/ sysroot--enable-languages=c,c++--with-arch=armv7-a--with-cpu=cortex-a8--with-tune=cortex-a8--WITH-FLOAT=SOFTFP --with-pkgversion= ' crosstool-ng1.19.0 '--enable-__cxa_atexit--enable-libmudflap-- DISABLE-LIBGOMP--DISABLE-LIBSSP--disable-libquadmath--disable-libquadmath-support--with-gmp=/home/work/ Crosstool/.build/arm-cortex_a8-linux-gnueabi/buildtools--with-mpfr=/home/work/crosstool/.build/arm-cortex_ a8-linux-gnueabi/buildtools--with-mpc=/home/work/crosstool/.build/arm-cortex_a8-linux-gnueabi/ Buildtools--with-ppl=/home/work/crosstool/.build/arm-cortex_a8-linux-gnueabi/buildtools--with-cloog=/home/work /crosstool/.build/arm-cortex_a8-linux-gnueabi/buildtools--with-libelf=no--WITH-HOST-LIBSTDCXX= '-static-libgcc-wl,-bstatic,-lstdc++,-bdynamic-lm-l/home/work/crosstool/.build/arm-cortex_a8-linux-gnueabi/ Buildtools/lib-lpwl '--enable-threads=posix--enable-target-optspace-- Disable-nls--disable-multilib--with-local-prefix=/opt/arm-cortex_a8-linux-gnueabi-4.7.3/arm-cortex_ A8-linux-gnueabi/sysroot--enable-c99--enable-long-long

Thread Model:posix

GCC version 4.7.3 (crosstool-ng 1.19.0)


............

More content, please download PDF version

Http://pan.baidu.com/s/1fEfG6#dir


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.