Em 25/3/2011 13:27, Olin Lathrop escreveu: > Isaac Marino Bavaresco wrote: >> The boot-loader is not yet finished but I did some tests in the real >> hardware today, and they show that the word-programming works. > I have done bootloaders for dsPIC parts. These have to erase a whole era= se > block at a time. My bootloaders then write whole write blocks within eac= h > erase block. So far that seems to have worked without incident. I don't > see why a bootloader would want to write individual words. > > I think that could wear out the flash faster too. It's possible that eac= h > word write effects the whole write block. If a write block is 32 words i= n > size, then writing each word individually may stress the flash as if the > whole block were written 32 times. I don't know if this is true, but I c= an > certainly see how it could be. > > Again, word writes don't make much sense for a bootloader. This is a different boot-loader, it is for a client's existing board, which I didn't design. It first receives all the firmware, then checks the firmware for errors (CRC) and finally program it to the FLASH memory. The application is wireless-connected with intermittent availability (a few minutes each hour), and the application cannot be stopped for too long. The board has external FLASH, but just a moderate amount, so I couldn't use it to buffer the firmware. Luckily, the client's application uses only a small fraction of the PIC's FLASH, so I decided to use half of the program memory to store the firmware as it is being received. My boot-loader inter-operates with the application. When the application receives packets that are for the boot-loader, it calls a function inside the boot-loader which saves the packet. When the boot-loader receives the last packet and validates the firmware, it doesn't return to the application and do the real programming. I use word-writes to register in an array of words what blocks were already received. The blocks may be received in any order and there is a mechanism to tell the server what blocks are still needed. Best regards, Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .