2424
2525extern void do_boot (const uint32_t * app_offset );
2626
27+ #define FLASHBUFFER_SIZE 256
2728static int wolfBoot_copy_sector (struct wolfBoot_image * src , struct wolfBoot_image * dst , uint32_t sector )
2829{
2930 volatile uint32_t * orig , * copy ;
@@ -39,21 +40,21 @@ static int wolfBoot_copy_sector(struct wolfBoot_image *src, struct wolfBoot_imag
3940 dst_sector_offset = 0 ;
4041#ifdef EXT_FLASH
4142 if (PART_IS_EXT (src )) {
42- uint32_t word ;
43+ uint8_t buffer [ FLASHBUFFER_SIZE ] ;
4344 wb_flash_erase (dst , dst_sector_offset , WOLFBOOT_SECTOR_SIZE );
4445 while (pos < WOLFBOOT_SECTOR_SIZE ) {
45- ext_flash_read ((uint32_t )(src -> hdr ) + src_sector_offset + pos , (void * )& word , sizeof ( uint32_t ) );
46- wb_flash_write_verify_word (dst , dst_sector_offset + pos , word );
47- pos += sizeof ( uint32_t ) ;
46+ ext_flash_read ((uint32_t )(src -> hdr ) + src_sector_offset + pos , (void * )buffer , FLASHBUFFER_SIZE );
47+ wb_flash_write (dst , dst_sector_offset + pos , buffer , FLASHBUFFER_SIZE );
48+ pos += FLASHBUFFER_SIZE ;
4849 }
4950 return pos ;
5051 }
5152#endif
5253 wb_flash_erase (dst , dst_sector_offset , WOLFBOOT_SECTOR_SIZE );
5354 while (pos < WOLFBOOT_SECTOR_SIZE ) {
5455 orig = (volatile uint32_t * )(src -> hdr + src_sector_offset + pos );
55- wb_flash_write_verify_word (dst , dst_sector_offset + pos , * orig );
56- pos += sizeof ( uint32_t ) ;
56+ wb_flash_write (dst , dst_sector_offset + pos , orig , FLASHBUFFER_SIZE );
57+ pos += FLASHBUFFER_SIZE ;
5758 }
5859 return pos ;
5960}
0 commit comments