def _page_erase_program(self, progress_cb=_stub_progress):
        actual_page_erase_count = 0
        actual_page_erase_weight = 0
        progress = 0

        progress_cb(0.0)

        for page in self.page_list:

            # If the page is not the same
            if page.same is False:
                progress += page.getEraseProgramWeight()

            # Read page data if unknown - after this page.same will be True or False
            if page.same is None:
                data = self.flash.target.readBlockMemoryUnaligned8(page.addr, len(page.data))
                page.same = _same(page.data, data)
                progress += page.getVerifyWeight()

            # Program page if not the same
            if page.same is False:
                self.flash.erasePage(page.addr)
                self.flash.programPage(page.addr, page.data)
                actual_page_erase_count += 1
                actual_page_erase_weight += page.getEraseProgramWeight()

            # Update progress
            if self.page_erase_weight > 0:
                progress_cb(float(progress) / float(self.page_erase_weight))

        progress_cb(1.0)

        logging.debug("Estimated page erase count: %i", self.page_erase_count)
        logging.debug("Actual page erase count: %i", actual_page_erase_count)

        return FlashBuilder.FLASH_PAGE_ERASE
Program by performing sector erases.
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/flash/flash_builder.py/FlashBuilder._page_erase_program