def programPhrase(self, flashPtr, bytes):
        """
        Flash a portion of a page.
        """

        # Get min programming length. If one was not specified, use the page size.
        if self.min_program_length:
            min_len = self.min_program_length
        else:
            min_len = self.getPageInfo(flashPtr).size

        # Require write address and length to be aligned to min write size.
        if (flashPtr % min_len) or (len(bytes) % min_len):
            raise RuntimeError("unaligned address or length")

        # prevent security settings from locking the device
        bytes = self.overrideSecurityBits(flashPtr, bytes)

        # first transfer in RAM
        self.target.writeBlockMemoryUnaligned8(self.begin_data, bytes)

        # update core register to execute the program_page subroutine
        result = self.callFunctionAndWait(self.flash_algo['pc_program_page'], flashPtr, len(bytes), self.begin_data)

        # check the return code
        if result != 0:
            logging.error('programPhrase(0x%x) error: %i', flashPtr, result)
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/flash/flash.py/Flash.programPhrase/original