Em 25/3/2011 18:08, Olin Lathrop escreveu: > Isaac Marino Bavaresco wrote: >> If I don't register somewhere each block as it is received, the only >> way >> to tell if a block was already received would be to scan it from begin >> to end to find a value different to 0xff. >> Besides being too time-consuming, if a block full of 0xff is received >> it >> will always be detected as not received. > OK, so you use a single erase block somewhere with individual bits > corresponding to uploaded blocks. Not bits, one word per block, because I can program a minimum of one word at a time. It is a little wasteful but that doesn't matter at all because there is plenty of unused FLASH. The device has 128k instructions plus 3k spare for the boot-loader. The area from 0 to 63k-1 instructions is reserved for the application. >From 63k to 64k-1 is reserved for the copy of the application's saved reset vector (goto instruction to the start of the application), which is replaced in row 0 by the reset vector of the boot-loader. This area is mostly empty. >From 64k to 127k-1 is reserved for the new firmware being downloaded. It is an exact copy of the final firmware, shifted up 64k instructions. >From 127k to 128k-1 is reserved for register the received blocks and other control information (number of blocks expected, CRC of the whole new firmware, version of the new firmware, etc.) The boot-loader is located from 128k to the end of the memory. > These bits start out as 1 and you flip > them to 0 when the corresponding block is received. In any case, you sho= uld > checksum the whole uploaded image before attempting to write it to the ap= p > area. > > However, what does this have to do with the bootloader doing word versus > page writes? The word programming is to mark each entry of the received-block list. Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .