262 lines
7.2 KiB
Plaintext
262 lines
7.2 KiB
Plaintext
|
|
ON ERROR JUMPTO EXIT
|
|
|
|
LOCAL &flashloader_pathname §or_size
|
|
Var.NEWLOCAL char[10][128] \download_file_pathname
|
|
Var.NEWLOCAL char[10][128] \download_file_address
|
|
|
|
; User Config Download Options
|
|
|
|
;&flashloader_pathname="~~~~/../../E3104/flashloader/flashloader_norflash.out"
|
|
;Var.set \download_file_pathname[0]="semi drive/e3/test/sfs.bin"
|
|
;Var.set \download_file_address[0]="0x10000000"
|
|
;Var.set \download_file_pathname[1]="semi drive/e3/test/rfd.bin"
|
|
;Var.set \download_file_address[1]="0x100000F0"
|
|
;Var.set \download_file_pathname[2]="semi drive/e3/test/boot0.bin"
|
|
;Var.set \download_file_address[2]="0x100C0000"
|
|
;Var.set \download_file_pathname[3]="semi drive/e3/test/boot1.bin"
|
|
;Var.set \download_file_address[3]="0x104C0000"
|
|
;Var.set \download_file_pathname[4]="semi drive/e3/test/boot2.bin"
|
|
;Var.set \download_file_address[4]="0x108C0000"
|
|
|
|
&flashloader_pathname="~~~~/../../E3640/flashloader/flashloader_hyperflash.out"
|
|
Var.set \download_file_pathname[0]="~~/semi drive/e3/test pathhavespace/sfs.bin"
|
|
Var.set \download_file_address[0]="0x10000000"
|
|
Var.set \download_file_pathname[1]="~~/semi drive/e3/test pathhavespace/rfd.bin"
|
|
Var.set \download_file_address[1]="0x100000F0"
|
|
Var.set \download_file_pathname[2]="~~/semi drive/e3/test pathhavespace/boot0.bin"
|
|
Var.set \download_file_address[2]="0x100C0000"
|
|
Var.set \download_file_pathname[3]="~~/semi drive/e3/test pathhavespace/boot1.bin"
|
|
Var.set \download_file_address[3]="0x104C0000"
|
|
Var.set \download_file_pathname[4]="~~/semi drive/e3/test pathhavespace/boot2.bin"
|
|
Var.set \download_file_address[4]="0x108C0000"
|
|
|
|
;&flashloader_pathname="~~~~/../../E3104/flashloader/flashloader_norflash.out"
|
|
;Var.set \download_file_pathname[0]="~~/semi drive/e3/test pathhavespace/sfs.bin"
|
|
;Var.set \download_file_address[0]="0x10000000"
|
|
;Var.set \download_file_pathname[1]="~~/semi drive/e3/test pathhavespace/rfd.bin"
|
|
;Var.set \download_file_address[1]="0x100000F0"
|
|
;Var.set \download_file_pathname[2]="~~/semi drive/e3/test pathhavespace/boot0.bin"
|
|
;Var.set \download_file_address[2]="0x10007000"
|
|
;Var.set \download_file_pathname[3]="~~/semi drive/e3/test pathhavespace/boot1.bin"
|
|
;Var.set \download_file_address[3]="0x10407000"
|
|
;Var.set \download_file_pathname[4]="~~/semi drive/e3/test pathhavespace/boot2.bin"
|
|
;Var.set \download_file_address[4]="0x10807000"
|
|
|
|
;&flashloader_pathname="~~~~/../../E3104/flashloader/flashloader_norflash.out"
|
|
;Var.set \download_file_pathname[0]="test_noflashloader/sfs.bin"
|
|
;Var.set \download_file_address[0]="0x10000000"
|
|
;Var.set \download_file_pathname[1]="test_noflashloader/rfd.bin"
|
|
;Var.set \download_file_address[1]="0x100000F0"
|
|
;Var.set \download_file_pathname[2]="test_noflashloader/boot0.bin"
|
|
;Var.set \download_file_address[2]="0x100C0000"
|
|
;Var.set \download_file_pathname[3]="test_noflashloader/boot1.bin"
|
|
;Var.set \download_file_address[3]="0x104C0000"
|
|
;Var.set \download_file_pathname[4]="test_noflashloader/boot2.bin"
|
|
;Var.set \download_file_address[4]="0x108C0000"
|
|
|
|
;&flashloader_pathname="test_nobin/flashloader.out"
|
|
;Var.set \download_file_pathname[0]="test_nobin/sfs.bin"
|
|
;Var.set \download_file_address[0]="0x10000000"
|
|
;Var.set \download_file_pathname[1]="test_nobin/rfd.bin"
|
|
;Var.set \download_file_address[1]="0x100000F0"
|
|
;Var.set \download_file_pathname[2]="test_nobin/boot0.bin"
|
|
;Var.set \download_file_address[2]="0x100C0000"
|
|
;Var.set \download_file_pathname[3]="test_nobin/boot1.bin"
|
|
;Var.set \download_file_address[3]="0x104C0000"
|
|
;Var.set \download_file_pathname[4]="test_nobin/boot2.bin"
|
|
;Var.set \download_file_address[4]="0x108C0000"
|
|
|
|
GOSUB CHECK_FILE_IS_EXIST "&flashloader_pathname"
|
|
GOSUB CHECK_FILES_IS_EXIST \download_file_pathname
|
|
GOSUB INIT
|
|
GOSUB DOWNLOAD_FILES \download_file_pathname \download_file_address §or_size
|
|
|
|
EXIT:
|
|
IF OS.FILE(flashloader.bin)==TRUE()
|
|
RM flashloader.bin
|
|
ON ERROR inherit
|
|
ENDDO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INIT:
|
|
; jtag clock config
|
|
SYStem.JtagClock 20MHz
|
|
|
|
; cpu config
|
|
SYStem.CPU CortexR5F
|
|
|
|
; mem access port
|
|
SYStem.CONFIG.apbaccessport 0
|
|
SYStem.CONFIG.apbap1.base 0x2000
|
|
SYStem.CONFIG.debugaccessport 0
|
|
SYStem.CONFIG.debugap1.base 0x2000
|
|
|
|
; DBG
|
|
SYStem.CONFIG.COREDEBUG.Base 0xF2081000
|
|
|
|
SYStem.attach
|
|
|
|
Break
|
|
|
|
PRIVATE &tcm_base &program_begin &program_end &arg_base
|
|
|
|
; disable mpu and cache
|
|
Data.SET C15:0x0001 0x08E7087A
|
|
Data.SET C15:0x0101 0x00000020
|
|
|
|
; init tcm
|
|
Data.LOAD.Elf "&flashloader_pathname" /NoCode
|
|
&tcm_base=ADDRESS.OFFSET(sYmbol.SECADDRESS(PrgCode))
|
|
&program_begin=ADDRESS.OFFSET(sYmbol.SECADDRESS(T32CodeBegin))
|
|
&program_end=ADDRESS.OFFSET(sYmbol.SECEND(T32CodeEnd))
|
|
Data.SET C15:0x0019 (&tcm_base+0x10000)|0x1
|
|
Data.SET C15:0x0119 &tcm_base|0x1
|
|
|
|
; generate flashloader.bin
|
|
Data.LOAD.Elf "&flashloader_pathname"
|
|
Data.SAVE.Binary flashloader.bin D:&program_begin--&program_end
|
|
|
|
; calc config para
|
|
&info_base=ADDRESS.OFFSET(sYmbol.SECADDRESS(DevDscr))
|
|
§or_size=DATA.Long(D:(&info_base+0xA0))
|
|
&arg_base=&tcm_base+0x20000-0x2020
|
|
|
|
FLASH.RESet
|
|
|
|
FLASH.Create 1. 0x10000000--0x11FFFFFF §or_size TARGET LONG
|
|
FLASH.TARGET &program_begin &arg_base 0x1000 flashloader.bin /STACKSIZE 0x1000
|
|
; test error handle
|
|
;FLASH.TARGET &program_begin &arg_base 0x1000++ flashloader.bin /STACKSIZE 0x1000
|
|
|
|
RETURN
|
|
|
|
|
|
|
|
CHECK_FILES_IS_EXIST:
|
|
PRIVATE &i &file_pathname &file_pathname_len
|
|
ENTRY &file_pathname_array
|
|
&i=0.
|
|
WHILE &i<10
|
|
(
|
|
&file_pathname_len=STRing.LENgth(Var.STRing(&file_pathname_array[&i]))
|
|
IF &file_pathname_len!=0
|
|
(
|
|
&file_pathname = Var.STRing(&file_pathname_array[&i])
|
|
GOSUB CHECK_FILE_IS_EXIST "&file_pathname"
|
|
&i=&i+1
|
|
)
|
|
ELSE
|
|
(
|
|
IF &i!=0
|
|
RETURN
|
|
ELSE
|
|
ENDDO
|
|
)
|
|
)
|
|
|
|
|
|
|
|
CHECK_FILE_IS_EXIST:
|
|
ENTRY &file_pathname
|
|
IF OS.FILE(&file_pathname)==FALSE()
|
|
(
|
|
PRINT &file_pathname " is not exist"
|
|
ENDDO
|
|
)
|
|
ELSE
|
|
RETURN
|
|
|
|
|
|
|
|
DOWNLOAD_FILES:
|
|
PRIVATE &i &file_pathname &file_pathname_len &file_address
|
|
ENTRY &file_pathname_array &file_address_array §or_size
|
|
&i=0.
|
|
WHILE &i<10
|
|
(
|
|
&file_pathname_len=STRing.LENgth(Var.STRing(&file_pathname_array[&i]))
|
|
IF &file_pathname_len!=0
|
|
(
|
|
&file_pathname = Var.STRing(&file_pathname_array[&i])
|
|
&file_address = Var.STRing(&file_address_array[&i])
|
|
GOSUB DOWNLOAD_FILE "&file_pathname" &file_address §or_size
|
|
&i=&i+1
|
|
)
|
|
ELSE
|
|
(
|
|
RETURN
|
|
)
|
|
)
|
|
|
|
|
|
|
|
DOWNLOAD_FILE:
|
|
PRIVATE &file_size §or_num &erase_address_end
|
|
ENTRY &download_file_pathname &download_file_address &download_sector_size
|
|
|
|
IF &download_file_address%&download_sector_size==0
|
|
(
|
|
&file_size=OS.FILE.SIZE(&download_file_pathname)
|
|
IF &file_size%&download_sector_size==0
|
|
§or_num=&file_size/&download_sector_size
|
|
ELSE
|
|
§or_num=&file_size/&download_sector_size+1
|
|
&erase_address_end=CONVert.INTTOHEX(&download_file_address+§or_num*§or_size-1)
|
|
FLASH.Erase &download_file_address--&erase_address_end
|
|
)
|
|
FLASH.Program ALL
|
|
Data.LOAD.Binary &download_file_pathname &download_file_address
|
|
FLASH.Program OFF
|
|
|
|
RETURN
|
|
|