Bootloader and Application Prgramming Avr Studio

Hai Guys,
I have an optiboot hex file(basically a bootloader file) and an application program for blinking the LED. How to burn both to the same atmega 328p. Optiboot should go to BLS section and LED should go to application program section. How can i achieve this. My optiboot file size is greater than 512 bytes.

Thanks in advance
Kalari

One way to do this is to merge the hex files manually: open both files in a text editor, remove “:00000001FF” (the end-of-file marker) from the end of the main program hex, and append the contents of the bootloader hex.

(from this thread and this thread on the Arduino forum)

- Kevin

Thanks My friend.
Also i am writing my own custom bootloader for atmega328p. What are the minimum functions needed for set it up and running.

That’s a very broad question, and the answer probably depends on what you want the bootloader to do. If you want to write an Arduino-compatible bootloader, I’d suggest reading through and understanding the source for the official bootloaders (e.g. Optiboot) to see what they do (How does it set up the microcontroller? How does the computer communicate with it, and how is it expected to act or respond?) It might be easier to modify an existing bootloader instead of writing an entirely new one from scratch.

- Kevin

Got it Kevin.

Friend, how can I combine a Custom Bootloader and an arduino sketch program. In other words, to which address location of atmega does arduino sketch programs are flashed. Is it possible for me to point my program counter to point that memory location at the end of Bootloading. Is it possible to combine two hex file, I mean the custom boot-loader and Arduino sketch.

Thanks in advance