PDA

View Full Version : Load partialy the code in the microcontroller - something like partial bootloader



boban
- 17th October 2012, 09:20
Hello,
this is maybe question for someone who knows how PBP is working, but do think, that is could be possible to update the code via e.g. serial port? But I don't want to use the bootloader, I want to update only the specific part of the code memory. E.g.

'Existing code
:rx
HSERIN data
gosub manageData
goto rx
end

:manageData
'do something
RETURN

I want to replace only the function manageData. The manage data function will not be used during the update of the code. Do you think, that this would be possible? Does anyone have idea how to do it? ( E.g. how to know, at which address the manageData starts? )

Archangel
- 17th October 2012, 11:17
You could put into eeprom the volatile data and change that

Charles Linquis
- 5th November 2012, 17:26
Although what you want is possible, I can't think of why you would want to do such a thing.


If you have the original source, then you can find out where the routines are by looking at the ASM file.

And the resuting .HEX file also contains the information (in the first few bytes of each line) of where the data will be written. But you can't just write to FLASH indiscriminately. You have to erase it first, and you can only erase and write whole 'blocks' at a time (your device datasheet will give you the size of the erase and write blocks). And of course, you have to start on a block boundary. There is virtually no chance that your routine will #1. Be contiguous, #2. Fit in one block, #3. Begin and end on a block boundary.

This sounds like way too much trouble. Is there some reason why you can't simply write the whole chip? A good bootloader can write a 'big' chip (128KB of FLASH) in less than 2 minutes.