32
32
CHECKSUM_FMT = "<1I"
33
33
CHECKSUM_OFFSET = 0x1C
34
34
TARGET_INFO_OFFSET = 13 * 4
35
- ALLIGN_PADS = 4
35
+ ALIGN_PADS = 4
36
36
37
37
def ranges (i ):
38
38
for _ , b in itertools .groupby (enumerate (i ), lambda x_y : x_y [1 ] - x_y [0 ]):
@@ -115,13 +115,13 @@ def post_build_script(input_file, output_file, board_id=None, family_id=None, bi
115
115
blob_header = (0xE00ABE00 , 0x062D780D , 0x24084068 , 0xD3000040 , 0x1E644058 , 0x1C49D1FA , 0x2A001E52 , 0x4770D1F2 )
116
116
stack_size = 0x200
117
117
region_info_fmt = '5I'
118
- region_info_total = 10
118
+ region_info_total = 10
119
119
target_cfg_fmt = '3I' + region_info_fmt * region_info_total * 2 + 'IHBB'
120
120
sector_info_fmt = '2I'
121
121
sector_info_len = len (pack_flash_algo .sector_sizes )
122
122
program_target_fmt = '14I'
123
123
flash_blob_entry = int (flash_blob_entry , 16 )
124
- blob_pad_size = ((len (pack_flash_algo .algo_data ) + ALLIGN_PADS - 1 ) // ALLIGN_PADS * ALLIGN_PADS ) - len (pack_flash_algo .algo_data )
124
+ blob_pad_size = ((len (pack_flash_algo .algo_data ) + ALIGN_PADS - 1 ) // ALIGN_PADS * ALIGN_PADS ) - len (pack_flash_algo .algo_data )
125
125
blob_header_size = len (blob_header ) * 4
126
126
total_struct_size = blob_header_size + len (pack_flash_algo .algo_data ) + blob_pad_size + sector_info_len * struct .calcsize (sector_info_fmt ) + struct .calcsize (program_target_fmt ) + struct .calcsize (target_cfg_fmt )
127
127
flash_blob_addr = end + 1 - 4 - total_struct_size #make room for crc
@@ -141,10 +141,10 @@ def post_build_script(input_file, output_file, board_id=None, family_id=None, bi
141
141
new_hex_file .puts (program_target_addr ,struct .pack ('<' + program_target_fmt ,
142
142
pack_flash_algo .symbols ['Init' ] + blob_header_size + flash_blob_entry ,
143
143
pack_flash_algo .symbols ['UnInit' ] + blob_header_size + flash_blob_entry ,
144
- pack_flash_algo .symbols ['EraseChip' ] + blob_header_size + flash_blob_entry if pack_flash_algo .symbols ['EraseChip' ] != 0xffffffffL else 0 ,
144
+ pack_flash_algo .symbols ['EraseChip' ] + blob_header_size + flash_blob_entry if pack_flash_algo .symbols ['EraseChip' ] != 0xffffffff else 0 ,
145
145
pack_flash_algo .symbols ['EraseSector' ] + blob_header_size + flash_blob_entry ,
146
146
pack_flash_algo .symbols ['ProgramPage' ] + blob_header_size + flash_blob_entry ,
147
- pack_flash_algo .symbols ['Verify' ] + blob_header_size + flash_blob_entry if pack_flash_algo .symbols ['Verify' ] != 0xffffffffL else 0 ,
147
+ pack_flash_algo .symbols ['Verify' ] + blob_header_size + flash_blob_entry if pack_flash_algo .symbols ['Verify' ] != 0xffffffff else 0 ,
148
148
flash_blob_entry + 1 , #BKPT : start of blob + 1
149
149
flash_blob_entry + blob_header_size + pack_flash_algo .rw_start , #RSB : blob start + header + rw data offset
150
150
stack_pointer , #RSP : stack pointer
@@ -170,7 +170,7 @@ def post_build_script(input_file, output_file, board_id=None, family_id=None, bi
170
170
sector_info_len , #Sector start and length list total
171
171
* regions_flags
172
172
))
173
- board_info_flag = 1 if pack_flash_algo .symbols ['EraseSector' ] != 0xffffffffL else 0 #kEnablePageErase
173
+ board_info_flag = 1 if pack_flash_algo .symbols ['EraseSector' ] != 0xffffffff else 0 #kEnablePageErase
174
174
new_hex_file .puts (target_addr_unpack + 12 ,struct .pack ('<1I' , board_info_flag )) #always enable page erase EraseSector is a required symbol in flash algo
175
175
new_hex_file .puts (target_addr_unpack + 16 ,struct .pack ('<1I' , target_cfg_addr ))
176
176
0 commit comments