[Android Development on Bada] Tigrouzen:
Qualcomm nandjtag CMM

;****************************************************************************

;** jload.CMM Greg Bullard 01 May 2002 **

;** This script sets up MSM6100/MSM6300 for software load **

;** and debug **

;** **

;** Changes: **

;** 05-01-02 First version **

;****************************************************************************

;This .cmm script acts as a main routine for setting up a MSM6100/MSM6300 platform.

;

; detect if this script has already been run -- only do this for parts that

; get called when the jtag reconnects with the target

;

;

;

; CMM script variables

;

;

;

; image to load to target

global &ELFname

global &ELFdir

&ELFdir= "."

ENTRY &ELFname

&ELFname="surfst"

; load up globals, reset config to blank

DO Constants.cmm

WinClear

System.Reset

; WINDOW work, pre-load

;winpos X.start y.start x.width y.height x.scalearea y.scalearea name mode title

; WinPOS sets up the parameters for the next window-generating command

; start, width, height parameters can be in

; % (percentage) of the T32 app window, upper left is 0%,0%

; nn. (integer), in units of rows or columns of text

; for scale area, see online help (units of rows & cols only)

; Delete all existing windows.

WinPage.Reset

SCREEN.ON // refresh screen after every print command

;create CMM logging window, named LOG_WIN

WINPOS 50% 5% 50. 20. 0. 0. LOG_WIN NORMAL "CMM Log Window"

area

&DATE=CLOCK.DATE()

&TIME=CLOCK.TIME()

PRINT " "

PRINT "MSM6100/MSM6300 JLOAD &ELFname commenced &DATE at &TIME"

;

;

;

;

; system options

;

;

;

;

; Turbo mode of debug state accesses - CPU makes checks of memory access in debug mode

System.Option TURBO off

; Disable "Emulator berr error"

System.Option ShowError OFF

; Disassembler selection - Automatically selects correct one.

System.Option DisMode Auto

; select CPU and options

SYSTEM.CPU ARM926EJ

;SYSTEM.CPU ARM9E

SYSTEM.OPTION BIGENDIAN OFF

SYSTEM.OPTION ENRESET ON

; configure the JTAG clock

SYStem.JtagClock 2000000. // set 2MHz jtag clock, until RTCK is available

system.up

;

;

;

;

; Target specific setup information

;

;

;

; establish rudimentary setup information -- modify this on a target-by-target basis

&TARGET_TYPE="BUCK_SURF&DP6100"

; try to autodetect target_type -- read mainboard nor -- if not present, assume FFA

&SW_LOAD_INFO_FILE="./buildinfo.cmm"

;

;

;

;

; Setup Memory map based on Target configuration

;

;

;

; read surf config from ROM

; address following should be automatically calculated

;&HW_CONFIG_MAINBOARD_ADDR=&EBI2_NOR_BASE_ADDR+0x00000010

; use beginning of NOR

;

; later features

; do DetectTarget

; read Buck ROM

; read Farnsworth ROM

; read switch settings

; read MSM registers for config/version

; Parse ROM values

; string.scan

; read this switch value from the CPLDs

&BOOT_MODE="NOR"

&SHADOW_MODE=1

;

;

; Establish the memory map for the memory configuration, and set flags

; for the memories to configure

;

;

do setupMemMap

;

; get clock rates setup. later feature: crank up clock for load of code.

&MCLK_RATE=19200000. // don't forget the decimal or you'll be using 19.2mil hex

&HCLK_RATE=19200000.

&MEM_CTL_MARGIN_NS=30. // timing margin for memory controller settings, in nanoseconds

; 5ns is a reasonable number when things are stable

; setup clocks

;

;

;

;

; Setup MSM for download -- memory registers, GPIOs, Memory controller if needed

;

;

;

print "setting up memories"

do setupmems

;

; setup other stuff (clocks, etc. Later)

;

;

; load check script

;/// os.find (tells if a file exists)

;

;

;

; Setup environment defaults

;

;

;

Symbol.AsmFrame on

Symbol.CutLine 3

Symbol.Spath + ".."

Symbol.case off

;

;

;

; Download and set initial breakpoints

;

;

;

; load the image

IF "&ELFname"==""

(

print "select file to program in browser: "

d.load.elf *.elf

)

ELSE

(

print "Loading &ELFname.elf target image "

data.load.elf &ELFdir\&ELFname.elf

)

; resets registers

register.reset

; setup breakpoints

break.delete /all

do breakpoints.cmm

;

;

;

; Setup Path for source code (y.spath env variable)

;

;

do setupyspath.cmm

;

;

;

; Window Setup

;

;

;

do setupWindows.cmm

PRINT "Completed JLOAD &ELFname ..."

PRINT " ...for &TARGET_TYPE boot: &BOOT_MODE"

;need batch file to install startup things in the right jtag directory

; need a script to replace sys.dn, including putting sdram into self refresh if needed

; call autorefresh MSMrefresh

; script probably needs to peruse data monitoring windows and freeze them

;/// data dump windows may have been halted

; need a sys.up

; setup sdramc, unfreeze data monitoring windows

; script to write parameters to NOR flashes, NAND flash

; script to read parameters from NOR flashes, and display

; Write string into first bytes of flash, before date, indicating TARGET_CONFIG_BLOCK or similar

;

;Write a log file of actions taken...

ENDDO