Lines Matching +full:write +full:- +full:command

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
129 :param ecst_args: the object representing the command line arguments.
164 :param ecst_args: the object representing the command line arguments.
166 :returns: output file path object, or -1 if fails
173 exit_with_failure("Define input file, using -i flag")
211 :param ecst_args: the object representing the command line arguments.
224 :param ecst_args: the object representing the command line arguments.
229 output_file.write(FW_HDR_ANCHOR.to_bytes(4, "little"))
231 print(f'- HDR - FW Header ANCHOR - Offset '
232 f'{HDR_ANCHOR_OFFSET} - {_hex_print_format(FW_HDR_ANCHOR)}')
240 :param ecst_args: the object representing the command line arguments.
247 output_file.write(FW_HDR_EXT_ANCHOR_ENABLE.to_bytes(2, "little"))
250 output_file.write(FW_HDR_EXT_ANCHOR_DISABLE.to_bytes(2, "little"))
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.
270 :param ecst_args: the object representing the command line arguments.
293 if input_file_size - HEADER_SIZE < paste_fw_offset:
307 Bits 2-0 - SPI MAX Clock
311 :param ecst_args: the object representing the command line arguments.
330 message = f'Invalid SPI Core Clock Ratio (3) - it should be 1 or 2'
336 output_file.write(spi_max_clock_to_write.to_bytes(1, "little"))
340 output_file.write(spi_max_clock_to_write.to_bytes(1, "little"))
344 output_file.write(spi_max_clock_to_write.to_bytes(1, "little"))
348 output_file.write(spi_max_clock_to_write.to_bytes(1, "little"))
352 output_file.write(spi_max_clock_to_write.to_bytes(1, "little"))
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} - '
377 Bits 2-0 - SPI Flash Read Mode
383 :param ecst_args: the object representing the command line arguments.
395 output_file.write(spi_read_mode_to_write.to_bytes(1, "little"))
398 output_file.write(spi_read_mode_to_write.to_bytes(1, "little"))
401 output_file.write(spi_read_mode_to_write.to_bytes(1, "little"))
404 output_file.write(spi_read_mode_to_write.to_bytes(1, "little"))
412 print(f'- HDR - SPI flash Read Mode - Offset '
413 f'{HDR_SPI_READ_MODE_OFFSET} - '
423 :param ecst_args: the object representing the command line arguments.
430 output_file.write(FW_CRC_ENABLE.to_bytes(1, "little"))
433 output_file.write(FW_CRC_DISABLE.to_bytes(1, "little"))
436 print(f'- HDR - FW CRC Enabled - Offset '
437 f'{HDR_ERR_DETECTION_CONF_OFFSET} - '
446 :param ecst_args: the object representing the command line arguments.
492 output_file.write(ecst_args.firmware_load_address.
497 output_file.write(fw_length.to_bytes(4, "little"))
500 print(f'- HDR - FW load start address - Offset '
501 f'{HDR_FW_LOAD_START_ADDR_OFFSET} - '
510 :param ecst_args: the object representing the command line arguments.
526 message = f'-usearmrst not allowed, FW entry point already set using '\
527 f'-fwep !'
551 output_file.write(fw_entry_pt.to_bytes(4, "little"))
556 print(f'- HDR - FW Entry point - Offset '
557 f'{HDR_FW_ENTRY_POINT_OFFSET} - '
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
572 :param ecst_args: the object representing the command line arguments.
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
605 if fw_crc_end > ecst_args.firmware_length - 1:
613 output_file.write(fw_crc_start.to_bytes(4, "little"))
617 output_file.write(fw_crc_end.to_bytes(4, "little"))
621 print(f'- HDR - FW CRC Start - Offset '
622 f'{HDR_FW_ERR_DETECT_START_ADDR_OFFSET} - '
625 print(f'- HDR - FW CRC End - Offset '
626 f'{HDR_FW_ERR_DETECT_END_ADDR_OFFSET} - '
635 :param ecst_args: the object representing the command line arguments.
644 output_file.write(fw_length.to_bytes(4, "little"))
646 print(f'- HDR - FW Length - Offset '
647 f'{HDR_FW_LENGTH_OFFSET} - '
658 :param ecst_args: the object representing the command line arguments.
668 output_file.write(FLASH_SIZE_1_MBYTES.to_bytes(4, "little"))
671 output_file.write(FLASH_SIZE_2_MBYTES.to_bytes(4, "little"))
674 output_file.write(FLASH_SIZE_4_MBYTES.to_bytes(4, "little"))
677 output_file.write(FLASH_SIZE_8_MBYTES.to_bytes(4, "little"))
680 output_file.write(FLASH_SIZE_16_MBYTES.to_bytes(4, "little"))
688 f' please note - for 0.5 MBytes flash, enter \'1\' '
693 print(f'- HDR - Flash size - Offset '
694 f'{HDR_FLASH_SIZE_OFFSET} - '
703 :param ecst_args: the object representing the command line arguments.
709 output_file.write(PAD_BYTE)
717 :param ecst_args: the object representing the command line arguments.
739 output_file.write(crc_to_write)
744 print(f'- HDR - Header CRC - Offset '
745 f'{HDR_FW_HEADER_SIG_OFFSET} - '
753 :param ecst_args: the object representing the command line arguments.
775 output_file.write(crc_to_write)
780 print(f'- HDR - Header CRC - Offset '
781 f'{HDR_FW_IMAGE_SIG_OFFSET} - '
790 :param ecst_args: the object representing the command line arguments.
799 output_file.write(line)
805 bytes_to_pad_num = abs((16 - input_file_size) % 16)
811 output_file.write(PAD_BYTE)
812 i -= 1
821 ecst_args.firmware_length = input_file_size - HEADER_SIZE - \
827 :param ecst_args: the object representing the command line arguments.
848 # otherwise write to the input file
856 output_file.write(line)
858 output_file.write(HDR_PTR_SIGNATURE.to_bytes(4, "little"))
860 output_file.write(ecst_args.pointer.to_bytes(4, "little"))
868 file_to_merge.write(HDR_PTR_SIGNATURE.to_bytes(4, "little"))
870 file_to_merge.write(ecst_args.pointer.to_bytes(4, "little"))
884 :param ecst_args: the object representing the command line arguments.
895 boot_loader_header_file.write(HDR_PTR_SIGNATURE.to_bytes(4, \
898 boot_loader_header_file.write(ecst_args.pointer.to_bytes(4, \
942 final_crc |= current_bit << (NUM_OF_BYTES - 1) - j