code: def _chip_erase_program(self, progress_cb=_stub_progress):
          
          LOG.debug("%i of %i pages have erased data", len(self.page_list) - self.chip_erase_count, len(self.page_list))
          progress_cb(0.0)
          progress = 0
  
          self.flash.init(self.flash.Operation.ERASE)
          self.flash.erase_all()
          self.flash.uninit()
          
          progress += self.flash.get_flash_info().erase_weight
          progress_cb(float(progress) / float(self.chip_erase_weight))
          
          self.flash.init(self.flash.Operation.PROGRAM)
          for page in self.page_list:
              if not page.erased:
                  self.flash.program_page(page.addr, page.data)
                  progress += page.get_program_weight()
                  progress_cb(float(progress) / float(self.chip_erase_weight))
          self.flash.uninit()
          progress_cb(1.0)
          return FlashBuilder.FLASH_CHIP_ERASE
docs: ! @brief Program by first performing an erase all.