I need to make BootLoader for MCF51JM128 microcontroller, pleace help me, or an explanation about the flash programming and your methods.
If you're looking for sample code, I have some that works on the 51JM128 (as well as almost a dozen other MCUs) in the file flash.c of the skeleton.zip archive at the bottom of this page:
There's actually a full bootloader in there as well, that parses S19 files downloaded from a USB virtual com port and saves them to the "other half" of flash, and then resets the MCU to safely have it copied "into place" on the next (or several next, say, if power is lost during the final stager of the upgrade) boot.
Sorry, there is a lot of code in there you won't care about (for other platforms and other functions), and I'm eventually going to switch us to a new build process that breaks up the different platforms into different files, in my spare time. :-) But if it helps to have more sample code, you can start by looking at the flash_erase_pages() and flash_write_words() routines, and then maybe flash_upgrade() and friends (and the copy code in page0 -- startup.c).
The other thing you will want to look into is the Badge Board bootloader, which I believe you can find here:
This bootloader is really cool in that it exposes a mass storage device to the USB and you can just drag/drop in the new S19 file!
Retrieving data ...