Posted by Bazyle on 06/12/2016 18:16:19:
…
Actually most of the controllers with a 'user friendly' IDE, including the Arduino, are not full compliers but producing an intermediate code that is run by an interpreter in the chip – that's why the chips have to be preprogrammed.
…
Thanks to Bazyle for launching me into another useful learning experience!
I didn't believe the suggestion that the Arduino has an interpreter in the chip and tried to confirm that's wrong. Loads of stuff on the web implies that Bazyle is mistaken but I couldn't find anything that confirmed it positively. I ended up doing forensics on one of my own programs.
Normally the Arduino IDE (Integrated Development Environment) doesn't save the compiled file uploaded into the Microcontroller. It can be ordered to save it from the Sketch Menu with 'Export compiled binary'. Doing this produces two hex files; they appear to be identical except that one of them includes bootloader code. These files can be analysed.
A hex file can be disassembled a command line utility called avr-objdump. Although this was downloaded with the IDE it is not installed (at least on linux), so using it involves typing in full pathnames, or copying everything into the same directory.
Then this magic incantation disassembles the binary file, ie converts machine code back into assembly language. My example program is in monitor.ino.standard.hex, and objdump writes the decode into a new text file called hum.s:
./avr-objdump -j .sec1 -m avr -d monitor.ino.standard.hex > hum.s
Inside hum.s is the evidence, and it looks very much like AVR assembly language to me, not interpreter tokens:
That's the case for the defence m'lud. I suspect Bazyle has misremembered how this particular microcontroller works, he's quite right that others interpret.
Normally using an Arduino is much easier than this, but it's useful to know that the IDE comes with a full set of advanced software tools, hidden away though they are.
Dave
After posting, discovered that muzzer got in first!
Edited By SillyOldDuffer on 08/12/2016 13:38:30
Edited By SillyOldDuffer on 08/12/2016 13:41:04