📄 jnand.bak
字号:
;--------------------------------------------------------
; Report statistics gathered during flash programming
;--------------------------------------------------------
;
if "&Verbose"=="yes"
(
print "Reporting Statistics"
)
&Command="Flash Report"
data.set &ParmCmd %LONG &ReportCmd
r.s pc &StartAddr
go
gosub check_status ;; will not return if error
gosub report_stats
return
;=====================================================
; --- Function to create the FLASH map
;=====================================================
CreateRom:
;======================================================
; Map flash readonly - must encompass the addresse
; of the image being loaded
;======================================================
map.readonly &RomBegin--&RomEnd
;======================================================
; Load our flash programming routine and prepare flash
;======================================================
d.load.elf "jnand.elf"
; need this breakpoint as per Lauterbach Spec so that we
; can hand back control to the Debugger
break.delete /ALL
break.set swbp
;--------------------------------------------------------
; reset our flash command
;--------------------------------------------------------
flash.res
;--------------------------------------------------------
; Let flash command know where our routine and buffer is located
; code at &JnandCodeAddr, data at &JnandParamAddr, buffer size = 16K
; Earlier versions of JTAG s/w would allow larger buffer of 64k
; but now we seem to be limited to 16k
;--------------------------------------------------------
;
flash.target &JnandCodeAddr &JnandParamAddr 4000
;--------------------------------------------------------
; Define our flash range and tell flash command we're using
; our own flash programming routine via keyword "target"
; right now, we are defining 3 MBytes for code which in
; the NAND environment is meaningless, as this has to do
; with memory mapping in the flash, but we have to use it
; to use the other FLASH.* functions
;--------------------------------------------------------
;
flash.create &RomBegin--&RomEnd target word
return
;=====================================================
; --- Function to clean up the FLASH map after each
; iteration of the loop
;=====================================================
CleanUp:
;--------------------------------------------------------
; ok we're finished, turn off programming mode
;--------------------------------------------------------
flash.program off
FLASH.Reset
MAP.Reset
return
;=====================================================
; --- Function to clean up just before exit
;=====================================================
CleanUpExit:
;--------------------------------------------------------
; ok we're finished completely, clean up for exit
;--------------------------------------------------------
sys.d
b.delete /all
sys.u
return
;============================================================================
; If not in factory mode, process the elf name, helping the user all we
; can so that they have as little work to do as possible.
;
; Processing is slightly different if invoked with NOMENU, STD or FACTORY
;============================================================================
AdjustElfName:
if "&ProcessElfName"=="yes"
(
; If we have no elf name, have user choose an elf file
if "&ELFname"==""
(
print "Please select a code image to program"
dialog.file .\*.elf
ENTRY &ELFname
)
; If MenuMode is NOMENU, we need to precede build with "normal" path
; to the DMSS build directory if not already there. This allows
; the user to sue "do jnload SNTA" and we will find it in ..\..\build\ms
if "&MenuMode"=="NOMENU"
(
&ELFdir=OS.FILE.PATH(&ELFname)
&OSPwd=OS.PWD()
if "&ELFdir"=="&OSPwd"
(
&ELFname=".\&ELFname"
if "&DoDebug"=="yes"
(
print "Directory adjusted ELFname is now &ELFname"
)
)
)
; If MenuMode is STD, we need to precede build with "normal" path
; to the DMSS build directory. This allows the user to merely type
; "do jnand SNTA" and we will find it in ..\..\build\ms
if "&MenuMode"=="STD"
(
&ELFdir=OS.FILE.PATH(&ELFname)
&OSPwd=OS.PWD()
if "&ELFdir"=="&OSPwd"
(
&ELFname=".\&ELFname"
if "&DoDebug"=="yes"
(
print "Directory adjusted ELFname is now &ELFname"
)
)
)
&ELFdir=OS.FILE.PATH(&ELFname)
&ELFname=OS.FILE.NAME(&ELFname)
IF STRING.SCAN("&ELFname",".elf",0)==-1
(
&ELFname="&ELFname.elf"
)
if "&DoDebug"=="yes"
(
print "Processed ELFname is &ELFname"
print "Processed ELFdir is &ELFdir"
print "Image to flash is &ELFdir\&ELFname"
)
)
else
(
if "&DoDebug"=="yes"
(
print "NOT processing ELFname and ELFdir in FACTORY mode now"
)
)
return ;AdjustElfName
;============================================================================
; Process the arguments and set modes accordingly
;============================================================================
ProcessCmdLine:
; Any mode can take DEBUG, must be first, process it first
if "&arg1"=="DEBUG"
(
print "JNAND called with arg1 = &arg1 arg2 = &arg2 arg3 = &arg3"
; Strip out DEBUG and shift arguments
&DoDebug="yes"
&arg1="&arg2"
&arg2="&arg3"
)
if "&arg1"=="NOMENU"
(
; NOMENU mode can take an optional ELF argument
&MenuMode="&arg1"
&ELFname="&arg2"
&Verbose="no"
&SymbolArg=""
)
else
(
if "&arg1"=="FACTORY"
(
; FACTORY mode takes no arguments
&MenuMode="&arg1"
&ProcessElfName="yes"
&Verbose="yes"
)
else
(
; Normal mode, JNAND invoked directly
&ELFname="&arg1"
&Verbose="yes"
)
)
if "&DoDebug"=="yes"
(
print "MenuMode is &MenuMode"
print "Debug is &DoDebug"
print "Verbose is &Verbose"
print "ELFname is &ELFname"
)
return ; ProcessCmdLine
;============================================================================
; Present user with normal main menu for JNAND. Manual selection is done.
;============================================================================
NormalMenu:
if "&ClearWin"=="yes"
(
area.RESET
)
MainMenu:
print
print
print "------------------------------------------------"
print "| _ _ _ _ _ _ ____ |"
print "| | | \ | | / \ | \ | | _ \ |"
print "| _ | | \| | / _ \ | \| | | | | |"
print "| | |_| | |\ |/ ___ \| |\ | |_| | |"
print "| \___/|_| \_/_/ \_\_| \_|____/ |"
print "| |"
print "| |"
print "| Flash Programmer |"
print "| |"
print "| |"
print "| Copyright (c) 2002-2003 by QUALCOMM, Inc. |"
print "| |"
print "------------------------------------------------"
print
print
print " 0: Exit"
print " 1: Program Boot Block Only"
print " 2: Download SECDLOAD.elf"
print " 3: Download Rsrc1.cnt"
print " 4: Download Rsrc2.cnt"
print " 5: Download FactoryFS.bin"
print " 6: Download font"
print " 7: Dump Flash"
print
print " Please make a choice: "
&t32_cmm_stopped=1
enter &Choice
&t32_cmm_stopped=0
print
print
if "&ClearWin"=="yes"
(
area.RESET
)
if &Choice==0
(
print "...exiting JNAND Flash Programmer"
gosub CleanUpExit
return
)
if &Choice==1
(
print "Programming Boot Block Only Into NAND Flash"
print
print
gosub BootOnly
)
if &Choice==2
(
print "Programming Code Image Into NAND Flash"
print
print
&ELFname=""
gosub AdjustElfName
gosub CodeImage
)
if &Choice==3
(
print "Download Rsrc1.cnt"
print
print
&ELFname=""
gosub AdjustRsrc1Name
gosub Rsrc1Image
)
if &Choice==4
(
print "Download Rsrc2.cnt"
print
print
&ELFname=""
gosub AdjustRsrc2Name
gosub Rsrc2Image
)
if &Choice==5
(
print "Download FactoryFS.bin"
print
print
&ELFname=""
gosub AdjustFSName
gosub FSImage
)
if &Choice==6
(
print "Download font"
print
print
&ELFname=""
gosub AdjustFontName
gosub FontImage
)
if &Choice==7
(
print "Dump Flash"
print
print
&ELFname=""
gosub DumpFlash
)
goto MainMenu
return ; NormalMenu
;============================================================================
; Do not present user with menu. Program both BootLoader and Code Images
;============================================================================
DoNoMenu:
gosub AdjustElfName
gosub BootOnly
gosub CodeImage
gosub CleanUpExit
return ; DoNoMenu
;============================================================================
; Present user with Factory Programming Menu
;============================================================================
FactoryMenu:
print "Factory Mode not supported yet"
print "cd to ......\tools\fact_strt_jnand and do fact_strt_jnand"
return ; FactoryMenu
AdjustRsrc1Name:
if "&ProcessElfName"=="yes"
(
; If we have no elf name, have user choose an elf file
if "&ELFname"==""
(
print "Please select a Rsrc1 to program"
dialog.file ..\..\build\ms\*.cnt
ENTRY &ELFname
)
; If MenuMode is NOMENU, we need to precede build with "normal" path
; to the DMSS build directory if not already there. This allows
; the user to sue "do jnload SNTA" and we will find it in ..\..\build\ms
if "&MenuMode"=="NOMENU"
(
&ELFdir=OS.FILE.PATH(&ELFname)
&OSPwd=OS.PWD()
if "&ELFdir"=="&OSPwd"
(
&ELFname="..\..\build\ms\&ELFname"
if "&DoDebug"=="yes"
(
print "Directory adjusted ELFname is now &ELFname"
)
)
)
; If MenuMode is STD, we need to precede build with "normal" path
; to the DMSS build directory. This allows the user to merely type
; "do jnand SNTA" and we will find it in ..\..\build\ms
if "&MenuMode"=="STD"
(
&ELFdir=OS.FILE.PATH(&ELFname)
&OSPwd=OS.PWD()
if "&ELFdir"=="&OSPwd"
(
&ELFname="..\..\build\ms\&ELFname"
if "&DoDebug"=="yes"
(
print "Directory adjusted ELFname is now &ELFname"
)
)
)
&ELFdir=OS.FILE.PATH(&ELFname)
&ELFname=OS.FILE.NAME(&ELFname)
IF STRING.SCAN("&ELFname",".cnt",0)==-1
(
&ELFname="&ELFname.cnt"
)
if "&DoDebug"=="yes"
(
print "Processed Rsrc1 name is &ELFname"
print "Processed Rsrc1 dir is &ELFdir"
print "Image to flash is &ELFdir\&ELFname"
)
)
else
(
if "&DoDebug"=="yes"
(
print "NOT processing ELFname and ELFdir in FACTORY mode now"
)
)
return ;AdjustRsrc1Name
AdjustRsrc2Name:
if "&ProcessElfName"=="yes"
(
; If we have no elf name, have user choose an elf file
if "&ELFname"==""
(
print "Please select a Rsrc2 to program"
dialog.file ..\..\build\ms\*.cnt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -