0
\$\begingroup\$

To write a C code, the priori knowledge about main function, function declaration and definition, variable declaration and initialization is required, similarly to write a bootloader code what all priori knowledge is required.Say that code should toggle an LED when system starts booting.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Its not clear what you are asking. \$\endgroup\$
    – Icy
    Commented Jan 28, 2016 at 11:13
  • \$\begingroup\$ @Icy .. I want to write a bootloader code for a microcontroller.. What all should I know before writing a bootloader code ? \$\endgroup\$ Commented Jan 29, 2016 at 3:02

1 Answer 1

5
\$\begingroup\$

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.
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.