Need the source code of the bootloader

I have searche multiple websites for the .ino source code of the Arduino's bootloader. I found .hex and .c code but didn't find .ino source code. Can someone please refer a link or post the code? (Arduino UNO's bootloader)

..Arnav

there is no .ino. the bootloader is not an Arduino sketch.

Juraj:
there is no .ino. the bootloader is not and Arduino sketch.

So has anyone decompiled the hex file and made a .ino out of it? (For the purpose of better understanding)

If not, then please refer a link, which has the bootloader in easiest type of language to understand (not the assembly language)

The source code for Optiboot is readily available.

It cant be rendered as a .ino - its straight c code. The .c and .h files are the source code. It is included with the ide, (install location)/hardware/arduino/avr/bootloaders/optiboot

It is, ah, not the easiest program to understand - lots of optimizations are done to keep the size of the source code down, and being straight c, it's tough to understand if you are used to reading "easy mode" arduino sketches.

A .ino (which is also c) does things that are not appropriate or applicable to a bootloader

There would be no need to "decompile" the .hex. The source code for the Uno's optiboot bootloader is included with the Arduino IDE and the Arduino AVR Boards platform, but you should be aware that there has been quite a bit of development on optiboot since the version used by Arduino. So if you want to look at the source code, you'd do well to use the latest version, which is available here:

This is written in C, which is supported by the Arduino IDE, so you would be far better off just adding the readily available C source code to an Arduino sketch. I think that would be pretty cool, and did some work toward that goal a few years ago, but never finished it. I remember I ran into some difficulties, but I'd need to look through my notes to refresh my memory on exactly what it was.

But really, there is no need to make it into a sketch. Anyone operating at the level of modifying bootloaders will be able to do that without the Arduino IDE without much difficulty.

Did you look in the files in your Arduino folders? It's right there.

CrossRoads:
Did you look in the files in your Arduino folders? It's right there.

I know that it is there. But I was looking for a ".ino" version of it. So everyone spotted that there is no .ino file for that and it is in C.

........Arnav

Checkout the wiki of optiboot in GitHub for better understanding the working of optiboot, though it tells a little of it , could be helpful

ArnavPawarAA:
I know that it is there. But I was looking for a ".ino" version of it. So everyone spotted that there is no .ino file for that and it is in C.

........Arnav

You could probably get it into an ino style, but would need to extensively alter the additional code that the IDE adds to the ino file when compiling, and the end product would need to result in the C code that is already available.

Your previous question about decompiling the hex file makes little sense, since the code that generated the hex file is freely available, and anyone with the skills to successfully reverse engineer the code from a hex file should be capable of learning enough C language to understand the source code.

Bootloaders also can be fairly cryptic at times, using techniques that may be considered bad programming in another context because of the need to have a very small and highly efficient code. I particularly liked the bootstrap loader for the PDP-11 minicomputer, which had to be keyed in by hand every time, and used a self-modifying program where the code being read in overwrote part of the bootloader itself.

Ok, I have learnt the original assembly C language for the Arduino Studio, so now I will tweak and optimise the bootloader by my requirements and I am good to go. Thank You all people. : )

.. Arnav

to understand the working, you should have extensive knowledge of the vendor datasheet and about the spm in avr. Also about the communication interfaces

m_k_akash:
to understand the working, you should have extensive knowledge of the vendor datasheet and about the spm in avr. Also about the communication interfaces

Yes, Thank You. : )

What exactly are you wanting to change in the bootloader? There are numerous options that can be configured already.

Posts like this go by a couple of times a year... where the person seems to be asking super basic questions relating to some advanced area.... then he gets an answer, thanks people, and scurries off. You always wonder!

Was he way more knowledgable than you gave him credit for, and just not a native english speaker?

Was he trying to save face?

Was this his homework for the "insufferable toddler" (ie, the endlessly asking "why?" type thing) class he's taking to better understand his small child?

Or maybe what they wanted to change was dead simple once they knew where the source was and how to build it? (ex "the LED is on a different pin", or (slightly) less complicated "if this pin is driven low, don't start the app" kind of things)

DrAzzy:
Posts like this go by a couple of times a year... where the person seems to be asking super basic questions relating to some advanced area.... then he gets an answer, thanks people, and scurries off. You always wonder!

Was he way more knowledgable than you gave him credit for, and just not a native english speaker?

Was he trying to save face?

Was this his homework for the "insufferable toddler" (ie, the endlessly asking "why?" type thing) class he's taking to better understand his small child?

Or maybe what they wanted to change was dead simple once they knew where the source was and how to build it? (ex "the LED is on a different pin", or (slightly) less complicated "if this pin is driven low, don't start the app" kind of things)

@DrAzzy please refer to what are you trying to say. Are you insulting me, or hate such threads?

..Arnav

If you hate such threads, then you will be surprised to know that there are several such theads on this forum.

I juat wanted to know the answer to a small question. The pro people say that not to PM them for questions. So I posted this question on the forums. What problem are you having with this thread?

@ArnavPawarAA, I think you are reading too much into the answer. We see lots of questions where one thing is asked, but something else is really the intent, but the question asker didn't know enough to ask the proper question.
Usually noted as an X:Y question.

Ok everyone.