Lines Matching refs:ecst_args
19 from ecst_args import EcstArgs, exit_with_failure
126 def _bt_mode_handler(ecst_args): argument
132 output_file = _set_input_and_output(ecst_args)
133 _check_chip(output_file, ecst_args)
135 if ecst_args.paste_firmware_header != 0:
136 _check_firmware_header_offset(output_file, ecst_args)
138 _copy_image(output_file, ecst_args)
139 _set_anchor(output_file, ecst_args)
140 _set_extended_anchor(output_file, ecst_args)
141 _set_spi_flash_maximum_clock(output_file, ecst_args)
142 _set_spi_flash_mode(output_file, ecst_args)
143 _set_error_detection_configuration(output_file, ecst_args)
144 _set_firmware_load_start_address(output_file, ecst_args)
145 _set_firmware_entry_point(output_file, ecst_args)
146 _set_firmware_crc_start_and_size(output_file, ecst_args)
147 _set_firmware_length(output_file, ecst_args)
148 _set_flash_size(output_file, ecst_args)
149 _set_reserved_bytes(output_file, ecst_args)
150 _set_firmware_header_crc_signature(output_file, ecst_args)
151 _set_firmware_image_crc_signature(output_file, ecst_args)
155 def _set_input_and_output(ecst_args): argument
168 input_file = ecst_args.input
169 output = ecst_args.output
198 if ecst_args.verbose == REG_VERBOSE:
205 def _check_chip(output, ecst_args): argument
214 if ecst_args.chip_name == INVALID_INPUT:
220 def _set_anchor(output, ecst_args): argument
228 output_file.seek(HDR_ANCHOR_OFFSET + ecst_args.paste_firmware_header)
230 if ecst_args.verbose == REG_VERBOSE:
236 def _set_extended_anchor(output, ecst_args): argument
245 ecst_args.paste_firmware_header)
246 if ecst_args.firmware_header_crc is FW_HDR_CRC_ENABLE:
253 if ecst_args.verbose == REG_VERBOSE:
259 def _check_firmware_header_offset(output, ecst_args): argument
273 input_file = Path(ecst_args.input)
274 paste_fw_offset = ecst_args.paste_firmware_header
299 def _set_spi_flash_maximum_clock(output, ecst_args): argument
317 ecst_args.paste_firmware_header)
318 spi_max_clock = ecst_args.spi_flash_maximum_clock
319 spi_clock_ratio = ecst_args.spi_flash_clock_ratio
364 if ecst_args.verbose == REG_VERBOSE:
370 def _set_spi_flash_mode(output, ecst_args): argument
386 spi_flash_read_mode = ecst_args.spi_flash_read_mode
387 spi_unlimited_burst_mode = ecst_args.unlimited_burst_mode
392 ecst_args.paste_firmware_header)
411 if ecst_args.verbose == REG_VERBOSE:
418 def _set_error_detection_configuration(output, ecst_args): argument
427 ecst_args.paste_firmware_header)
428 if ecst_args.firmware_crc == FW_CRC_ENABLE:
435 if ecst_args.verbose == REG_VERBOSE:
442 def _set_firmware_load_start_address(output, ecst_args): argument
448 start_ram = ecst_args.chip_ram_address
449 end_ram = start_ram + ecst_args.chip_ram_size
450 fw_load_addr = ecst_args.firmware_load_address
451 fw_length = ecst_args.firmware_length
491 ecst_args.paste_firmware_header)
492 output_file.write(ecst_args.firmware_load_address.
496 ecst_args.paste_firmware_header)
499 if ecst_args.verbose == REG_VERBOSE:
505 def _set_firmware_entry_point(output, ecst_args): argument
513 input_file_path = Path(ecst_args.input)
514 fw_entry_pt = ecst_args.firmware_entry_point
515 fw_use_arm_reset = ecst_args.use_arm_reset
516 fw_length = ecst_args.firmware_length
517 fw_load_addr = ecst_args.firmware_load_address
523 fw_entry_pt = ecst_args.firmware_load_address
534 ecst_args.paste_firmware_header)
550 ecst_args.paste_firmware_header)
555 if ecst_args.verbose == REG_VERBOSE:
560 def _set_firmware_crc_start_and_size(output, ecst_args): argument
574 fw_crc_size = ecst_args.firmware_crc_size
575 fw_crc_start = ecst_args.firmware_crc_start
578 fw_crc_end = ecst_args.firmware_length - 1
580 fw_crc_size = ecst_args.firmware_length - fw_crc_start
581 ecst_args.firmware_crc_size = fw_crc_size
587 fw_length_to_print = _hex_print_format(ecst_args.firmware_length)
605 if fw_crc_end > ecst_args.firmware_length - 1:
612 ecst_args.paste_firmware_header)
616 ecst_args.paste_firmware_header)
620 if ecst_args.verbose == REG_VERBOSE:
629 def _set_firmware_length(output, ecst_args): argument
638 fw_length = ecst_args.firmware_length
643 ecst_args.paste_firmware_header)
645 if ecst_args.verbose == REG_VERBOSE:
651 def _set_flash_size(output, ecst_args): argument
664 ecst_args.paste_firmware_header)
665 flash_size = ecst_args.flash_size
692 if ecst_args.verbose == REG_VERBOSE:
698 def _set_reserved_bytes(output, ecst_args): argument
708 ecst_args.paste_firmware_header + i)
712 def _set_firmware_header_crc_signature(output, ecst_args): argument
722 if ecst_args.firmware_header_crc != FW_HDR_CRC_DISABLE:
729 output_file.seek(ecst_args.paste_firmware_header + i)
737 output_file.seek(ecst_args.paste_firmware_header +
743 if ecst_args.verbose == REG_VERBOSE:
748 def _set_firmware_image_crc_signature(output, ecst_args): argument
757 if ecst_args.firmware_crc != FW_CRC_DISABLE:
763 output_file.seek(FW_IMAGE_OFFSET + ecst_args.paste_firmware_header +
764 ecst_args.firmware_crc_start)
765 for _ in range(ecst_args.firmware_crc_size):
774 ecst_args.paste_firmware_header)
779 if ecst_args.verbose == REG_VERBOSE:
784 def _copy_image(output, ecst_args): argument
792 with open(ecst_args.input, "rb") as firmware_image:
794 if ecst_args.paste_firmware_header == 0:
804 input_file_size = Path(ecst_args.input).stat().st_size
816 fw_length = ecst_args.firmware_length
818 if ecst_args.paste_firmware_header == 0:
819 ecst_args.firmware_length = input_file_size + bytes_to_pad_num
821 ecst_args.firmware_length = input_file_size - HEADER_SIZE - \
822 ecst_args.paste_firmware_header
824 def _merge_file_with_bt_header(ecst_args): argument
829 bh_index = ecst_args.bh_offset
832 if not ecst_args.input:
836 input_file = Path(ecst_args.input)
849 if ecst_args.output is not None:
850 output_file = Path(ecst_args.output)
860 output_file.write(ecst_args.pointer.to_bytes(4, "little"))
870 file_to_merge.write(ecst_args.pointer.to_bytes(4, "little"))
873 if ecst_args.verbose == REG_VERBOSE:
880 def _create_bt_header(ecst_args): argument
886 if not ecst_args.output:
890 output_file = Path(ecst_args.output)
898 boot_loader_header_file.write(ecst_args.pointer.to_bytes(4, \
901 if ecst_args.verbose == REG_VERBOSE: