@@ -551,6 +551,7 @@ let PartialFlashing = {
551551 // Write a single page of data to micro:bit ROM by writing it to micro:bit RAM and copying to ROM.
552552 // Drawn from https://github.com/microsoft/pxt-microbit/blob/dec5b8ce72d5c2b4b0b20aafefce7474a6f0c7b2/editor/extension.tsx#L385
553553 partialFlashPageAsync : function ( dapwrapper , page , nextPage , i ) {
554+ // TODO: This short-circuits UICR, do we need to update this?
554555 if ( page . targetAddr >= 0x10000000 )
555556 return Promise . resolve ( ) ;
556557
@@ -598,7 +599,7 @@ let PartialFlashing = {
598599 // Flash the micro:bit's ROM with the provided image by only copying over the pages that differ.
599600 // Falls back to a full flash if partial flashing fails.
600601 // Drawn from https://github.com/microsoft/pxt-microbit/blob/dec5b8ce72d5c2b4b0b20aafefce7474a6f0c7b2/editor/extension.tsx#L335
601- partialFlashAsync : async function ( dapwrapper , image , updateProgress ) {
602+ partialFlashAsync : async function ( dapwrapper , flashBytes , hexBuffer , updateProgress ) {
602603 let checksums ;
603604 return this . getFlashChecksumsAsync ( dapwrapper )
604605 . then ( buf => {
@@ -607,15 +608,15 @@ let PartialFlashing = {
607608 return dapwrapper . writeBlockAsync ( this . loadAddr , this . flashPageBIN ) ;
608609 } )
609610 . then ( async ( ) => {
610- let aligned = PartialFlashingUtils . pageAlignBlocks ( image , 0 ) ;
611+ let aligned = PartialFlashingUtils . pageAlignBlocks ( flashBytes , 0 ) ;
611612 const totalPages = aligned . length ;
612613 PartialFlashingUtils . log ( "Total pages: " + totalPages ) ;
613614 aligned = PartialFlashingUtils . onlyChanged ( aligned , checksums ) ;
614615 PartialFlashingUtils . log ( "Changed pages: " + aligned . length ) ;
615616
616617 if ( aligned . length > ( totalPages / 2 ) ) {
617618 try {
618- await this . fullFlashAsync ( dapwrapper , image , updateProgress ) ;
619+ await this . fullFlashAsync ( dapwrapper , hexBuffer , updateProgress ) ;
619620 } catch ( err ) {
620621 PartialFlashingUtils . log ( err ) ;
621622 PartialFlashingUtils . log ( "Full flash failed, attempting partial flash." ) ;
@@ -628,7 +629,7 @@ let PartialFlashing = {
628629 } catch ( err ) {
629630 PartialFlashingUtils . log ( err ) ;
630631 PartialFlashingUtils . log ( "Partial flash failed, attempting full flash." ) ;
631- await this . fullFlashAsync ( dapwrapper , image , updateProgress ) ;
632+ await this . fullFlashAsync ( dapwrapper , hexBuffer , updateProgress ) ;
632633 }
633634 }
634635
@@ -695,7 +696,7 @@ let PartialFlashing = {
695696
696697 // Flash the micro:bit's ROM with the provided image, resetting the micro:bit first.
697698 // Drawn from https://github.com/microsoft/pxt-microbit/blob/dec5b8ce72d5c2b4b0b20aafefce7474a6f0c7b2/editor/extension.tsx#L439
698- flashAsync : async function ( dapwrapper , image , updateProgress ) {
699+ flashAsync : async function ( dapwrapper , flashBytes , hexBuffer , updateProgress ) {
699700 try {
700701 let p = Promise . resolve ( )
701702 . then ( ( ) => {
@@ -727,11 +728,11 @@ let PartialFlashing = {
727728 "event-type" : "info" ,
728729 "message" : "flash-failed" + "/" + "attempting-full-flash"
729730 } } ) ) ;
730- return this . fullFlashAsync ( dapwrapper , image , updateProgress ) ;
731+ return this . fullFlashAsync ( dapwrapper , hexBuffer , updateProgress ) ;
731732 } else {
732733 // Start flashing
733734 PartialFlashingUtils . log ( "Begin Flashing" ) ;
734- return this . partialFlashAsync ( dapwrapper , image , updateProgress ) ;
735+ return this . partialFlashAsync ( dapwrapper , flashBytes , hexBuffer , updateProgress ) ;
735736 }
736737 } )
737738 . finally ( ( ) => {
0 commit comments