56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
; --------------------------------------------------------------------------------
|
|
; @Title: Example script to save the contents of all FLASH sectors to a file
|
|
; @Description:
|
|
; Save all flash sectors to a file. Required for flash modules with
|
|
; non continuous address space
|
|
; @Keywords: practice, flash
|
|
; @Author: rweiss
|
|
; @Copyright: (C) 1989-2016 Lauterbach GmbH, licensed for use with TRACE32(R) only
|
|
; --------------------------------------------------------------------------------
|
|
; $Id: saveallsectors.cmm 10115 2016-10-24 09:35:34Z rweiss $
|
|
|
|
|
|
;make sure that the FLASH flash sectors are declared
|
|
;and find address of first flash sector
|
|
LOCAL &flashstartaddress
|
|
&flashstartaddress=C:0x00000000
|
|
|
|
IF !FLASH.SECTOR.EXIST(&flashstartaddress)
|
|
(
|
|
&flashstartaddress=FLASH.SECTOR.NEXT(&flashstartaddress)
|
|
IF ADDRESS.OFFSET(&flashstartaddress)==0
|
|
(
|
|
FLASH.LIST
|
|
DIALOG.OK "Flash is not declared. Aborting."
|
|
ENDDO
|
|
)
|
|
)
|
|
|
|
;ask user for file name
|
|
LOCAL &path
|
|
DIALOG.File.SAVE *.s3
|
|
ENTRY %LINE &path
|
|
IF "&path"==""
|
|
ENDDO
|
|
|
|
;delete old file (so we can simply use Data.SAVE .. /Append every time)
|
|
IF FILE.EXIST("&path")
|
|
DEL "&path"
|
|
|
|
;iterate through FLASH sector list
|
|
LOCAL §oraddress
|
|
§oraddress=&flashstartaddress
|
|
|
|
RePeaT
|
|
(
|
|
PRINT "Saving sector at §oraddress"
|
|
Data.SAVE.S3record "&path" §oraddress++(FLASH.SECTOR.SIZE(§oraddress)-1) /SkipErrors /Append
|
|
|
|
;get next sector
|
|
§oraddress=FLASH.SECTOR.NEXT(§oraddress)
|
|
)
|
|
WHILE ADDRESS.OFFSET(§oraddress)!=0
|
|
|
|
PRINT "Saving FLASH sectors to &path completed."
|
|
ENDDO
|