Lines Matching +full:- +full:f

5 # SPDX-License-Identifier: Apache-2.0
10 # -i in_file.bin -o out_file.bin
11 # [-chip <name>] [-v|-vv]
12 # [-nohcrc] [-nofcrc] [-ph <offset>]
13 # [-flashsize <1|2|4|8|16>]
14 # [-spimaxclk <20|25|33|40|50>]
15 # [-spireadmode <normal|fast|dual|quad>]
112 INVALID_INPUT = -1
115 BYTES_TO_PAD = HDR_FW_HEADER_SIG_OFFSET - RESERVED_BYTES_OFFSET
166 :returns: output file path object, or -1 if fails
173 exit_with_failure("Define input file, using -i flag")
178 exit_with_failure(f'Cannot open {input_file}')
180 exit_with_failure(f'BIN Input file ({input_file}) is empty')
191 exit_with_failure(f'Input file name {input_file} '
192 f'should be differed from'
193 f' Output file name {output}')
199 print(Fore.LIGHTCYAN_EX + f'\nBIN file: {input_file}, size:'
200 f' {input_file_size} bytes')
201 print(f'Output file name: {output_file.name} \n')
215 message = f'Invalid chip name, '
231 print(f'- HDR - FW Header ANCHOR - Offset '
232 f'{HDR_ANCHOR_OFFSET} - {_hex_print_format(FW_HDR_ANCHOR)}')
254 print(f'- HDR - Header EXTENDED ANCHOR - Offset'
255 f' {HDR_EXTENDED_ANCHOR_OFFSET} - {anchor_to_print}')
263 firmware header offset is a non-negative integer.
284 message = f'Paste firmware address ({paste_fw_offset_to_print}) ' \
285 f'is not 16 bytes aligned'
289 message = f' input file size ({input_file_size} bytes) ' \
290 f'should be bigger than fw header size ({HEADER_SIZE} bytes)'
293 if input_file_size - HEADER_SIZE < paste_fw_offset:
294 message = f'FW offset ({paste_fw_offset_to_print})should be less ' \
295 f'than input file size ({input_file_size}) minus fw header size' \
296 f' {HEADER_SIZE}'
307 Bits 2-0 - SPI MAX Clock
326 message = f'Cannot read SPI Clock Ratio'
330 message = f'Invalid SPI Core Clock Ratio (3) - it should be 1 or 2'
359 message = f'Invalid SPI Flash MAX Clock size ({spi_max_clock}) '
360 message += '- it should be 20, 25, 33, 40 or 50 MHz'
365 print(f'- HDR - SPI flash MAX Clock - Offset '
366 f'{HDR_SPI_MAX_CLK_OFFSET} - '
367 f'{_hex_print_format(spi_max_clock_to_write)}')
377 Bits 2-0 - SPI Flash Read Mode
406 message = f'Invalid SPI Flash Read Mode ({spi_flash_read_mode}),'
412 print(f'- HDR - SPI flash Read Mode - Offset '
413 f'{HDR_SPI_READ_MODE_OFFSET} - '
414 f'{_hex_print_format(spi_read_mode_to_write)}')
436 print(f'- HDR - FW CRC Enabled - Offset '
437 f'{HDR_ERR_DETECTION_CONF_OFFSET} - '
438 f'{err_detect_config_to_print}')
461 message = f'Cannot read firmware length'
465 message = f'Firmware length ({fw_length_to_print}) ' \
466 f'is not 16 bytes aligned'
470 message = f'Cannot read FW Load start address'
474 message = f'Firmware load address ({fw_load_addr_to_print}) ' \
475 f'is not 16 bytes aligned'
479 message = f'Firmware load address ({fw_load_addr_to_print}) ' \
480 f'should be between start ({start_ram_to_print}) '\
481 f'and end ({end_ram_to_print}) of RAM'
485 message = f'Firmware end address ({fw_end_addr_to_print}) should be '
486 message += f'less than end of RAM address ({end_ram_to_print})'
500 print(f'- HDR - FW load start address - Offset '
501 f'{HDR_FW_LOAD_START_ADDR_OFFSET} - '
502 f'{fw_load_addr_to_print}')
526 message = f'-usearmrst not allowed, FW entry point already set using '\
527 f'-fwep !'
541 message = f'Firmware entry point ' \
542 f'({_hex_print_format(fw_entry_pt)}) ' \
543 f'should be between the FW load address ' \
544 f'({_hex_print_format(fw_load_addr)})' \
545 f' and FW end address ({_hex_print_format(fw_end_addr)})'
556 print(f'- HDR - FW Entry point - Offset '
557 f'{HDR_FW_ENTRY_POINT_OFFSET} - '
558 f'{_hex_print_format(fw_entry_pt)}')
563 --crc start address should be 4 byte aligned, bigger than crc end address
564 --crc size should be 4 byte aligned, and be set to firmware length minus
566 --crc end address is crc start address + crc size bytes
578 fw_crc_end = ecst_args.firmware_length - 1
580 fw_crc_size = ecst_args.firmware_length - fw_crc_start
583 fw_crc_end = fw_crc_start + fw_crc_size - 1
591 message = f'Firmware crc offset address ' \
592 f'({fw_crc_start_to_print}) is not 4 bytes aligned'
596 message = f'CRC start address ({fw_crc_start_to_print}) should' \
597 f' be less or equal to CRC end address ({fw_crc_end_to_print}) \n'
601 message = f'Firmware crc size ({fw_crc_size_to_print}) ' \
602 f'is not 4 bytes aligned'
605 if fw_crc_end > ecst_args.firmware_length - 1:
606 message = f'CRC end address ({fw_crc_end_to_print}) should be less' \
607 f' than the FW length ({fw_length_to_print}) \n'
621 print(f'- HDR - FW CRC Start - Offset '
622 f'{HDR_FW_ERR_DETECT_START_ADDR_OFFSET} - '
623 f'{fw_crc_start_to_print}')
625 print(f'- HDR - FW CRC End - Offset '
626 f'{HDR_FW_ERR_DETECT_END_ADDR_OFFSET} - '
627 f'{fw_crc_end_to_print}')
646 print(f'- HDR - FW Length - Offset '
647 f'{HDR_FW_LENGTH_OFFSET} - '
648 f'{fw_length_to_print}')
686 message = f'Invalid flash size ({flash_size} MBytes), ' \
687 f' it should be 0.5, 1, 2, 4, 8, 16 MBytes \n' \
688 f' please note - for 0.5 MBytes flash, enter \'1\' '
693 print(f'- HDR - Flash size - Offset '
694 f'{HDR_FLASH_SIZE_OFFSET} - '
695 f' {flash_size_to_print}')
744 print(f'- HDR - Header CRC - Offset '
745 f'{HDR_FW_HEADER_SIG_OFFSET} - '
746 f' {crc_to_print}')
780 print(f'- HDR - Header CRC - Offset '
781 f'{HDR_FW_IMAGE_SIG_OFFSET} - '
782 f' {crc_to_print}')
805 bytes_to_pad_num = abs((16 - input_file_size) % 16)
812 i -= 1
821 ecst_args.firmware_length = input_file_size - HEADER_SIZE - \
838 exit_with_failure(f'Cannot open {ecst_args.input}')
842 message = f'Bootloader header offset ({bh_index} bytes) should be '
843 message += f'less than file size ' \
844 f'({input_file.stat().st_size } bytes)'
874 print(Fore.LIGHTCYAN_EX + f'BootLoader Header file:'
875 f' {file_name_to_print}')
876 print(f'Offset: {_hex_print_format(ecst_args.bh_offset)},'
877 f' Signature: {_hex_print_format(HDR_PTR_SIGNATURE)},'
878 f' Pointer: {_hex_print_format(ecst_args.pointer)}')
902 print(Fore.LIGHTCYAN_EX + f'BootLoader Header file:'
903 f' {output_file.name}')
904 print(f'Signature: {_hex_print_format(HDR_PTR_SIGNATURE)}, '
905 f'Pointer: {_hex_print_format(ecst_args.pointer)}')
942 final_crc |= current_bit << (NUM_OF_BYTES - 1) - j
996 message = f'unKnown flag: {err_arg}'