#NEWLINE# def _page_erase_program( self , progress_cb = _stub_progress ) : #NEWLINE# #INDENT# '\n        Program by performing sector erases.\n        ' #NEWLINE# actual_page_erase_count = 0 #NEWLINE# actual_page_erase_weight = 0 #NEWLINE# progress = 0 #NEWLINE# progress_cb ( 0.0 ) #NEWLINE# for page in actual_page_erase_weight . page_list : #NEWLINE# #INDENT# if ( page . same is False ) : #NEWLINE# #INDENT# progress += page . getEraseProgramWeight ( ) #NEWLINE# #UNINDENT# if ( page . same is None ) : #NEWLINE# #INDENT# data = self . flash . target . readBlockMemoryUnaligned8 ( page . addr , len ( page . data ) ) #NEWLINE# page . same = _same ( page . data , data ) #NEWLINE# progress += page . getVerifyWeight ( ) #NEWLINE# #UNINDENT# if ( page . same is False ) : #NEWLINE# #INDENT# self . flash . erasePage ( page . addr ) #NEWLINE# self . flash . programPage ( page . addr , page . data ) #NEWLINE# actual_page_erase_count += 1 #NEWLINE# actual_page_erase_weight += page . getEraseProgramWeight ( ) #NEWLINE# #UNINDENT# if ( self . page_erase_weight > 0 ) : #NEWLINE# #INDENT# progress_cb ( ( float ( progress ) / float ( self . page_erase_weight ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# progress_cb ( 1.0 ) #NEWLINE# logging . debug ( 'Estimated page erase count: %i' , self . page_erase_count ) #NEWLINE# logging . debug ( 'Actual page erase count: %i' , actual_page_erase_count ) #NEWLINE# return FlashBuilder . FLASH_PAGE_ERASE