Hello, I hope
you're doing fantastic.
In this video, we're gonna do an overview
of the Arduino toolchain.
Essentially, the toolchain
are all the software tools
that are in between us pressing
the Verify and Upload buttons
and that code actually getting loaded onto
the integrated circuit
on the Arduino board.
Now, I want to stress the word overview,
because there's a lot
going on behind the scenes
that actually makes that happen.
But in practice for us, the entire process
is just a matter of pressing a button.
As we start to dig in,
it's tempting to wanna know
every detail in depth, but
we have to remember that
our goal in this course is to
learn programming and electronics,
and if we're not careful,
we can get pulled down
this huge rabbit hole.
So, that being said, I
do think it's important
to be familiar with the process;
not necessarily understanding it in depth,
but I want us to be able to understand
and recognize some of the terms and jargon
associated with this toolchain.
Specifically, in this
lesson, we will cover
what a toolchain is,
an analogy to help us understand
the Arduino toolchain,
and we'll learn the basics
of the Arduino toolchain.
Finally, we'll discuss a couple reasons
why smiling actually increases longevity.
So, what is a toolchain
in the first place?
It kind of sounds a bit complicated.
In programming, a
toolchain is just a series
of programming tools that work together
in order to complete a task.
If we were cooking
something, like carrot soup,
a toolchain might include a carrot peeler,
a produce knife, a pot,
some water and a stove.
Together, these tools
help you make carrot soup,
which is the output we are looking for.
When we're developing
programs for Arduino,
we'll be using a toolchain also.
Now, for us, the Arduino toolchain
happens all behind the scenes,
like we've already said.
Literally, we only have to press a button
in order for our code to actually end up
on the Arduino board, but
a toolchain is at work.
So what I wanna do is start
peeling back the curtain
on this Arduino toolchain.
So, imagine for a moment,
that you're an author.
In fact, you're a New York
Times bestselling author,
just like me.
Now, what type of toolchain might you use?
Maybe it would look like this:
so you start off with a
text editing software,
just like Microsoft Word,
and you type up your awesome story.
Once you're done with that manuscript,
you send it off to a professional editor
at a publishing company.
Now, the professional editor,
he's part of this toolchain, essentially.
He's gonna look over your manuscript,
he'll point out some errors,
he might do some rearranging
and that kind of thing.
Now, after he's sent it to you,
you've made some corrections.
You give the manuscript back
to that professional editor,
he's gonna do one last check for errors,
and then he's gonna hand
it to the office next door
at that publishing company.
The publishing company can't just take
that Microsoft Word file and
send it off to a printer.
They need a special file type that's gonna
set the book up how it should look
on a physical page when
it actually gets printed.
So they take that manuscript
that's in a Microsoft Word file format,
and they turn it into a new file format.
You know, like, adjust
the typeset for printing,
all that type of fancy jazz.
Now, once that has been done,
now the publisher can
send it off to be printed.
They take that file, they
send it to be printed
onto an actual physical page.
But this publisher, they actually
have an in-house printer.
So the in-house printer,
they know everybody
at the publishing companies,
so instead of having to, like,
go through the rigamarore
of sending the manuscript
off to some printer, they can just do it
right down the hall, so to speak.
And this way, it makes
the process of printing
a whole lot easier.
So, let's review this author's toolchain.
The author uses a text editor program
to write the manuscript;
then he sends the manuscript to an editor,
a professional editor
or publishing company;
that editor does some rearranging,
looks at the manuscript,
checks for errors, that type of thing;
and then, he sends it next door,
and it gets converted
into a new file format
that can actually be printed onto a book.
And then they send it off to the printer
and the printer actually
prints it onto the book.
Finally, voilà, somebody
buys your book from Amazon
and they read all about zombies
over a warm cup of latte.
Now, the Arduino kinda
has a similar toolchain.
So, when we start writing our code,
and, you know, we're the author here,
we'll do this in the Arduino IDE.
And this is kinda like the text editor,
that's what the author uses,
and we're gonna write our code
in a programming language called C++,
and the actual file type
extension that we save it in
is .ino, or "dot-eeno".
And this code that we write,
it's called human readable,
and that's because it's
meant for us to read,
and hopefully to understand.
But the Arduino hardware,
that integrated circuit?
It doesn't understand C++ code.
It needs what's called machine code.
So, in order to generate
that machine code,
we use a software tool called a compiler.
Now, in the Arduino IDE,
the button that looks like
the checkmark, the Verify button,
when you press this button,
it compiles the code
using a compiler software called AVR-GCC,
and this compiler software,
it does a bunch of stuff.
It rearranges some code,
it checks for errors,
this would be like the professional editor
at the publishing company.
Now, what the compiler also does
is it takes the code and
translates it into machine code.
Now, there are some in-between file types,
but the final output of the compiler
is a machine language
that's saved as a .hex file.
Now, in order to get this
.hex file actually loaded
onto our Arduino's integrated circuit,
we need to press the Upload button.
What the Upload button does
is start another piece of
software called AVRDUDE,
as in, "Hey, dude!"
What AVRDUDE does is it sends the file
to the Arduino's integrated circuit.
Now, normally, we would have to use
some external hardware to
load that integrated circuit.
But what Arduino has
done, in their wisdom,
is they've loaded a
small piece of software
onto the integrated circuit
that comes with an Arduino board,
and that piece of software
is called a bootloader.
And what the bootloader does
is work with ARVDUDE to take
that outputted .hex file
and put it onto the flash memory
of that Arduino's integrated circuit
with only the USB cable.
Now, again, all we have to
do is press the Upload button
and that whole process
happens behind the scenes.
So, let's do a quick
review of this toolchain.
We've got the Arduino IDE
Editor, we've got the compiler,
which is AVR-GCC, we have AVRDUDE,
and then we have the
bootloader that is the
small .hex file that is gonna
stay on the integrated circuit
that's on the Arduino board.
And that's it.
So let's do a review of
what we've talked about
in this lesson.
First, we learned that in programming,
a toolchain is simply a
group of software tools
used to complete a task.
Then we talked about the
book publishing analogy
of compiling and uploading
to the integrated circuit
on the Arduino board.
Finally, we walked through
the Arduino toolchain.
So let's just go over that toolchain
one more time for kicks.
We start by writing
human-readable C++ code
in the Arduino IDE Editor,
then we click Verify, and
that compiler program,
called AVR-GCC, checks the code for error,
adjusts some of the code for us
and eventually gets around to outputting
machine code in a .hex file.
When we press the Upload button,
AVRDUDE takes that .hex file
and works with the bootloader,
which, again, is pre-installed
on the Arduino's integrated circuit,
and it gets that machine code
loaded onto the Arduino's
integrated circuit.
Hoo, man, I'm glad that all
happens behind the scenes.
And, again, this was meant
to be a cursory overview;
we're just tryin' to
learn some of the jargon.
So, if you see, you know, AVR-GCC
or if you hear the word "compiler",
or if you see AVRDUDE and
some type of error message,
and you hear the word "bootloader",
at least you kinda have
an idea of where they are
in the Arduino toolchain.
All right, hey, look forward to seeing you
in the next lesson, bye.
