⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jnand.cmm

📁 QUALCOMM JNAND DRIVER
💻 CMM
📖 第 1 页 / 共 3 页
字号:
      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 Rsrc2 name is &ELFname"
      print "Processed Rsrc2 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   ;AdjustRsrc2Name

AdjustFSName:

  if "&ProcessElfName"=="yes"
  (
    ; If we have no elf name, have user choose an elf file
    if "&ELFname"==""
    (
      print "Please select a Factory F/S to program"
      dialog.file ..\..\build\ms\*.bin
      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",".bin",0)==-1
    (
      &ELFname="&ELFname.bin"
    )
    if "&DoDebug"=="yes"
    (
      print "Processed Factory F/S name is &ELFname"
      print "Processed Factory F/S 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   ;AdjustFSName

AdjustFontName:

  if "&ProcessElfName"=="yes"
  (
    ; If we have no elf name, have user choose an elf file
    if "&ELFname"==""
    (
      print "Please select a Font to program"
      dialog.file ..\..\build\ms\*.bin
      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",".bin",0)==-1
    (
      &ELFname="&ELFname.bin"
    )
    if "&DoDebug"=="yes"
    (
      print "Processed Font name is &ELFname"
      print "Processed Font 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   ;AdjustFontName

Rsrc1Image:

	 ; set up addresses used with FLASH.* commands
	 &RomBegin=&JnandRsrc1Begin
	 &RomEnd=&JnandRsrc1End
	 gosub CreateRom
	 
	 
	 ;--------------------------------------------------------
	 ; Initialize the JNAND program - must succeed
	 ;  will probe flash and set up first block for writing
	 ; We have to set this command up by hand as it is one
	 ;  that we added to the flash.* protocol and JTAG does
	 ;  not know about it.
	 ;--------------------------------------------------------
	 ;
   if "&Verbose"=="yes"
   (
	  print "Probing flash and validating boot info blocks"
	 )
	&Command="Flash Initialize for Rsrc1 Programming"
	 data.set &ParmCmd	%LONG &InitCmd
	 data.set &ParmAddr	%LONG &RomBegin
	 r.s pc &StartAddr
	 go
	 gosub check_status  ;; will not return if error
	&ElfImage="&ELFdir\&ELFname"
	 gosub DoProgrammingBin  
	
	
	 gosub CleanUp 
   if "&Verbose"=="yes"
   (
	   print "Flash is programmed and verified" 
   )
return


Rsrc2Image:

	 ; set up addresses used with FLASH.* commands
	 &RomBegin=&JnandRsrc2Begin
	 &RomEnd=&JnandRsrc2End
	 gosub CreateRom
	 
	 
	 ;--------------------------------------------------------
	 ; Initialize the JNAND program - must succeed
	 ;  will probe flash and set up first block for writing
	 ; We have to set this command up by hand as it is one
	 ;  that we added to the flash.* protocol and JTAG does
	 ;  not know about it.
	 ;--------------------------------------------------------
	 ;
   if "&Verbose"=="yes"
   (
	  print "Probing flash and validating boot info blocks"
	 )
   &Command="Flash Initialize for Rsrc2 Programming"
	 data.set &ParmCmd	%LONG &InitCmd
	 data.set &ParmAddr	%LONG &RomBegin
	 r.s pc &StartAddr
	 go
	 gosub check_status  ;; will not return if error
   &ElfImage="&ELFdir\&ELFname"
	 gosub DoProgrammingBin  
	
	gosub CleanUp 
   if "&Verbose"=="yes"
   (
	   print "Flash is programmed and verified" 
   )
return


FSImage:

	 ; set up addresses used with FLASH.* commands
	 &RomBegin=&JnandFSBegin
	 &RomEnd=&JnandFSEnd
	 gosub CreateRom
	 
	 
	 ;--------------------------------------------------------
	 ; Initialize the JNAND program - must succeed
	 ;  will probe flash and set up first block for writing
	 ; We have to set this command up by hand as it is one
	 ;  that we added to the flash.* protocol and JTAG does
	 ;  not know about it.
	 ;--------------------------------------------------------
	 ;
   if "&Verbose"=="yes"
   (
	  print "Probing flash and validating boot info blocks"
	 )
   &Command="Flash Initialize for Factory F/S Programming"
	 data.set &ParmCmd	%LONG &InitCmd
	 data.set &ParmAddr	%LONG &RomBegin
	 r.s pc &StartAddr
	 go
	 gosub check_status  ;; will not return if error
   &ElfImage="&ELFdir\&ELFname"
	 gosub DoProgrammingBin  
	
	 gosub CleanUp 
   if "&Verbose"=="yes"
   (
	   print "Flash is programmed and verified" 
   )
return

FontImage:

	 ; set up addresses used with FLASH.* commands
	 &RomBegin=&JnandFontBegin
	 &RomEnd=&JnandFontEnd
	 gosub CreateRom
	 
	 
	 ;--------------------------------------------------------
	 ; Initialize the JNAND program - must succeed
	 ;  will probe flash and set up first block for writing
	 ; We have to set this command up by hand as it is one
	 ;  that we added to the flash.* protocol and JTAG does
	 ;  not know about it.
	 ;--------------------------------------------------------
	 ;
   if "&Verbose"=="yes"
   (
	  print "Probing flash and validating boot info blocks"
	 )
   &Command="Flash Initialize for Font Programming"
	 data.set &ParmCmd	%LONG &InitCmd
	 data.set &ParmAddr	%LONG &RomBegin
	 r.s pc &StartAddr
	 go
	 gosub check_status  ;; will not return if error
   &ElfImage="&ELFdir\&ELFname"
	 gosub DoProgrammingBin  
	
	 gosub CleanUp 
   if "&Verbose"=="yes"
   (
	   print "Flash is programmed and verified" 
   )
return


DoProgrammingBin:

	 ;--------------------------------------------------------
	 ; Call erase function.  Will only erase blocks 1 and 2
	 ; where we will put the boot info block. If either of
	 ; these fail, then the flash is unusable and we bail out
	 ; The parameters passed are ignored but to satisfy the JTAG
	 ;  ICD, they must match the flash.create command above
	 ;--------------------------------------------------------
	 ;
   

   if "&Verbose"=="yes"
   (
	   print "Erasing Flash Boot Info Blocks"
	 )
   &Command="Flash Erase Boot Info Blocks"
   
	 flash.erase &RomBegin--&RomEnd
	 
	 gosub check_status  ;; will not return if error
	
	 ;--------------------------------------------------------
	 ; put into program mode 
	 ;--------------------------------------------------------
	 flash.program all
	 
	 ;--------------------------------------------------------
	 ; actual flash programming happens here
	 ;--------------------------------------------------------
	 &Command="Flash Program"
	 
	 ; print "Select file to program in browser: "
	 d.load.binary &ElfImage &RomBegin--&RomEnd
	 
	 gosub check_status  ;; will not return if error
	 
	 ;--------------------------------------------------------
	 ; OK we're finished, turn off programming mode.
   ; If we do not turn it off, any data writes within
   ; the address range of the defined ROM will be taken
   ; as flash programming commands and this will cause
   ; failures if the code size overlaps the parameter
   ; block address.
	 ;--------------------------------------------------------
	 flash.program off
	
	 ;--------------------------------------------------------
	 ; 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

DumpFlash:
	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

	print " <<< Input NAND address to read >>>"
	print " ex) 0x2D00000"
	print "> "

	&t32_cmm_stopped=1
	enter &arg1
	&t32_cmm_stopped=0

	&arg2=0x100000
	print " <<< Input Destination SDRAM address (0x00000000 ~ 0x01FFFFFF) )>>>"
	print " ex) 0x100000"
	print "> "

	&t32_cmm_stopped=1
	enter &arg2
	&t32_cmm_stopped=0

	print " <<< Input size to read >>>"
	print " ex) 0x10000"
	print "> "

	&t32_cmm_stopped=1
	enter &arg3
	&t32_cmm_stopped=0

	&Command="Dump Flash"
	data.set &ParmCmd		%LONG &DumpCmd
	data.set &ParmFlashaddr	%LONG &arg1
	data.set &ParmAddr		%LONG &arg2
	data.set &ParmSize		%LONG &arg3
	r.s pc &StartAddr
	go
	gosub check_status  ;; will not return if error

	d.dump &arg2

return

END





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -