Example #1
0
def get_test_data(n1, offset, n2):
    """Create test data on given pattern.
    @param  n1:     size of first part of array at base address 0.
    @param  offset: offset for second part of array.
    @param  n2:     size of second part of array at given offset.
    @return:        (overall size, hex file, IntelHex object)
    """
    # make IntelHex object
    ih = intelhex.IntelHex()
    addr = 0
    for i in range_g(n1):
        ih[addr] = addr % 256
        addr += 1
    addr += offset
    for i in range_g(n2):
        ih[addr] = addr % 256
        addr += 1
    # make hex file
    sio = StringIO()
    ih.write_hex_file(sio)
    hexstr = sio.getvalue()
    sio.close()
    #
    return n1+n2, hexstr, ih
Example #2
0
def get_test_data(n1, offset, n2):
    """Create test data on given pattern.
    @param  n1:     size of first part of array at base address 0.
    @param  offset: offset for second part of array.
    @param  n2:     size of second part of array at given offset.
    @return:        (overall size, hex file, IntelHex object)
    """
    # make IntelHex object
    ih = intelhex.IntelHex()
    addr = 0
    for i in range_g(n1):
        ih[addr] = addr % 256
        addr += 1
    addr += offset
    for i in range_g(n2):
        ih[addr] = addr % 256
        addr += 1
    # make hex file
    sio = StringIO()
    ih.write_hex_file(sio)
    hexstr = sio.getvalue()
    sio.close()
    #
    return n1+n2, hexstr, ih
Example #3
0
 def prepare_lines(ih):
     sio = StringIO()
     ih.dump(sio)
     dump = sio.getvalue()
     lines = dump.splitlines()
     return lines
Example #4
0
 def prepare_lines(ih):
     sio = StringIO()
     ih.dump(sio)
     dump = sio.getvalue()
     lines = dump.splitlines()
     return lines