;-------------------------------------------------------------------------- | |
; | |
; Linux Demo for TRACE32 multitask debugger | |
; | |
; This batchfile demonstrates the use of | |
; the Multitask-Debugger for Linux | |
; | |
; The example is generated for the evb297520v2fpga board using an ICD. | |
; It will NOT run on any other board, but may be used as a template for | |
; others. | |
; Linux is downloaded to the board via ICD. | |
; | |
; modified by ZTE-TSP at 2015.08.07 | |
; | |
; NOTICE: | |
; this script can only be used on NO jtag chain mode | |
;-------------------------------------------------------------------------- | |
;do ./7520V2_DDR_1Gb_312.cmm | |
GLOBAL &VMLINUX_PATH | |
GLOBAL &INITRD_PATH | |
GLOBAL &SOURCE_PATH | |
GLOBAL &DDR_BASE | |
GLOBAL &INITRD_LOAD_ADDR | |
GLOBAL &IMAGE_LOAD_ADDR | |
&VMLINUX_PATH= ".\vmlinux" | |
&IMAGE_PATH="..\..\linux_plat\base\linux\kernels\linux-3.4.5\zImage" | |
&INITRD_PATH= ".\cpio_ramdisk.gz" | |
&SOURCE_PATH="F:\7520V3\linux-3.4.5" | |
&DDR_BASE=0x22300000 | |
&INITRD_LOAD_ADDR=&DDR_BASE+0xA00000 | |
&IMAGE_LOAD_ADDR=&DDR_BASE+0x8000 | |
area.reset | |
print "resetting..." | |
TASK.RESet | |
sYmbol.RESet | |
MMU.RESet | |
;do ./boot.cmm | |
; setup of ICD | |
print "initializing..." | |
sys.cpu CortexA53 | |
SYStem.Option MMUSPACES ON ; enable space ids to virtual addresses | |
SYStem.JtagClock 3.0MHz ; use adaptive clocking for most speed | |
sys.option enreset Off | |
sys.option resbreak off | |
Sys.Config.COREBASE 0x80410000 ; Cortex-A53 | |
Sys.Config.CTIBASE 0x80420000 | |
Sys.Config.debugaccessport 0 | |
Sys.Mode PREPARE | |
Wait 0.1s | |
sys.up | |
;data.set 0x01306100 %long 0xffffffff ;DDR config | |
SETUP.IMASKASM ON ; lock interrupts while single steppingle stepping | |
;l2 divison -- no need | |
; data.set 0x00803004 %LE %LONG 0x33111; | |
//A9 select 624M, bit0-2, 0=26, 1=624, 2=480, 3=312, 4=156 | |
;data.set 0x01306040 %long 0x00000001 | |
; Target Setup: initialize LPDDR controller and peripherals(e.g. UART1) | |
print "initialize board ..." | |
; use the debugger to initialize it | |
; do basic setup on board; | |
; we don't need this step on zx297510 platform, because jtag_debug code or T32 script has run before this step. | |
; jtag_debug code or T32 script running on cortex-m0 initiates system clock, DDR, gpio multiplex, and so on.... | |
do .\console_fpga.cmm ; setup serial console | |
; Load the Linux kernel | |
; If you are using a flashed kernel, or if you're | |
; loading your kernel via TFTP, use the boot monitor | |
; to do so. | |
; Use the next lines only to load the kernel into | |
; RAM using the debugger. | |
; vmlinux starts physically at RAM start (=0x28000000) + 0x8000 | |
; (see arch/arm/kernel/head-armv.S) | |
print "loading Linux image..." | |
;Data.LOAD.Binary &IMAGE_PATH &IMAGE_LOAD_ADDR ; loading zImage here, it will uncompress itself | |
;data.load.elf &VMLINUX_PATH (&DDR_BASE+0x8000) /gnu /nosymbol | |
Register.RESet | |
Data.LOAD.Elf &VMLINUX_PATH 0x22308000-0xc0008000 /gnu /nosymbol | |
; Set PC on start address of image | |
Register.Set PC (&DDR_BASE+0x8000) | |
; Set machine type in R1; see arch/arm/tools/mach-types 7520 = 0x1d63 | |
Register.Set R1 0x1d63 | |
; Set parameter tags for linux boot | |
do .\atag-list.cmm | |
Register.Set R2 (&DDR_BASE+0x0100) | |
; Loading RAM disk | |
print "loading ram disk" | |
; Load ram file system image into ram disk | |
;Data.LOAD.Binary &INITRD_PATH &INITRD_LOAD_ADDR | |
Data.LOAD.Binary &INITRD_PATH &INITRD_LOAD_ADDR /noclear /nosymbol | |
; Load the Linux kernel symbols into the debugger | |
print "loading Linux kernel symbols..." | |
Data.LOAD.Elf &VMLINUX_PATH /gnu /nocode /strippart "linux-3.4.5" /SourcePATH ..\linux-3.4.5 | |
;Data.LOAD.Elf &VMLINUX_PATH /gnu /nocode /SourcePATH ..\linux-3.4.5 | |
; Open a Code Window -- we like to see something | |
Data.List | |
; Run over MMU & Interrupt initialization | |
;Go __init_end /Onchip | |
;print "initializing target and debugger MMU..." | |
;wait !run() | |
; Map the virtual kernel symbols to physical addresses | |
; to give the debugger access to it before CPU MMU is | |
; initialized | |
MMU.FORMAT LINUX swapper_pg_dir 0xc0000000--0xc0ffffff &DDR_BASE | |
TRANSlation.COMMON 0xbf000000--0xffffffff ; common area for kernel and processes | |
TRANSlation.TableWalk ON ;debugger uses table walk to decode virtual address | |
TRANSlation.ON ;switch on debugger address translation | |
; set source path | |
print "set source path ..." | |
;sYmbol.SourcePATH.RESet | |
sYmbol.SourcePATH.SetBaseDir &SOURCE_PATH | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\arch\arm\mach-zx297520v3 | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\arch\arm | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\init | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\kernel | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\tty | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\clk | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\gpio | |
sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers\dma | |
; sYmbol.SourcePATH.SetRecurseDir &SOURCE_PATH\drivers | |
; Note that the Linux awareness needs the kernel symbols to work | |
print "initializing multitask support..." | |
TASK.CONFIG .\linux ; loads Linux awareness (linux.t32) | |
MENU.ReProgram .\linux ; loads Linux menu (linux.men) | |
HELP.FILTER.Add rtoslinux ; add linux awareness manual to help filter | |
MENU.ReProgram .\sys\board ; add board tools | |
; switch on symbol autoloader | |
sYmbol.AutoLoad.CHECKLINUX "do "+os.ppd()+"/autoload " | |
; Group kernel area to be displayed with red bar | |
GROUP.Create "kernel" 0xc0000000--0xffffffff /RED | |
GROUP.Create "module" 0xbf000000--0xbfffffff /blue | |
; Ok, we're done, let's start Linux | |
SYStem.Option MMUSPACES OFF | |
enddo | |