OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / Documentation / ARMulator-HOWTO
1 uClinux in the GDB/ARMulator
2 ----------------------------
3
4 This page can be found on the web at:
5
6   http://www.uclinux.org/pub/uClinux/utilities/armulator/
7
8 The web copy contains real links to many of the packages described herein.
9
10
11 Here are some patches to GDB to allow the existing gdb ARM emulator to run
12 uClinux targets. It can run both little-endian and big-endian code, as well
13 as apcs-32/26 code and Thumb. I have tested little/big endian kernels but
14 haven't played with thumb at this point.
15
16 The patch is heavily based on an ARM7100 patch that Ben Williamson produced
17 back around 1999 for gdb-4.18. The changes include Atmel AT91 emulation for
18 timers/system registers and serial ports, removal of Bens LCD support and
19 porting to gdb-5.0.
20
21
22 1. Getting GDB/ARMulator
23
24    Here are the files you need to use to put together the GDB/ARMulator.
25
26    gdb-5.0.tar.bz2
27         The orginal gdb-5.0 archive.
28
29    gdb-5.0-uclinux-armulator-20021127.patch.gz
30         Patches against gdb-5.0 based heavily on the ARMulator changes from
31         Ben Williamson <benw@pobox.com> with changes to behave like an Atmel
32         AT91 device.
33
34
35 2. Building GDB/ARMulator
36
37         bunzip2 < gdb-5.0.tar.bz2 | tar xvf -
38         gunzip < gdb-5.0-uclinux-armulator-20021127.patch.gz | patch -p0
39         cd gdb-5.0
40         ./configure --target=arm-elf
41         make
42         su root -c "make install"
43
44
45 3. Compiling uClinux
46
47    During the configuration stepo choose GDB/ARMulator as the target. You
48    can select either the linux-2.0.x or linux-2.4.x kernels, and you can
49    choose either uC-libc or uClibc as the libaray.
50
51
52 4. Running the Binaries
53
54    The ARMulator expects the romfs to be in a file called "boot.rom".
55    So link the romfs.img to boot.rom with:
56
57         ln -s images/romfs.img boot.rom
58
59    Then to run uCLinux do:
60
61         arm-elf-gdb linux-2.X.X/linux
62
63    Then within gdb do:
64
65         ...
66         gdb> target sim
67         ...
68         gdb> load
69         ...
70         gdb> run
71
72    To save some typing you can create a .gdbinit file that conatins:
73
74         target sim
75         load
76
77    Then you just need to use "run" to start the kernel each time.
78
79 5. Using the Debugger
80
81   Just type ^C to drop into gdb. You have full source debugging of the kernel
82   (and apps if you load their symbols appropriately). You can step and
83   continue just like a normal debugger.
84
85
86 6. Messing with the Emulator
87
88    If you want to see how much of a hack this really is, the main files to
89    look at are:
90
91         gdb-5.0/sim/arm/armmem.c
92         gdb-5.0/sim/arm/armio.c
93
94    These still include the old 7100 code commented out and the Atmel
95    emulation that is truly hacked in on top. You can add more memory and
96    change the size of the rom in armmem.c. You can fix most bugs in the
97    emulation in armio.c.
98
99
100 7. Thanks to
101
102    Patrick Doyle for the time.h patch to fixcompiling on RedHat 7.2/7.3
103    Fernando José Cardozo de Sá for his Native 32 port (and binaries).
104    Daniel Versick's big-endian patches for uaccess
105         (taken from http://mac.os.nctu.edu.tw/distfiles/4530.patch).
106
107
108 Copyright (C) 2002,
109 David McCullough <davidm@snapgear.com>