diff --git a/BL808Image.bt b/BL808Image.bt index b72759027a223b1e0c1eebb7c40b5c87462cfee1..97f75c78b35356ad96609016fd9d77baf9498ef9 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 {