def parseargs():
    rpath = os.path.dirname(os.path.relpath(__file__))
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', '--input', help='EC binary to pack, usually ec.bin or ec.RO.flat.', metavar='EC_BIN', default='ec.bin')
    parser.add_argument('-o', '--output', help='Output flash binary file', metavar='EC_SPI_FLASH', default='ec.packed.bin')
    parser.add_argument('--loader_file', help='EC loader binary', default='ecloader.bin')
    parser.add_argument('-s', '--spi_size', type=int, help='Size of the SPI flash in KB', default=512)
    parser.add_argument('-l', '--header_loc', type=int, help='Location of header in SPI flash', default=4096)
    parser.add_argument('-p', '--payload_offset', type=int, help='The offset of payload from the start of header', default=128)
    parser.add_argument('-r', '--rw_loc', type=int, help='Start offset of EC_RW. Default is -1 meaning 1/2 flash size', default=(- 1))
    parser.add_argument('--spi_clock', type=int, help='SPI clock speed. 8, 12, 24, or 48 MHz.', default=24)
    parser.add_argument('--spi_read_cmd', type=int, help='SPI read command. 0x3, 0xB, or 0x3B.', default=11)
    parser.add_argument('--image_size', type=int, help='Size of a single image. Default 220KB', default=(220 * 1024))
    parser.add_argument('--test_spi', action='store_true', help='Test SPI data integrity by adding CRC32 in last 4-bytes of RO/RW binaries', default=False)
    parser.add_argument('--test_ecrw', action='store_true', help='Use fixed pattern for EC_RW but preserve image_data', default=False)
    parser.add_argument('--verbose', action='store_true', help='Enable verbose output', default=False)
    return parser.parse_args()
def parseargs():
    rpath = os.path.dirname(os.path.relpath(__file__))
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', '--input', help='EC binary to pack, usually ec.bin or ec.RO.flat.', metavar='EC_BIN', default='ec.bin')
    parser.add_argument('-o', '--output', help='Output flash binary file', metavar='EC_SPI_FLASH', default='ec.packed.bin')
    parser.add_argument('--loader_file', help='EC loader binary', default='ecloader.bin')
    parser.add_argument('-s', '--spi_size', type=int, help='Size of the SPI flash in KB', default=512)
    parser.add_argument('-l', '--header_loc', type=int, help='Location of header in SPI flash', default=4096)
    parser.add_argument('-p', '--payload_offset', type=int, help='The offset of payload from the start of header', default=128)
    parser.add_argument('-r', '--rw_loc', type=int, help='Start offset of EC_RW. Default is -1 meaning 1/2 flash size', default=(- 1))
    parser.add_argument('--spi_clock', type=int, help='SPI clock speed. 8, 12, 24, or 48 MHz.', default=24)
    parser.add_argument('--spi_read_cmd', type=int, help='SPI read command. 0x3, 0xB, or 0x3B.', default=11)
    parser.add_argument('--image_size', type=int, help='Size of a single image. Default 220KB', default=(220 * 1024))
    parser.add_argument('--test_spi', action='store_true', help='Test SPI data integrity by adding CRC32 in last 4-bytes of RO/RW binaries', default=False)
    parser.add_argument('--test_ecrw', action='store_true', help='Use fixed pattern for EC_RW but preserve image_data', default=False)
    parser.add_argument('--verbose', action='store_true', help='Enable verbose output', default=False)
    return parser.parse_args()