Tiny4412 Learning 1: Compile uboot, experience bare metal, tiny4412uboot

Source: Internet
Author: User

Tiny4412 Learning 1: Compile uboot, experience bare metal, tiny4412uboot

First, we create a folder in ubuntu. my folder is:

/Home/wang/tiny_4412 has

Datasheet shc (schematic PCB folder) src tools

There are

Codes u_boot

Codes is the bare metal storage location, and u_boot is a friendly installation package

Tools has

Arm-linux-gcc-4.4.3 installation package, dnw installation package

Start to experience:

1. Install minicom to establish communication (see another blog)

2. install linux-gcc

1> unzip the installation: sudo tar zxvf arm-linux-gcc-4.4.3.tar.gz-C/

After decompression,-C/will automatically place the extracted files in the specified path in the root directory)

Note: C is followed by a space (not required), and C is uppercase (required). It is the English word "Change"

The first letter in the directory. Run this command to install arm-linux-gcc

Go to the/opt/Friendlyarm/toolschain/4.4.3 directory.

2> create a directory:

Sudo mkdir/usr/local/arm

3> copy a file:

Sudo cp-r/opt/FriendlyARM/toolschain/4.4.3/usr/local/arm

4> Add environment variables:

Enter sudo vim/root/. bashrc on the terminal and enter the following in the last line:

Export PATH = $ PATH:/opt/FriendlyARM/toolschain/4.4.3/bin (PATH)

(Note that there must be no space on the equal sign side)

Make the new environment variables take effect immediately:

./Etc/bash. bashrc or source/root/. bashrc

5> install the compatible library. Enter sudo apt-get install g ++-multilib on the terminal.

6> NO. After logging on to the root user, enter "arm-linux-gcc-v ".

This command displays the information and version of arm-linux-gcc or

Open another terminal, enter arm-, and press Tab twice. If the following information appears, it indicates Installation

Successful

3. Go to the u_boot directory to compile and execute

Make clean // clear first

Make distclean // then clear the configuration, and there will be nothing in the whole process

Make tiny4412_config // required

Make // compilation is complete now

4. Burn compiled u_boot into the SD card.

1> insert it into the computer and execute:

Fdisk-l // check if SD is found

If SD is automatically mounted, You Need To unmount it first to view ls/media/

2> go to the directory:/sd_fuse/tiny4412 and execute

./Sd_fusing. sh/dev. sdb (that is, sdb, neither sdb1 nor sdb2)

If mkbl2 is missing, we only need to return to the previous directory and execute make.

3> unplug the card and plug it into the Development Board. Switch to SD to start.

Open another terminal and execute: minicom

Start the Development Board and press a space on the page that appears. We can see that the Development Board starts from SDMMC.

5. Modify u_boot to create a bare metal Environment

1> disable MMU

If MMU is enabled, all function addresses in System. map are mapped to c,

Because we need to deal with interruptions later, bare metal development requires direct access to their physical addresses,

View System. map: Run vim System. map in the u_boot directory.

Disable: vim include/configs/tiny4412.h

Enter/MMU to search

Change # define CONFIG_ENABEL_MMU to # undef CONFIG_ENABEL_MMU.

Save: wq

2> execution:

Vim board/samsung/tiny4412/config. mk

Change the address to 0x43e0 0000 (5.6.7 can be used later)

Because the Development Board memory address is: 4000 0000 to 5000 0000 256 M

7000 0000 to 8000 0000 256 M 256Mx4 1 GB memory

3> re-compile u_boot and execute: make

6. Burn compiled u_boot to SD

Insert the SD card into your computer. Check whether the SD card is loaded.

Fdisk-l

Enter: cd sd_fuse/

Cd tiny4412

./Sd_fusing.sh/dev/sdb // burned into SD

It is divided into four parts and burned into SD to view the burning position: vim sd_fusing.sh. It is not easy to view the burning content.

7. Insert the SD card into the Development Board and start viewing. (Remember to press space)

8. view the changes: vim System. map

View the printf address:/printf

We can see that the address is 43e1 1e78 copied

9. Go to the bare metal program directory and change the code:

# Include "regs. h"

Void (* printf) (char *,...) = 0x43e11e78; // modify the address

Int test (void)

{

Unsigned long value = 0;

_ Asm _ volatile __(

"Mrs % 0, cpsr \ n"

: "= & R" (value)

);

Printf ("value = 0x % x \ n", value );

Return 0;

}

Save wq and exit. Execute: make

The link address is 7000 3000

10. Install dnw. The Development Board uses USB cables to connect to the computer.

On The minicom terminal page: dnw 70003000

On the directory operation terminal interface, use lsusb to view Samsung devices (no driver, no command)

Next install dnw:

Go to the dnw installation package Directory: Run

Tar zxf dnw_linux.tar.gz

Cd dnw_linux

Make

Make install // the installation is complete

11. Go to the bare metal code directory and execute:

Dnw test. bin // uploaded to the Development Board on The minicom Terminal interface: dnw 70003000

12. Run the following command on the minicom Terminal interface:

Go 70003000 // run

Check the result. Now, let's take a look at what we have done.

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.