QuoteThe Arduino Language is a simple macro that creates a loop that a microcontroller runs forever. I stopped reading it at that point.
The Arduino Language is a simple macro that creates a loop that a microcontroller runs forever.
If so why can't people just use gcc directly, after performing steps 1-10 from your write-up?
- These two functions must be present. setup() contains the code that the microcontroller runs once upon being powered, the loop() function contains the code that loops tightly forever.
It is simply passed to a C++ compiler to finish compilation.
In practical terms the basic Arduino program structure is not event-driven.
The loop() should poll heavily for any event it needs, blocking completely.
All functions are blocking.
The rest of the arduino.h header file contains other functions commonly used. From a language specification perspective it is more precise than the official documentation.
I only see one comment. I think you're making this up.
Do you have a similar reference for the "build process" itself? For example, it is clear that at the point of your third bullet point there is a "temporary compilation folder". What is the program that actually builds it?
It must be a C++ compiler (like gcc). I googled this and found: " is passed directly to a C/C++ compiler (avr-g++)."Is it avr-g++ in every case? Or can other compilers be used at this step?
For example, an alternative to gcc is clang. If I personally perform steps 1-10 can I just pass it off to clang? Why or why not?
Finally, based on the fact that steps 1-10 are performed how would you feel about my using the nomenclature "Arduino C++ templating language", which would make it clear that:1: Code produced in the Arduino templating language is not ready to be passed on to GCC directly. There is a bit of translationn involved.2: It is a light translation that results in C++ code that is ready to be passed to the compiler.
The Arduino "sketch" files (that is, the .ino files) are concatenated, and then pre-processed by the IDE to add function prototypes for you. The concatenated file is also scanned for #include statements which guide the IDE as to what additional libraries to include in the build process. In addition, any .cpp, .c and .asm files are also added to the build process without modification.Once that is done the files are compiled using avr-g++. The resulting object files are combined using avr-ar. This is then linked using avr-g++. Then the resulting .elf file is turned into a .hex file using avr-objcopy.