def BuildHeader(args, payload_len, load_addr, rorofile):
    header = bytearray(b'PHCM\x00')
    b = GetSpiClockParameter(args)
    b |= (1 << 2)
    header.append(b)
    b = 0
    header.append(b)
    header.append(GetSpiReadCmdParameter(args))
    header.extend(struct.pack('<I', load_addr))
    header.extend(struct.pack('<I', GetEntryPoint(rorofile)))
    header.append(((payload_len >> 6) & 255))
    header.append(((payload_len >> 14) & 255))
    PadZeroTo(header, 20)
    header.extend(struct.pack('<I', args.payload_offset))
    PadZeroTo(header, 64)
    return header
def BuildHeader(args, payload_len, load_addr, rorofile):
    header = bytearray(b'PHCM\x00')
    b = GetSpiClockParameter(args)
    b |= (1 << 2)
    header.append(b)
    b = 0
    header.append(b)
    header.append(GetSpiReadCmdParameter(args))
    header.extend(struct.pack('<I', load_addr))
    header.extend(struct.pack('<I', GetEntryPoint(rorofile)))
    header.append(((payload_len >> 6) & 255))
    header.append(((payload_len >> 14) & 255))
    PadZeroTo(header, 20)
    header.extend(struct.pack('<I', args.payload_offset))
    PadZeroTo(header, 64)
    return header