I have to design a bootloader for Kinetis E series controller. What are the prerequisites to write a general bootloader code ?
For reference a bootloader on a microprocessor is a small app that is resident on the microprocessor that can be used to download larger 'main' apps into the program memory.

What you need to know in order to implement a bootloader depends very much on the processor you are targeting, but the following list is a start:


Details of processor memory map - in particular are any parts of your memory reserved or protected for use by the bootloader. Will you need to run the bootloader from RAM while the main program memory is erased?
Details of interrupt vectors and how these will be directed / redirected to your user application.
How you will implement a recovery strategy if something goes wrong during download of new main app.
How to erase and write the 'user' parts of your program memory.
How to configure your processor at power up - set input /output directions, crystal dividers, peripheral initialisations and so on
What communication mechanism and protocol (eg serial, USB, Ethernet) you will use to communicate and receive the main application from a remote system
How your processor will (re)enter bootloader mode. After you have downloaded your main app how will you return to the bootloader?
How your bootloader process will synchronise with software on remote system.