blob: de9320488f51d8289c8229144f6492ff3c9a9428 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001;--------------------------------------------------------------------------
2;
3; Linux Demo for TRACE32 multitask debugger
4;
5; This batchfile demonstrates the use of
6; the Multitask-Debugger for Linux
7;
8; The example is generated for the evb297520v2fpga board using an ICD.
9; It will NOT run on any other board, but may be used as a template for
10; others.
11; Linux is downloaded to the board via ICD.
12;
13; modified by ZTE-TSP at 2015.08.07
14;
15; NOTICE:
16; this script can only be used on NO jtag chain mode
17;--------------------------------------------------------------------------
18
19;do ./7520V2_DDR_1Gb_312.cmm
20
21GLOBAL &VMLINUX_PATH
22GLOBAL &INITRD_PATH
23GLOBAL &SOURCE_PATH
24GLOBAL &DDR_BASE
25GLOBAL &INITRD_LOAD_ADDR
26GLOBAL &IMAGE_LOAD_ADDR
27
28&VMLINUX_PATH= ".\vmlinux"
29&IMAGE_PATH="..\..\linux_plat\base\linux\kernels\linux-3.4.5\zImage"
30&INITRD_PATH= ".\cpio_ramdisk.gz"
31&SOURCE_PATH="F:\7520V3\linux-3.4.5"
32&DDR_BASE=0x22300000
33&INITRD_LOAD_ADDR=&DDR_BASE+0xA00000
34&IMAGE_LOAD_ADDR=&DDR_BASE+0x8000
35
36area.reset
37print "resetting..."
38TASK.RESet
39sYmbol.RESet
40MMU.RESet
41
42;do ./boot.cmm
43
44; setup of ICD
45
46 print "initializing..."
47sys.cpu CortexA53
48SYStem.Option MMUSPACES ON ; enable space ids to virtual addresses
49SYStem.JtagClock 3.0MHz ; use adaptive clocking for most speed
50sys.option enreset Off
51sys.option resbreak off
52
53Sys.Config.COREBASE 0x80410000 ; Cortex-A53
54Sys.Config.CTIBASE 0x80420000
55Sys.Config.debugaccessport 0
56Sys.Mode PREPARE
57Wait 0.1s
58
59sys.up
60;data.set 0x01306100 %long 0xffffffff ;DDR config
61
62SETUP.IMASKASM ON ; lock interrupts while single steppingle stepping
63 ;l2 divison -- no need
64; data.set 0x00803004 %LE %LONG 0x33111;
65
66//A9 select 624M, bit0-2, 0=26, 1=624, 2=480, 3=312, 4=156
67;data.set 0x01306040 %long 0x00000001
68
69; Target Setup: initialize LPDDR controller and peripherals(e.g. UART1)
70print "initialize board ..."
71
72; use the debugger to initialize it
73; do basic setup on board;
74; we don't need this step on zx297510 platform, because jtag_debug code or T32 script has run before this step.
75; jtag_debug code or T32 script running on cortex-m0 initiates system clock, DDR, gpio multiplex, and so on....
76
77do .\console_fpga.cmm ; setup serial console
78
79; Load the Linux kernel
80
81; If you are using a flashed kernel, or if you're
82; loading your kernel via TFTP, use the boot monitor
83; to do so.
84
85; Use the next lines only to load the kernel into
86; RAM using the debugger.
87
88; vmlinux starts physically at RAM start (=0x28000000) + 0x8000
89; (see arch/arm/kernel/head-armv.S)
90print "loading Linux image..."
91;Data.LOAD.Binary &IMAGE_PATH &IMAGE_LOAD_ADDR ; loading zImage here, it will uncompress itself
92;data.load.elf &VMLINUX_PATH (&DDR_BASE+0x8000) /gnu /nosymbol
93Register.RESet
94
95 Data.LOAD.Elf &VMLINUX_PATH 0x22308000-0xc0008000 /gnu /nosymbol
96
97; Set PC on start address of image
98Register.Set PC (&DDR_BASE+0x8000)
99
100
101; Set machine type in R1; see arch/arm/tools/mach-types 7520 = 0x1d63
102Register.Set R1 0x1d63
103
104; Set parameter tags for linux boot
105do .\atag-list.cmm
106Register.Set R2 (&DDR_BASE+0x0100)
107
108; Loading RAM disk
109print "loading ram disk"
110
111; Load ram file system image into ram disk
112;Data.LOAD.Binary &INITRD_PATH &INITRD_LOAD_ADDR
113Data.LOAD.Binary &INITRD_PATH &INITRD_LOAD_ADDR /noclear /nosymbol
114
115; Load the Linux kernel symbols into the debugger
116print "loading Linux kernel symbols..."
117Data.LOAD.Elf &VMLINUX_PATH /gnu /nocode /strippart "linux-3.4.5" /SourcePATH ..\linux-3.4.5
118;Data.LOAD.Elf &VMLINUX_PATH /gnu /nocode /SourcePATH ..\linux-3.4.5
119
120; Open a Code Window -- we like to see something
121Data.List
122
123
124; Run over MMU & Interrupt initialization
125
126 ;Go __init_end /Onchip
127 ;print "initializing target and debugger MMU..."
128 ;wait !run()
129
130 ; Map the virtual kernel symbols to physical addresses
131 ; to give the debugger access to it before CPU MMU is
132 ; initialized
133 MMU.FORMAT LINUX swapper_pg_dir 0xc0000000--0xc0ffffff &DDR_BASE
134 TRANSlation.COMMON 0xbf000000--0xffffffff ; common area for kernel and processes
135 TRANSlation.TableWalk ON ;debugger uses table walk to decode virtual address
136 TRANSlation.ON ;switch on debugger address translation
137
138 ; set source path
139 print "set source path ..."
140 ;sYmbol.SourcePATH.RESet
141 sYmbol.SourcePATH.SetBaseDir &SOURCE_PATH
142 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\arch\arm\mach-zx297520v3
143 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\arch\arm
144 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\init
145 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\kernel
146 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\tty
147 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\clk
148 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\gpio
149 sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\dma
150; sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers
151
152
153 ; Note that the Linux awareness needs the kernel symbols to work
154 print "initializing multitask support..."
155 TASK.CONFIG .\linux ; loads Linux awareness (linux.t32)
156 MENU.ReProgram .\linux ; loads Linux menu (linux.men)
157 HELP.FILTER.Add rtoslinux ; add linux awareness manual to help filter
158 MENU.ReProgram .\sys\board ; add board tools
159
160; switch on symbol autoloader
161sYmbol.AutoLoad.CHECKLINUX "do "+os.ppd()+"/autoload "
162 ; Group kernel area to be displayed with red bar
163
164 GROUP.Create "kernel" 0xc0000000--0xffffffff /RED
165 GROUP.Create "module" 0xbf000000--0xbfffffff /blue
166; Ok, we're done, let's start Linux
167
168 SYStem.Option MMUSPACES OFF
169
170
171
172enddo
173