Tutorial on how the actual program is being put together

Hello Arduino community,
I want to add an overflow flag to the HardwareSerial class code. It's supposed to tell me if I'm too slow in reading stuff from the queue. Basically I know exactly where to apply the necessary changes, but I have no idea how the whole code is created when I press the "Verify/Compile" or "Upload" buttons.
Is there a tutorial telling me how the actual code (that will be loaded onto my Arduino Due) is created including core, libraries and other indispensable stuff?
Thanks a lot
Michael

As far as I know the process is exactly the same as the equivalent for a program running on your PC except that the compiler produces code for the processor you have selected and at the end of th eprocess the hex code is uploaded to the Arduino rather than remaining as a file on your PC.

If you are trying to modify the Arduino source code (which is perfectly feasible) I don't see the relevance of your question.

I suspect you will get more help if you post your code so people can see what you are trying to do.

At another level, I don't see the value of a bufffer overflow flag. Wouldn't it be better to take the data out of the buffer before it becomes full and data is lost ? The code in Serial Input Basics is intended to do that.

...R

Thanks for your reply Robin,

I do know how a compiler and a linker work and how the stuff is being uploaded onto the Arduino, but things are indeed a bit different from creating a portable executable module on a PC. When the code for the Arduino is created, it is completely self sustaining and all bits and pieces necessary must be part of the code. On a PC you have many invited and uninvited dlls that are loaded into your process once your program comes alive.

So my rephrased question would be: How does the Arduino environment put together all the code necessary for a self sustaining program that can be uploaded? I'm not too keen on fiddling my way through many header files to derive the inner workings of the system if there was a tutorial giving me this information instantly. I assume there are some pivotal header files and some sly ways of using them that do the trick.

All I want to do at the moment is extend the HardwareSerial class. But I want to do that in a clean and efficient way that does not bring problems in the future. If know how the system works, I can figure out a way how to proceed. I just dislike the technique of banging my head against a wall or beating the bushes to get there.

Michael

As far as I know, the documentation is the source code and the datasheet for the processor.

If you found any sort of "tutorial" (lol), it would probably be AVR specific - not for the Due, which uses a totally different architecture.

The basic process is you install the core, open up the folder and start looking at filenames until you see one that looks hopeful. Then investigate it. A good "find within files" function is key.

You will need to study the section of the datasheet describing operation of the UART as well.

mixl:
All I want to do at the moment is extend the HardwareSerial class. But I want to do that in a clean and efficient way that does not bring problems in the future.

I don't understand why that can't be done just by editing the code in the file with the HardwareSerial source code without any need to worry about anything else.

Or, put another way, I cannot envisage the potential problem you are concerned about.

AFAIK there is nothing to stop you creating a copy of the HardwareSerial code with a different name so that you can distinguish between the original and your version.

And, as I said earlier, I can't understand why the standard library is inadequate if used properly?

...R