uClinux-dist 使用教學:使用 GDB/ARMulator 來做測試

jollen 發表於 February 26, 2004 1:40 PM

一開始執行 GDB/ARMulator 時,指定 kernel 做為執行檔:

# /usr/local/bin/arm-elf-gdb linux.2.0.x
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf"...
(no debugging symbols found)...

注意!GDB/ARMulator 是 GDB 加上 ARMulator patch 後的特殊版本,必須自行由 GDB 原始碼製作。

進入 gdb 命令模式後,在 gdb 命令模式下輸入 target sim 命令:

(gdb) target sim
Loaded ROM boot.rom
Loaded ROM boot.rom
Loaded ROM boot.rom
Loaded ROM boot.rom
Connected to the simulator.

指定 taget 端為 ARM simulator。此時 GDB 會載入 boot.rom 做為 root filesystem,因此請將 root filesystem的檔案名稱修改為 boot.rom(或建立link)。接著再輸入 load 命令載入kernel:

(gdb) load
Loading section .text, size 0x77b84 vma 0x2000000
Loading section .rodata, size 0x8ddb vma 0x2077b84
Loading section .data, size 0x8fc8 vma 0x2080a60
Start address 0x2000000
Transfer rate: 4507960 bits/sec.

由 GDB 的訊息可以看出,uClinux for GDB/ARMulator 的 .text 節區起始位址為 0x20000000,此位址會因為硬體平臺的不同而不同。uCliinux-dist 已經幫我們設定好許多平臺的起始位址參數,因此使用 uClinux-dist 時就不必自己手動重設節區位址。


(gdb) run


Starting program: /home/Embedded/GDB/linux.2.0.x
Found an Atmel AT91F40xxx arm7 processor
Atmel AT91 series microcontroller support (c) 2000,2001 Lineo Inc.
kernel binary is in RAM -- reserving 643k for the kernel
Calibrating delay loop.. ok - 13.00 BogoMIPS
Memory: 1372k/2048k available (224k kernel code, 0k reserved, 196k data)
Swansea University Computer Society NET3.035 for Linux 2.0
NET3: Unix domain sockets 0.13 for Linux NET3.035.
Swansea University Computer Society TCP/IP for NET3.034
IP Protocols: ICMP, UDP, TCP
Linux version 2.0.39.uc2 (davidm@moby) (gcc version 2.95.3 20010315 (release)(ColdFire patches - 20010318 from http://fiddes.net/coldfire/)(-msep-data patches)) 41 Fri Jun 14 10:54:27 EST 2002
Atmel USART driver version 0.99
ttyS0 at 0xfffd0000 (irq = 2) is a builtin Atmel APB USART
ttyS1 at 0xfffcc000 (irq = 3) is a builtin Atmel APB USART
Ramdisk driver initialized : 16 ramdisks of 4096K size
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: 4000000-B4BB07FF (RO)
PPP: version 2.3.8 (demand dialling)
TCP compression code copyright 1989 Regents of the University of California
PPP line discipline registered.
PPP MPPE compression registered
SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256).
CSLIP: code copyright 1989 Regents of the University of California.
VFS: Mounted root (romfs filesystem).
Shell invoked to run file: /etc/rc
Command: hostname GDB-ARMulator
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: cat /etc/motd
Welcome to
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/ \
| ___\____|_||_|_| |_|\____|\_/\_/
| |

GDB/ARMulator support by <davidm@snapgear.com>
For further information check:

Execution Finished, Exiting

Sash command shell (version 1.1.1)

Jollen's Blog 使用 Github issues 與讀者交流討論。請點擊上方的文章專屬 issue,或 open a new issue

您可透過電子郵件 jollen@jollen.org,或是 Linkedin 與我連絡。更歡迎使用微信,請搜尋 WeChat ID:jollentw