# AVR- “Bootloader Main function and Application Main function”

I am just trying to build a custom bootloader for avr. I know that the bootloader functions can be shared with the application program. I am really confused with the main function though. Do bootloader and application program, both have main function? If not, how to write two separate programs with only one main function

Application Program:

    #include <avr/io.h> // application program at 0x0000
#include <string.h>
int main()
{
uart_init();
}


    #include <avr/io.h>
#include <avr/boot.h>
void uart_init();
void (*funcptr)( void ) = 0x0000;
int main(void)
{
uart_init();
//Boot or Goto Application program
}
void uart_init()
{
//UART initialization code;
}


I'd keep them separated.

What you can do is: