TelephoneBill
Well-known member
I have used the Arduino IDE a number of times, but some aspects of it are puzzling. Maybe a few DUMB questions or statements (probably misguided) can shed some light? Paul is very occupied at this time, so any other expert comment would be much appreciated...
1) It seems that the code that is actually downloaded to Teensy boards is a bit more than just the "Sketch Source Code" which I write with the editor. So I'm guessing that some "Pre-amble Code" is added to my sketch automatically before being downloaded? If true then exactly how does this work? Let me assume this to be so...
2) Before I start writing "Sketch Source Code", I have to select items from the drop down menus (Tools) etc, such as the actual board that I'm using, the CPU speed and maybe some more stuff. How does this influence the "Pre-amble Code"? My guess here is that before the compiler runs, some additional .h header files are added to my source code - but these are not visible to me as a user on screen. Is this what happens?
3) If I were compiling in a DOS window environment, then a number of "Switches" would be included in the command line that I would type. Maybe this is how some of the "choices" from the menus are actioned? Perhaps the Arduino IDE GUI is really building a "command line" for me, and parsing my choices to include in the final "command line" that actually is submitted "under the hood"?
4) The most comprehensive way to prepare "Sketch Source Code" for compilation would be to automatically create a MAKE FILE, which I know is just a text file, but contains everything that I would have typed anyway. Perhaps the Arduino IDE GUI is another way to automatically create a MAKE FILE for me?
===
5) Looking at the Sketch Source Code I can write, there are a number of "register names" (are these called literals?) that I can use without defining these myself e.g. PORTC_PCR5. The compiler never objects (well usually never) and I know that these are all defined in a file that Paul publishes (and updates regularly for new boards) on GitHub called "Kinetis.h". So my guess is that this file is one of the .h header files that is automatically added to my source code. Is this correct?
6) The Kinetis.h file has an opening comment "Teensy Core Library". So are these the same thing (these terms interchangeable) - or is there more to the "core library" than just this one file?
7) I notice that some define statements in "Kinetis.h" refer to other "literals" not defined in that file, e.g. F_CPU. This is used as a test (if (F_CPU == 240000000)) so it tells me this is the speed of the CPU (F = frequency), which is one of the other selections from the Tools drop down menu. My guess here is that by making the speed choice from the menu, then another .h header is created, which is probably very small and precedes the Kinetis.h file when/if the MAKE file is created ???
===
Last query/puzzle...
8) There are lots of library files available for Teensy boards. I can download these from the PJRC website - or even make my own. I can put these files into any folder I choose on the PC, providing the PATH is specified, but is there a "standard folder" within the Arduino IDE where I should put these? Can I then just refer to these by name in my sketch rather than having to specify the PATH?
Thanks in advance for any guidance.
1) It seems that the code that is actually downloaded to Teensy boards is a bit more than just the "Sketch Source Code" which I write with the editor. So I'm guessing that some "Pre-amble Code" is added to my sketch automatically before being downloaded? If true then exactly how does this work? Let me assume this to be so...
2) Before I start writing "Sketch Source Code", I have to select items from the drop down menus (Tools) etc, such as the actual board that I'm using, the CPU speed and maybe some more stuff. How does this influence the "Pre-amble Code"? My guess here is that before the compiler runs, some additional .h header files are added to my source code - but these are not visible to me as a user on screen. Is this what happens?
3) If I were compiling in a DOS window environment, then a number of "Switches" would be included in the command line that I would type. Maybe this is how some of the "choices" from the menus are actioned? Perhaps the Arduino IDE GUI is really building a "command line" for me, and parsing my choices to include in the final "command line" that actually is submitted "under the hood"?
4) The most comprehensive way to prepare "Sketch Source Code" for compilation would be to automatically create a MAKE FILE, which I know is just a text file, but contains everything that I would have typed anyway. Perhaps the Arduino IDE GUI is another way to automatically create a MAKE FILE for me?
===
5) Looking at the Sketch Source Code I can write, there are a number of "register names" (are these called literals?) that I can use without defining these myself e.g. PORTC_PCR5. The compiler never objects (well usually never) and I know that these are all defined in a file that Paul publishes (and updates regularly for new boards) on GitHub called "Kinetis.h". So my guess is that this file is one of the .h header files that is automatically added to my source code. Is this correct?
6) The Kinetis.h file has an opening comment "Teensy Core Library". So are these the same thing (these terms interchangeable) - or is there more to the "core library" than just this one file?
7) I notice that some define statements in "Kinetis.h" refer to other "literals" not defined in that file, e.g. F_CPU. This is used as a test (if (F_CPU == 240000000)) so it tells me this is the speed of the CPU (F = frequency), which is one of the other selections from the Tools drop down menu. My guess here is that by making the speed choice from the menu, then another .h header is created, which is probably very small and precedes the Kinetis.h file when/if the MAKE file is created ???
===
Last query/puzzle...
8) There are lots of library files available for Teensy boards. I can download these from the PJRC website - or even make my own. I can put these files into any folder I choose on the PC, providing the PATH is specified, but is there a "standard folder" within the Arduino IDE where I should put these? Can I then just refer to these by name in my sketch rather than having to specify the PATH?
Thanks in advance for any guidance.