For students who want to learn ARM assembly, it is an effective method to purchase the ARM development board for on-board measurement. However, it takes a lot of money to purchase the ARM development board, and it is more troublesome to connect the development board for each test. Here is an ARM simulator - SkyEye, through SkyEye we can directly develop and debug the ARM assembler on a PC, and get rid of the limitations of the ARM development board, it is really good!

Here's how to use:

1. Download the latest version of SkyEye (https://sourceforge.net/projects/skyeye/). This article uses skyeye-1.3.4_rc1.tar.gz. For the rest of the experiment, download testsuite, which is skyeye. The test file, the version here is skyeye-testsuite-1.3.4, which has ArmLinux.

2. Install SkyEye.

$ tar zxvf skyeye-1.3.4_rc1.tar.gz

$ cd skyeye12

According to the steps in the INSTALL file:

./configure

Make lib

Make

Sudo make install

Sudo make install_lib12345

Note that there may be a shortage of various files when making, apt-get install is fine. For example, the two problems we encountered here are: python-dev and llvm are not installed. The solution is simple:

$ sudo apt-get install python-dev

$ sudo apt-get install llvm12

So SkyEye is installed.

3. Add environment variables.

The default SkyEye is installed under /opt/, so for convenience, we add its path to the environment variable, we write it to the .bashrc file and open it:

$ vi ~/.bashrc1

enter:

#SkyEye 1.3.4

Export PATH=/opt/skyeye/bin:$PATH12

Then log out and log in or execute source .bashrc to make the environment variable take effect.

4. Run the arm_hello test program.

After SkyEye is installed, there will be an arm_hello test program under /opt/skyeye/testsuite, which will run as follows:

$ cd /opt/skyeye/testsuite/arm_hello

$ skyeye -e arm_hello12

Note: skyeye must be in the directory of this program when running a program, because skyeye wants to read the skyeye.conf configuration file of this program, so the first step is to switch to the /opt/skyeye/testsuite/arm_hello directory.

At this point we will enter the skyeye command mode, enter start to let the arm_hello program start running, and a window with the words "connecting to Ubuntu: xxx" will pop up.

5. Make sure arm_hello is running normally.

Enter run at the skyeye command line to start running. At this time, the window will output "helloworld" continuously, indicating that arm_hello has been successfully run!

6, other commands of arm_hello.

Enter stop at the skyeye command line to stop running; type quit to exit skyeye; type help to view help.

Obviously, just above the SkyEye installed, our goal is to simulate ARM Linux in SysEye. So, here's how to start Linux on SkyEye, just like on a real ARM development board.

1. Unzip the testsuite test file.

$ tar zxvf skyeye-testsuite-1.3.4_rc1.tar.gz1

The linux directory is the amrlinux we want to port to the board, and then enter: s3c2410 –> s3c2410x-2.6.36, there are three files, vmlinux is the Linux kernel image, skyeye.conf is the configuration file, and initrd.img is the temporary root file. system. We create a new directory under /opt/skyeye/testsuite and copy it over:

$ sudo mkdir /opt/skyeye/testsuite/armlinux

$ cd linux/s3c2410/s3c2410x-2.6.36

$ sudo copy * /opt/skyeye/testsuite/armlinux123

2. Run vmlinux.

$ cd /opt/skyeye/testsuite/armlinux

$ skyeye -e vmlinux12

Enter skyeye command mode and enter start to open the serial port window.

(I made an error while performing this step: failed to setup_module (name:net, type:cs8900a), I commented out the net line in skyeye.conf, and it will do.)

If the window is not open, modify uart:mod=stdio to uart:mod=term and try again.

3. Start Linux.

Enter run in the skyeye command line to start Linux, the screen will output serial information, but the speed is very slow!

Attached a few pictures:

Above we briefly introduced how to use SkyEye and successfully run the existing arm_hello program, but this is for arm7, now we need to simulate s3c2410 (arm920T) with SkyEye. Let's start the second part of SkyEye.

1. First create the myhello directory under /opt/skyeye/testsuite.

$ mkdir /opt/skyeye/testsuite/myhello1

2. Add the myhello.c file.

$ cd /opt/skyeye/testsuite/myhello

$ vi myhello.c12

Enter the following:

#define INTERVAL 100000

Void myhello(void)

{

Long * addr = (long *)0x50000020;

Int timeout = 0;

While(1) {

Timeout = 0;

While(++timeout <= INTERVAL);

*addr = 'a';

}

}12345678910111213

The address 0x50000020 is the transmit buffer of channel 0 (UTXH0) of the UART. When the data is written to this address, it will be sent automatically. Of course, in the simulator, the destination address sent is our screen.

3. Prepare the startup code.

After myhello.c is written, we will also prepare a s3c2410 startup code. This code will be executed after s3c2410 is powered on. In this startup code, we will jump back to the myhello.c function we wrote. Open the start.S file:

$ vi start.S1

Enter the following:

.text

.align 4

.global _start

_start:

Ldr sp, =1024*4

Bl myhello

Halt:

b halt12345678910

The above paragraph is very simple, is to declare a _start tag, which will be used below as the entry address of the program. The only necessary step in assembly and C linking is to set the stack. Here we point sp to the top of 4k and then jump to our c function myhello.

4. Write a link script.

The order of the links is first start.S and then myhello.c, open the myhello.lds file:

$ vi myhello.lds1

Enter the following:

OUTPUT_ARCH(arm)

ENTRY(_start)

SECTIONS

{

. = 0x00000000;

.text :

{

Start.o

Myhello.o

*(.rodata)

}

. = ALIGN(8192);

.data : {*(.data)}

.bss : {*(.bss)}

}123456789101112131415161718

Indicates the output arm format, the second sentence indicates that the entry point is the _start tag, which is the _start tag in step 3, then inserts start.o at 0x00000000 and then inserts myhello.o.

5. Write a Makefile.

$ vi Makefile1

Enter the following:

CC=arm-linux-gcc

LD=arm-linux-ld

CFLAGS= -c -g -march=armv6 -mtune=arm920t

LDFLAGS= -N -p -X -Thello.lds

Myhello: start.o myhello.o

$(LD) $(LDFLAGS) start.o myhello.o -o myhello

Arm-linux-objdump -xS myhello > myhello.s

Arm-linux-readelf -a myhello > myhello.r

Arm-linux-nm myhello > myhello.n

Start.o: start.S

$(CC) $(CFLAGS) start.S

Myhello.o: myhello.c

$(CC) $(CFLAGS) myhello.c

Clean:

Rm -rf *.o myhello *.r *.n *.s

Arm-linux-objdump -xS myhello > myhello.s

Arm-linux-readelf -a myhello > myhello.r

Arm-linux-nm myhello > myhello.n123456789101112131415161718192021222324

6. Finally, we also need a skyeye configuration file.

$ vi skyeye.conf1

Enter the following:

#skyeye config file

Arch:arm

Cpu: arm920t

Mach: s3c2410x

# boot

Mem_bank: map=M, type=RW, addr=0x00000000, size=0x04000000, boot=yes

# physical memory

Mem_bank: map=M, type=RW, addr=0x30000000, size=0x02000000

# all peripherals I/O mapping area

Mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000

Uart:mod=term

#log: logon=0, logfile=./sk1.log, start=0, end=20000012345678910111213141516

7, compile.

$ cd /opt/skyeye/testsuite/myhello

$ make12

8, test.

$ cd /opt/skyeye/testsuite/myhello

$ skyeye -e myhello12

In the skyeye command mode, type:

Start

Run12

We will find that the character "a" is output continuously, complete!

PS: There are two places in the source code that are worth discussing:

1) Makefile lines 3 and 4, the suggestions are:

CFLAGS= -c -g -march=armv4 -mtune=arm920t

LDFLAGS= -N -p -X -Tmyhello.lds12

2) skyeye.config Line 15 is recommended:

Uart:mod=stdio

Zinc Aluminum

Zinc aluminum alloy wire, zinc is the matrix, through different aluminum content to meet the needs of different customers, and the use of advanced production technology, strict quality control, surface and inner quality is good and stable, with good mechanical properties. Using in film capacitor surface spray

Zinc Aluminum Alloy Wire,Blasting Materials,Anti-Corrosion Spraying Material,Ductile Iron Pipe

Shaoxing Tianlong Tin Materials Co.,Ltd. , https://www.tianlongspray.com