From ac2c0f26100ec20a15184d18b8840c54f78f96b4 Mon Sep 17 00:00:00 2001 From: Zeqing Qin Date: Tue, 11 Apr 2023 16:33:11 +0800 Subject: [PATCH] =?UTF-8?q?bl808:=20=E7=BB=86=E5=8C=96flags=EF=BC=8C?= =?UTF-8?q?=E5=AE=9A=E4=BD=8DflashCfgTable=EF=BC=8C=E5=AE=9A=E4=BD=8Dgroup?= =?UTF-8?q?=5Fimage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zeqing Qin --- BL808Image.bt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/BL808Image.bt b/BL808Image.bt index b727590..97f75c7 100644 --- a/BL808Image.bt +++ b/BL808Image.bt @@ -33,6 +33,16 @@ typedef struct { uint32 boot2_pt_table_1 ; uint32 flashCfgTableAddr ; uint32 flashCfgTableLen ; + + local quad off = FTell(); + if(flashCfgTableAddr < FileSize() && flashCfgTableAddr + flashCfgTableLen <= FileSize()) { + FSeek(flashCfgTableAddr); + ubyte flashCfgTable[flashCfgTableLen] ; + } else { + Warning("flashCfgTable appears to either overlap with header, exist after the end of the file or overlap with the end of the file!"); + } + FSeek(off); + HAL_PATCH_CFG patch_on_read[4] ; HAL_PATCH_CFG patch_on_jump[4] ; uint32 reserved[5]; @@ -155,11 +165,20 @@ typedef struct { } HAL_SYS_CLK_CONFIG; typedef struct { - uint32 flags ; + uint32 sign_type : 2 ; uint32 encrypt_type : 2 ; uint32 key_sel : 2 ; uint32 xts_mode : 1 ; uint32 aes_region_lock : 1 ; uint32 no_segment : 1 ; uint32 boot2_enable : 1 ; uint32 boot2_rollback : 1 ; uint32 cpu_master_id : 4 ; uint32 notload_in_bootrom : 1 ; uint32 crc_ignore : 1 ; uint32 hash_ignore : 1 ; uint32 power_on_mm : 1 ; uint32 em_sel : 3 ; uint32 cmds_en : 1 ; uint32 cmds_wrap_mode : 2 ; uint32 cmds_wrap_len : 4 ; uint32 icache_invalid : 1 ; uint32 dcache_invalid : 1 ; uint32 fpga_halt_release : 1 ; uint32 group_image_offset ; uint32 aes_region_len ; uint32 img_len_cnt ; uint32 hash[8] ; + + local quad off = FTell(); + if(img_len_cnt < FileSize() && img_len_cnt + group_image_offset <= FileSize()) { + FSeek(group_image_offset); + ubyte image[img_len_cnt] ; + } else { + Warning("Segment data appears to either overlap with header, exist after the end of the file or overlap with the end of the file!"); + } + FSeek(off); } HAL_BASIC_CONFIG; typedef struct { -- Gitee