diff --git a/tool/IPL/Flash_Bootloader_Spider.ttl b/tool/IPL/Flash_Bootloader_Spider.ttl index 6813fd1..9a8cc5d 100755 --- a/tool/IPL/Flash_Bootloader_Spider.ttl +++ b/tool/IPL/Flash_Bootloader_Spider.ttl @@ -1,301 +1,301 @@ -;--------------------------------------------------- -; Setting load image parameter -;--------------------------------------------------- -ARRAY_NUM = 10 -strdim IMGNM ARRAY_NUM -IMGNM[0] = 'bootparam_sa0.srec' -IMGNM[1] = 'icumx_loader.srec' -IMGNM[2] = 'cert_header_sa9.srec' -IMGNM[3] = 'dummy_fw.srec' -IMGNM[4] = 'dummy_rtos.srec' -IMGNM[5] = 'dummy_g4mh_case0.srec' -IMGNM[6] = 'dummy_icumh_case1.srec' -IMGNM[7] = 'bl31-spider.srec' -IMGNM[8] = 'tee-spider.srec' -IMGNM[9] = 'u-boot-elf-spider.srec' - -G4MH = 'Trampoline' -CR52 = 'Trampoline' -;--------------------------------------------------- -; Select G4MH OS -;--------------------------------------------------- -strdim LIST 2 - LIST[0] = '1: Trampoline' - LIST[1] = '2: Safeg-auto' -listbox '' 'Select G4MH OS' LIST -if result = 0 then - G4MH = 'Trampoline' -elseif result = 1 then - G4MH = 'Safeg-auto' -else - end -endif - -;--------------------------------------------------- -; Select CR52 OS -;--------------------------------------------------- -strdim LIST1 3 - LIST1[0] = '1: Trampoline' - LIST1[1] = '2: Trampoline(ether enable)' - LIST1[2] = '3: Zephyr' -listbox '' 'Select Cortex-R52 OS' LIST1 -if result = 0 then - CR52 = 'Trampoline' -elseif result = 1 then - CR52 = 'Trampoline(ether enable)' -elseif result = 2 then - CR52 = 'Zephyr' -else - end -endif - -;--------------------------------------------------- -; Change load image parameter -;--------------------------------------------------- -strcompare CR52 'Trampoline(ether enable)' -if result = 0 then - strcompare G4MH 'Trampoline' - if result = 0 then - IMGNM[4] = 'cr52_trampoline_deploy\cr52_eth.srec' - IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' - else - IMGNM[4] = 'cr52_trampoline_deploy\cr52_eth.srec' - IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' - endif -else - strcompare G4MH 'Trampoline' - if result = 0 then - strcompare CR52 'Trampoline' - if result = 0 then - IMGNM[4] = 'cr52_trampoline_deploy\cr52.srec' - IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' - else - IMGNM[4] = 'cr52_zephyr_deploy\cr52.srec' - IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' - endif - else - strcompare CR52 'Trampoline' - if result = 0 then - IMGNM[4] = 'cr52_trampoline_deploy\cr52.srec' - IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' - else - IMGNM[4] = 'cr52_zephyr_deploy\cr52.srec' - IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' - endif - endif -endif - -strdim SAVEADR ARRAY_NUM -SAVEADR[0] = '0' -SAVEADR[1] = '40000' -SAVEADR[2] = '240000' -SAVEADR[3] = '280000' -SAVEADR[4] = '500000' -SAVEADR[5] = '900000' -SAVEADR[6] = '380000' -SAVEADR[7] = 'E00000' -SAVEADR[8] = 'E80000' -SAVEADR[9] = 'F80000' - -strdim WRITESEL ARRAY_NUM -WRITESEL[0] = 'Flash' -WRITESEL[1] = 'Flash' -WRITESEL[2] = 'Flash' -WRITESEL[3] = 'Flash' -WRITESEL[4] = 'Flash' -WRITESEL[5] = 'Flash' -WRITESEL[6] = 'Flash' -WRITESEL[7] = 'Flash' -WRITESEL[8] = 'Flash' -WRITESEL[9] = 'Flash' - -;--------------------------------------------------- -; Setting FlashWriter parameter -;--------------------------------------------------- -FLASHWRITER_FILE = 'ICUMX_Flash_writer_SCIF_DUMMY_CERT_EB203000_S4.mot' -FLASHWRITER_SPEED = 1843200 - -;--------------------------------------------------- -; Select load all images or selected image -;--------------------------------------------------- -LOAD_FILES = 'all' -;LOAD_FILES = 'selected' - -;--------------------------------------------------- -; DO NOT EDIT THE FOLLOWING LINES -;--------------------------------------------------- -; Main program -;--------------------------------------------------- -getdir DIR - -call Load_FlashWriter - -;Automatically identify the start address from S-record. -strdim IMGADR ARRAY_NUM - -strcompare LOAD_FILES 'selected' -if result==0 then - call Load_selected_image -else - call Load_all_image -endif - -end - -;--------------------------------------------------- -; load FlashWriter -;--------------------------------------------------- -:Load_FlashWriter -filesearch FLASHWRITER_FILE -if result=0 then - sprintf 'File "%s" not found' FLASHWRITER_FILE - messagebox inputstr 'error' - break -endif - -setbaud FLASHWRITER_SPEED -sprintf2 FILE_NAME '%s\%s' DIR FLASHWRITER_FILE -sendfile FILE_NAME 1 -wait '>' - -return - -;--------------------------------------------------- -; load all images -;--------------------------------------------------- -:Load_All_image - -; file check -for i 0 ARRAY_NUM-1 - filesearch IMGNM[i] - if result=0 then - sprintf 'File "%s" not found' IMGNM[i] - messagebox inputstr 'error' - break - endif -next - -if result=1 then - for i 0 ARRAY_NUM-1 - index = i - call Decode_srec_start_address - strcompare WRITESEL[i] 'Flash' - if result=0 then - call Load_Image - endif - strcompare WRITESEL[i] 'eMMC' - if result=0 then - call Load_Image_eMMC - endif - next -else - messagebox "Cancel write all images" "error" -endif - -;messagebox "Write Complete" "" -return - -;--------------------------------------------------- -; Select load selected Image -;--------------------------------------------------- -:Load_selected_image -:retry - listbox 'Select the write image file' 'select image' IMGNM - index = result - if index = -1 then - else - ; file check - filesearch IMGNM[index] - If result=0 then - sprintf 'File "%s" not found' IMGNM[index] - messagebox inputstr 'error' - else - call Decode_srec_start_address - call Load_Image - endif - goto retry - endif -return - -;--------------------------------------------------- -; Decoed S-record start address -;--------------------------------------------------- -:Decode_srec_start_address - fileopen fhandle IMGNM[index] 0 1 - if fhandle = -1 then - sprintf 'File "%s" open error' IMGNM[i] - messagebox inputstr 'error' - break - endif - filereadln fhandle strvar - if result=1 then - fileclose fhandle - sprintf 'File "%s" S-record format error' IMGNM[i] - messagebox inputstr 'error' - break - endif - filereadln fhandle strvar - strcopy strvar 5 8 IMGADR[index] - fileclose fhandle -return - -;--------------------------------------------------- -; Load Image To Flash -;--------------------------------------------------- -:Load_Image -mpause 10 -sendln 'xls2' -wait ' Select (1-3)>' -mpause 10 -sendln '1' -wait '(Push Y key)' -mpause 10 -send 'y' -wait '(Push Y key)' -mpause 10 -send 'y' -wait ' Please Input : H' -mpause 1 -sendln IMGADR[index] -wait ' Please Input : H' -sendln SAVEADR[index] -mpause 400 -sprintf2 FILE_NAME '%s\%s' DIR IMGNM[index] -sendfile FILE_NAME 1 -wait 'complete!' 'Clear OK?(y/n)' -If result=1 goto proc_end -If result=2 goto send_y - -:send_y -send 'y' -wait '>' - -:proc_end -mpause 100 -return - -;--------------------------------------------------- -; Load Image To eMMC -;--------------------------------------------------- -:Load_Image_eMMC -mpause 10 -sendln 'em_w' -wait '(Push Y key)' -mpause 10 -send 'y' -wait ' Select area(0-2)>' -mpause 10 -sendln '1' -wait 'Please Input Start Address in sector :' -mpause 1 -sendln SAVEADR[index] -wait 'Please Input Program Start Address :' -sendln IMGADR[index] -mpause 400 -wait 'CR stop load)' -mpause 400 -sprintf2 FILE_NAME '%s\%s' DIR IMGNM[index] -sendfile FILE_NAME 1 -wait 'EM_W Complete!' -mpause 100 -return +;--------------------------------------------------- +; Setting load image parameter +;--------------------------------------------------- +ARRAY_NUM = 10 +strdim IMGNM ARRAY_NUM +IMGNM[0] = 'bootparam_sa0.srec' +IMGNM[1] = 'icumx_loader.srec' +IMGNM[2] = 'cert_header_sa9.srec' +IMGNM[3] = 'dummy_fw.srec' +IMGNM[4] = 'dummy_rtos.srec' +IMGNM[5] = 'dummy_g4mh_case0.srec' +IMGNM[6] = 'dummy_icumh_case1.srec' +IMGNM[7] = 'bl31-spider.srec' +IMGNM[8] = 'tee-spider.srec' +IMGNM[9] = 'u-boot-elf-spider.srec' + +G4MH = 'Trampoline' +CR52 = 'Trampoline' +;--------------------------------------------------- +; Select G4MH OS +;--------------------------------------------------- +strdim LIST 2 + LIST[0] = '1: Trampoline' + LIST[1] = '2: Safeg-auto' +listbox '' 'Select G4MH OS' LIST +if result = 0 then + G4MH = 'Trampoline' +elseif result = 1 then + G4MH = 'Safeg-auto' +else + end +endif + +;--------------------------------------------------- +; Select CR52 OS +;--------------------------------------------------- +strdim LIST1 3 + LIST1[0] = '1: Trampoline' + LIST1[1] = '2: Trampoline(ether enable)' + LIST1[2] = '3: Zephyr' +listbox '' 'Select Cortex-R52 OS' LIST1 +if result = 0 then + CR52 = 'Trampoline' +elseif result = 1 then + CR52 = 'Trampoline(ether enable)' +elseif result = 2 then + CR52 = 'Zephyr' +else + end +endif + +;--------------------------------------------------- +; Change load image parameter +;--------------------------------------------------- +strcompare CR52 'Trampoline(ether enable)' +if result = 0 then + strcompare G4MH 'Trampoline' + if result = 0 then + IMGNM[4] = 'cr52_trampoline_deploy\cr52_eth.srec' + IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' + else + IMGNM[4] = 'cr52_trampoline_deploy\cr52_eth.srec' + IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' + endif +else + strcompare G4MH 'Trampoline' + if result = 0 then + strcompare CR52 'Trampoline' + if result = 0 then + IMGNM[4] = 'cr52_trampoline_deploy\cr52.srec' + IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' + else + IMGNM[4] = 'cr52_zephyr_deploy\cr52.srec' + IMGNM[5] = 'g4mh_trampoline_deploy\g4mh.srec' + endif + else + strcompare CR52 'Trampoline' + if result = 0 then + IMGNM[4] = 'cr52_trampoline_deploy\cr52.srec' + IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' + else + IMGNM[4] = 'cr52_zephyr_deploy\cr52.srec' + IMGNM[5] = 'g4mh_safegauto_deploy\g4mh.srec' + endif + endif +endif + +strdim SAVEADR ARRAY_NUM +SAVEADR[0] = '0' +SAVEADR[1] = '40000' +SAVEADR[2] = '240000' +SAVEADR[3] = '280000' +SAVEADR[4] = '500000' +SAVEADR[5] = '900000' +SAVEADR[6] = '380000' +SAVEADR[7] = 'E00000' +SAVEADR[8] = 'E80000' +SAVEADR[9] = 'F80000' + +strdim WRITESEL ARRAY_NUM +WRITESEL[0] = 'Flash' +WRITESEL[1] = 'Flash' +WRITESEL[2] = 'Flash' +WRITESEL[3] = 'Flash' +WRITESEL[4] = 'Flash' +WRITESEL[5] = 'Flash' +WRITESEL[6] = 'Flash' +WRITESEL[7] = 'Flash' +WRITESEL[8] = 'Flash' +WRITESEL[9] = 'Flash' + +;--------------------------------------------------- +; Setting FlashWriter parameter +;--------------------------------------------------- +FLASHWRITER_FILE = 'ICUMX_Flash_writer_SCIF_DUMMY_CERT_EB203000_S4.mot' +FLASHWRITER_SPEED = 1843200 + +;--------------------------------------------------- +; Select load all images or selected image +;--------------------------------------------------- +LOAD_FILES = 'all' +;LOAD_FILES = 'selected' + +;--------------------------------------------------- +; DO NOT EDIT THE FOLLOWING LINES +;--------------------------------------------------- +; Main program +;--------------------------------------------------- +getdir DIR + +call Load_FlashWriter + +;Automatically identify the start address from S-record. +strdim IMGADR ARRAY_NUM + +strcompare LOAD_FILES 'selected' +if result==0 then + call Load_selected_image +else + call Load_all_image +endif + +end + +;--------------------------------------------------- +; load FlashWriter +;--------------------------------------------------- +:Load_FlashWriter +filesearch FLASHWRITER_FILE +if result=0 then + sprintf 'File "%s" not found' FLASHWRITER_FILE + messagebox inputstr 'error' + break +endif + +setbaud FLASHWRITER_SPEED +sprintf2 FILE_NAME '%s\%s' DIR FLASHWRITER_FILE +sendfile FILE_NAME 1 +wait '>' + +return + +;--------------------------------------------------- +; load all images +;--------------------------------------------------- +:Load_All_image + +; file check +for i 0 ARRAY_NUM-1 + filesearch IMGNM[i] + if result=0 then + sprintf 'File "%s" not found' IMGNM[i] + messagebox inputstr 'error' + break + endif +next + +if result=1 then + for i 0 ARRAY_NUM-1 + index = i + call Decode_srec_start_address + strcompare WRITESEL[i] 'Flash' + if result=0 then + call Load_Image + endif + strcompare WRITESEL[i] 'eMMC' + if result=0 then + call Load_Image_eMMC + endif + next +else + messagebox "Cancel write all images" "error" +endif + +;messagebox "Write Complete" "" +return + +;--------------------------------------------------- +; Select load selected Image +;--------------------------------------------------- +:Load_selected_image +:retry + listbox 'Select the write image file' 'select image' IMGNM + index = result + if index = -1 then + else + ; file check + filesearch IMGNM[index] + If result=0 then + sprintf 'File "%s" not found' IMGNM[index] + messagebox inputstr 'error' + else + call Decode_srec_start_address + call Load_Image + endif + goto retry + endif +return + +;--------------------------------------------------- +; Decoed S-record start address +;--------------------------------------------------- +:Decode_srec_start_address + fileopen fhandle IMGNM[index] 0 1 + if fhandle = -1 then + sprintf 'File "%s" open error' IMGNM[i] + messagebox inputstr 'error' + break + endif + filereadln fhandle strvar + if result=1 then + fileclose fhandle + sprintf 'File "%s" S-record format error' IMGNM[i] + messagebox inputstr 'error' + break + endif + filereadln fhandle strvar + strcopy strvar 5 8 IMGADR[index] + fileclose fhandle +return + +;--------------------------------------------------- +; Load Image To Flash +;--------------------------------------------------- +:Load_Image +mpause 10 +sendln 'xls2' +wait ' Select (1-3)>' +mpause 10 +sendln '1' +wait '(Push Y key)' +mpause 10 +send 'y' +wait '(Push Y key)' +mpause 10 +send 'y' +wait ' Please Input : H' +mpause 1 +sendln IMGADR[index] +wait ' Please Input : H' +sendln SAVEADR[index] +mpause 400 +sprintf2 FILE_NAME '%s\%s' DIR IMGNM[index] +sendfile FILE_NAME 1 +wait 'complete!' 'Clear OK?(y/n)' +If result=1 goto proc_end +If result=2 goto send_y + +:send_y +send 'y' +wait '>' + +:proc_end +mpause 100 +return + +;--------------------------------------------------- +; Load Image To eMMC +;--------------------------------------------------- +:Load_Image_eMMC +mpause 10 +sendln 'em_w' +wait '(Push Y key)' +mpause 10 +send 'y' +wait ' Select area(0-2)>' +mpause 10 +sendln '1' +wait 'Please Input Start Address in sector :' +mpause 1 +sendln SAVEADR[index] +wait 'Please Input Program Start Address :' +sendln IMGADR[index] +mpause 400 +wait 'CR stop load)' +mpause 400 +sprintf2 FILE_NAME '%s\%s' DIR IMGNM[index] +sendfile FILE_NAME 1 +wait 'EM_W Complete!' +mpause 100 +return