def addData(self, addr, data):
        # Sanity check
        if addr < self.flash_start:
            raise Exception("Invalid flash address 0x%x is before flash start 0x%x" % (addr, self.flash_start))

        # Add operation to list
        self.flash_operation_list.append(flash_operation(addr, data))

        # Keep list sorted
        self.flash_operation_list = sorted(self.flash_operation_list, key=lambda operation: operation.addr)
        # Verify this does not overlap
        prev_flash_operation = None
        for operation in self.flash_operation_list:
            if prev_flash_operation != None:
                if prev_flash_operation.addr + len(prev_flash_operation.data) > operation.addr:
                    raise ValueError("Error adding data - Data at 0x%x..0x%x overlaps with 0x%x..0x%x"
                            % (prev_flash_operation.addr, prev_flash_operation.addr + len(prev_flash_operation.data),
                               operation.addr, operation.addr + len(operation.data)))
            prev_flash_operation = operation
Return a writable file-like object for this protocol.
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/flash/flash_builder.py/FlashBuilder.addData--crossover with--dataset/ETHPy150Open natestedman/Observatory/observatory/lib/dulwich/protocol.py/Protocol.write_file