Embedded - 127: Chicken Equals Duck Plus One
Episode Date: November 26, 2015🐔=🦃+1 (or Why isn't there a duck emoji?) Christopher and Elecia talk about languages, twitter, listener emails, and Star Wars. Podcast Awards The Amp Hour talked about languages, they also refe...renced this compiler writing exercise C alternative tokens iso646.h and an up to date C reference (Harbison and Steele) $20 Linux board from vocore.io Real Strawberry DNA extraction technique (Elecia forgot the soap and the salt.) fromScientific American (with real science) or in easy-to-follow picture form on genome.gov.
Transcript
Discussion (0)
Welcome to Embedded FM. I'm Elysia White.
Christopher White and I will be discussing things amongst ourselves this week.
Oh, on the air.
Oh, yeah. Sorry, didn't I mention that?
I thought we were just going to have an outro and then we were going to go discuss things amongst ourselves.
Ah, alright. Well, for that,
what do you want to talk about first?
Well, you've got this whole ordered list.
It's not so much ordered as unordered.
I think you put it in the wrong structure.
All right.
Gosh, I don't know.
Well, can I talk about podcast awards first? first yeah let's get that out of the way
i saw someone say they had an award-winning podcast and of course not able to deal with
competitive urges without wanting to compete and win um i went and looked up what podcast awards there are. And apparently there are some
particularly popular ones, www.podcastawards.com. The nominations open in early 2016, but there are
only 15 days to do the nominations. The total number of nominations might get us on the ballot.
I don't really care about voting.
You don't have to vote for us.
I totally understand if you vote for somebody else.
But I don't need to win.
But I really want to be on the ballot so that we can reach a few more people.
And I think the category we want is technology.
There are too many heavy hitters in science.
Not comedy?
Maybe not comedy.
Anyway, the nominations will open in January, and you will hear me begging for you to nominate us.
So get your plan in place.
We'll probably beg pitifully on Twitter first, which I guess does flow to my next topic on the unordered list that you're doing in order.
Wait, wait, you're just not going to let me respond
to the whole podcast awards thing?
You think it's silly.
Oh.
Okay.
No, no, no, no.
Go ahead, frame your own response.
I think it's silly.
Thank you. Thank you.
Thank you for your love and support, Christopher.
Doesn't mean it's bad.
Oh, I admit it is silly.
But, I don't know.
It'd be neat.
Yes. Okay.
So you were segwaying into Twitter.
Yes. After we got
off the air with one of our recent guests, he asked, how do you use Twitter in that, you know, why sort of manner that I often associate with people who don't use Twitter a lot?
Oh, you're asking me how I use Twitter?
Sure.
Too much?
Too much. I don't know. I use Twitter? Sure. Too much? Too much.
I don't know.
I use it differently than probably most people.
I think a lot of people follow a lot of people and use it for almost like RSS.
The newsreader.
Yeah.
I don't follow that many people.
I follow probably 100 people and I try to keep it that way.
And I get a little bit of my news from there,
but mostly it's just I've collected a group of people who say interesting things,
and I like reading what they have to say.
Sometimes they have blogs, sometimes they have podcasts,
and sometimes they're just friends.
As far as posting on Twitter goes,
I don't have enough followers to really use it as a, I need help with this question kind of thing.
Um, generally I use it as a, I have a joke or I'm annoyed.
Here's how I'm annoyed or here's a joke.
Yeah, as a slight outlet for quiet whines.
Yeah.
Yeah. Yeah.
I can't, I find I'm censoring myself a lot more than I used to because.
Now you're followed by people you work with.
Well, you can follow people I work with,
or there's just some chance that somebody will go look something up,
and, you know, I can't say specific things about specific.
Let's just leave it at that.
Oh, come on, you can go ahead and rant about IAR here
oh no I say specific things about IAR on Twitter
I have no problem with that
can't really complain about the man
the man is watching
how do you use it?
well like you I only follow about 100 people
because that's as many as I can keep up with.
And even that, I do declare bankruptcy sometimes and just not read everybody's tweets.
Yeah, I'm definitely not a completionist.
That way lies obsessive compulsive disorder.
And then I tweet jokes and stuff about the podcast and books.
You tweet all of my jokes.
I tweet all of my favorite of your jokes.
Right.
Yeah.
I also spend a lot of time tweeting things you say that you don't tweet because I get to it first.
Right.
So if you want all my best jokes, follow Logical Elegance.
I also have been monitoring the Embedded FM Twitter feed more
than I used to.
Now that we've had enough guests,
and Embedded FM always follows the guests
if they have Twitter accounts,
that is a more
varied and interesting
thing to look at sometimes
and not try to keep up.
Yeah, I do that too. It's a good collection of people.
There's a million ways to use Twitter. I don't think Twitter, the company, knows how to use Twitter.
Since they keep changing things, it's clear they don't know what the good parts are and the bad parts are.
I think
it can be useful. It's a really powerful way
to connect with people who you normally a really powerful way to connect with people
who you normally wouldn't be able to connect with
because everybody's sort of brought down to the same level in some sense.
It's not like Facebook where if you're following a celebrity
or a famous person in your industry or a luminary,
the odds that you're actually going to interact with them are fairly small.
But on Twitter, it's so short,
a lot of times you can ask somebody a question.
Or you get in a Twitter fight with John Scalzi.
That was pretty funny.
Wow.
Yeah, it was a very short fight.
But yeah, people respond to you who, you know, normally probably wouldn't because it doesn't take much time to write a 140-character response.
Yeah.
So it's kind of interesting.
You can be connected to people who probably there wasn't
a way to be connected to them before.
Well, then you can listen to conversations too.
Like, what is it?
Bezos and Musk had this big Twitter
fight about whose rocket
went to space or some nonsense.
It was very serious. It was nonsense. It was very serious.
It was nonsense.
It was totally nonsense.
And I liked watching some of that.
But I also like watching people I know sort of,
like Micah, Micah Scott,
and talking to Lenore and folks over at Evil Mad Scientist because, I don't know, it's just neat to see people
I sort of know, sort of know each other.
Yeah. I think
once you reach a certain number of followers,
things get tricky for a lot of people.
So, I don't know.
Yes, I had a brilliant joke earlier today
and I did not put it on because it was
completely inappropriate.
Well, there's that, but there's also, you know, the crazies come out.
Twitter is also full of crazies.
So like any other communication medium, that's totally open.
It's totally open.
Anyone can talk to you and, you know, you can block people, but that's after the fact.
So, yeah, I mean, as far as how I use it as a work thing.
I occasionally will post questions.
Yeah.
And sometimes get really good response.
You know, like,
what is this chip that I just took a picture of
and I can read the markings,
but that doesn't help me.
Yeah.
It's occasionally useful for asking questions.
It's more useful when people post articles.
Yes.
And the articles turn out to be useful.
Yeah, I'd agree. So, use Twitter or don't. host articles. Yes. And the articles turn out to be useful.
Yeah, I'd agree.
So, use Twitter or don't.
Yeah, yeah.
Speaking of articles posted,
some other podcast, The Amp Hour,
had a segment on
languages, which
sort of came up at the same time
somebody else was talking to you about modern
languages and embedded systems and how important
JavaScript was going to be
to the future of embedded.
And I tried not to laugh about that.
Or
about D and Rust and
all of the other stuff.
You had a very strong
reaction to the Amp Hour segment.
It was not strong, I was measured.
Really?
Because you stopped them from playing like four times so that you could...
So, allow me to misrepresent what they said.
Yes.
So, they had a...
Chris brought up a link, and we'll put it in the show notes also.
It was from Cora, I think.
Well, that's not what...
No.
What?
Which language has the brightest future replacement of C?
No, bootstrapping a simple compiler from nothing.
Oh, okay.
That's how the discussion...
Well, okay.
Part of the discussion was talking about languages in general,
but part was also talking about this article,
which is on rano.org,
about this exercise this guy went through or girl
to build a language basically and they did it in a very interesting way they kind of started
from scratch and started you know building it up from machine code and you know building small
pieces until they had more and more intermediate pieces and then you know eventually building small pieces until they had more and more intermediate pieces. And then,
you know, eventually a small C compiler kind of thing. And I think Chris was saying, you know,
this is really complicated. And it's strange to see how people do this. And forgive me if I'm
misrepresenting what you said, Chris, but I got the impression that they thought that was how
languages were created. And perhaps I'm wrong. thought that was how languages were created and perhaps
i'm wrong that's not how languages are created it's a very cool exercise but languages are a very
top-down development i mean there's a lot of fundamental formal computer science things that
go into it and you don't really consider unless you're doing something very strange you don't
consider the underlying architecture beforehand and you don't go straight from the compiler even to the machine code for the
device in question. There's always an intermediate representation, which is either kind of a virtual
machine or another language that's specific to the compiler that's easier to optimize. Well, yeah. I mean, you think about trying to write C compilers
for five different chips,
an 8-bit and a 32-bit and everything.
You don't want to have to do that natural language processing
to machine code-ish thing.
For everything.
For everything.
You would rather go to an abstraction layer.
Right.
So they go from high-level language
to some abstraction layer,
which sometimes it's very abstract.
For C++, it can be another object-oriented kind of thing.
For lower-level language,
it might look similar to assembly language,
but for a chip that doesn't really exist.
And then they can do an optimization pass on that code.
And then there's another pass
where they actually do code
generation, which goes for your target.
Object generation.
Sure. Sorry, code
has too many meanings here, so I was trying to...
And that might be
another optimization pass where you can start
taking advantage of things that are specific to
your particular arm or x86
or whatever but anyway
i i didn't want to harp on it too much but it did i did get the impression that that was
how they thought languages were developed and it's very much not
well most languages now are more human readable as time goes on things become have you seen rust
i haven't actually no it's not that, but it's syntactically weird.
Yeah, and things do become more human-readable.
And some of the intermediate languages
in between machine code and the compiled language
are human-readable, too.
Compilers are fascinating.
I mean, it's one of the most complicated.
Compilers and language development
are one of the most complicated and amazing things,
I think, in software development.
There's very few people out there
who know how to do it well.
I've known one.
And they really are very specialized
because that stage where you go from
their virtual machine or their language thing
to your actual processor, that requires a processor expert.
And not like a processor expert like,
I'm pretty good with Cortex-M3s,
but here is the assembly and I understand it thoroughly.
Yeah, and know the quirks and how you can rearrange things.
Because I worked on a compiler and assembler for a chip at Cisco a long time back,
and it was a very strange chip in that each instruction could do something in every unit.
So they're very, very long instructions,
and you could have a memory operation, an arithmetic operation,
some other thing, a shift operation, all in one instruction.
And so there are really cool things you could do when optimizing to take stuff that would happen later and pull it up into the earlier instructions.
Because you might as well set it up.
You had an unused arithmetic step or an unused shift step.
So that was really complicated.
So that's an example of taking very specific knowledge about how the chip works
and taking advantage of it at the lowest optimization level.
And if you output your list file, like if you compile your C file,
you can get a list file, which is the assembly.
And you can see that sort of optimization in the assembly
if you know how to look for it.
Right. But you can't usually
see the intermediate language. I don't think
so. Maybe there is a way.
I'm sure there's a command
line option for all the compilers. For GCC
for sure. Yeah, and there might be for
LLVM as well.
And a lot of them will output
different intermediate representation. GCC has several that it uses depending on
what it's targeting
so yeah
it's complicated stuff
it's cool, I've often wanted to
really really dig in and learn that
yeah
embedded systems
I guess signal processing is my favorite thing
to work on and then just general embedded systems
but after that compilers would be up there
and there's plenty of languages out there that are very popular
that don't target any device
java.net, they all target a virtual machine
which is non-existent
and it runs a runtime
and runs a bytecode that comes out of the high-level language
but doesn't actually target your chip.
The second question, I think, was partly,
I think you were alluding to it,
was why aren't different languages besides C used more in embedded?
Yeah, somebody was telling me about how
important it was that Python
be covered in embedded systems
and
JavaScript.
I nodded along politely and waited
until I could hang up the phone
to laugh hysterically.
Why would you laugh?
Because I have reasons why those are all very important to know
even as an embedded systems person. Oh, I agree are all very important to know, even as an embedded systems
person. Oh, I agree that it is important to know Python. And I work at, I learned Python, and I'm
not as good at it as I want to be, but it is certainly something I spend time on. JavaScript
is sort of in the same boat, but I don't work on JavaScript. I just wait for it to require
immediate action, and then I learn what I need't work on JavaScript. I just wait for it to require immediate action, and then I
learn what I need to and go on. Because Python is great for doing tools, and you have to do tools.
You can't get around, your data's not in the right format, your code needs some test that requires a
generation of a whole bunch of files, your images aren't in the right order.
Python is great for those things.
JavaScript is really good for when you need to interact with the world,
when you need to write a test script because you have an Internet of Things widget
and you, sure, it will attach to a smartphone at some point,
but JavaScript is what you use on your computer to test your device.
So I get all that.
But I don't run those on my system.
So here's why I think
C is
pervasive and stays that way.
One is,
kind of going back to the compiler issue,
I think
it's easy to optimize C.
It's easy to take C and perform optimization steps
that might target different chips.
If you had a much higher level language,
it's probably a much more difficult task
to try to produce optimized code for a Cortex and an A7
and an x86 and whatever other that I pick.
So the tools manufacturers, tools developers,
are probably incentivized to stick with C for a long time.
The other thing I would say is that
I think there's critical mass with these things.
I was going to say inertia, which I think is going to be the same point. There's a huge amount of inertia behind C.
And unless you get a player that says,
and I think Chris and Dave both said something similar,
if you get a player who says,
this is going to be the language for my device,
there's no reason to displace it,
unless there's some incredibly compelling feature of a new language.
There are a lot of languages out there, but they're all variants on themes. feature of a new language, which, you know, there are a lot
of languages out there, but they're all variants on themes. You know, some of them are functional,
some of them are imperative, some of them are object-oriented, some are not, and then some
mix and match. But there's nothing out there that says, oh, if I did this, then all my problems are
solved. You know, and there's various attempts to fix things like rust one of the claims to fame of
rust is uh we're going to fix all your memory management problems well didn't go have something
along those lines as well yeah but i think go is more targeted towards the website of things
i remember when josh schneider came and talked to us about go but i don't remember very much
about go yeah i don't i don't know that much about it, but I hear most of it in the context of things like replacing PHP or Python
or other server-side languages.
So C's got just a huge amount of inertia behind it,
and people keep trying to change it.
I know they were laughing at D, and I laughed too,
because they had just heard of it,
but I remember a colleague telling me
to go look it up in 2005.
I mean, it's been around forever.
And so people do these projects,
and some of them are quasi-academic,
and some of them are,
oh, we're going to try to push this
as part of our product.
I think that really just doesn't work.
I think the only people who have been successful
with that kind of thing are Microsoft and Apple.
Microsoft with.NET and Apple with Objective-C and then Swift.
Both of them can do it because they have their ecosystem.
And they say, this is how you develop apps for our target,
and you have no choice.
Well, and somehow they made Swift very alluring.
Swift is on my list of, you know, once I'm good at Python,
it may be Swift.
Although I have no reason to want to learn Swift other than Apple tells me I want to learn Swift.
Unless you want to write apps for Apple, there's no reason right now.
I like the idea I can use emojis in variable names.
Yeah, that is, see that's the kind of thing that could push C out completely.
You could have chicken equals duck plus one.
Actually, I think that that is an amazing feature because you can write code in Chinese.
Well, you can write localizable code, yeah.
Not localizable code.
Localized.
But, I mean, I can't really imagine me writing code in Chinese.
Why do I expect that Chinese folks should write code in all of the Americanizations we have in C?
I mean, sure, it just says for and while and switch and case, but those are still not native.
And so I am sort of excited about Swift and its ability.
I'm not sure the keywords are.
No, but everything else can be there.
You can name variables and stuff.
I'm not sure that's not possible in other.
I mean, that's got to be a compiler-specific,
parser-specific thing rather than anything language-specific.
All right, well, we don't know, so let's go on.
Anyway, so they had an interesting discussion on empire.
It prompted me to think about things, and there you go.
What about ISO 646.h?
I don't know what that is.
Actually, it was Andre from the Great White North who introduced this to me.
He asked if I ever included it in anger, and so I had to go look it up and then reply,
well, I never have, but I will now.
So it is, let's see, ISO 646.h.
Very descriptive.
Yeah.
Easy to remember.
It was sort of like you're making a header file that makes things easier to use and remember,
and that's what you're going to call it.
But it redefines several operators.
So like the and-and, which is the ampersand-ampersand.
Otherwise known as logical-and?
Logical-and.
So it becomes a macro that is just and.
And then you have a single pipe, which is usually bitwise or.
And so the header file macroizes that to actually be bit or.
Is this just to reduce confusion between the logical operators?
Yes.
Well, and to make the symbols a little easier to understand. So it does and, and equals,
bit and, bit or,
complement, which
is, and has complement,
which is the tilde and not, which
is the exclamation point.
Which is right,
but it's, my brain was never
going to get complement.
Maybe inverse. Inverse.
Or, x or, x or equal. Inverse. Or X or equal.
Exciting.
Yeah, super exciting.
So if you hate the operator symbols in C, you should use this header?
Yeah.
What about equality?
Does it fix your problems between equal and equal equal?
No, no.
Yeah, I see that a lot more.
That's true.
I don't know. it was sort of amusing.
It seemed like the sort of thing you could torture people with in interviews.
And you said that's built into C++.
It is built into C.
Wait, well, the header is.
It's a C90 standard.
Oh, so you don't need the header if you're C90?
Infomated is a group of
macro constants in the C standard library
in ISO 646.h.
Right, all right. They were added to the
standard in 1995 amendment to
C90. Okay, great. Now you have to include
the header. Unless you're in C++ image
case, you don't have to include the header. These all just
work. That's what I just asked.
Then the answer to your question was
whatever that answer was.
Which is yes.
Yes, yes, yes.
We'll stick with yes.
Going back to the languages for just a second,
there was another thing.
I don't want people to have the impression
that we all program in C.
And you mentioned Python and JavaScript.
I've used a ton of languages in development.
And they're all targeted to the specific use.
I wouldn't write a script to build stuff in C.
No.
I'd write it in Python.
I'd write it in Shell script, some other scripting language.
I would pull out my make.
Stuff like auto-generated code
when you're doing internationalization
and you have a script that might extract strings from C code
and build more C code or auto-generate headers.
Or if you're doing meta-language things
where you're replacing tokens and modifying the C language,
all that stuff can be done with Python and shell scripts and stuff.
And so those get used a ton for tools.
I use MATLAB all the time for simulating stuff,
algorithm development.
If you're doing image processing or doing audio DSP stuff,
it's much easier to start with MATLAB than it is to start with C code.
How do you still have a MATLAB license?
Let's not talk about that.
Octave, whatever.
I use NumPy, but yeah.
I don't still have a MATLAB license.
NumPy.
Yeah, so, I mean,
Embedded uses all kinds of stuff.
I mean, ShotSpotter was,
can we say what?
Oh, well, they used C primarily,
and a lot of C++,
and then there were huge SQL databases, which I love SQL.
LabVIEW.
Oh, I try not to talk about that.
Well, but it's...
For scientists, it's useful.
It is, and it is a really great way to develop algorithms.
And you can leave them there.
But, you know, the pipeline is often algorithm development
in something like LabVIEW or MATLAB or Simulink,
where you can visualize stuff
and then you deliver that to somebody to turn
in to see if you really want to,
if you have to put it on a small target.
I don't really understand
the argument that C is the only
thing I'll ever learn. That's really
short-sighted.
But I also
do still resist people saying
well, JavaScript is the
embedded system of the future.
That doesn't make any sense.
That's an extreme position
on the other side that makes no sense.
Okay, sorry.
So, back to
we did the header thing.
Why? Fourth.
Alan wanted us to mention fourth again.
Fourth.
Thank you.
What comes after third?
Before fifth.
Right.
Although if you haven't heard of fourth, it is a neat little language.
You've never used this one, have you?
Not since I was a kid.
Like Apple II, I think there was a fourth thing for apple 2 and played around with a little
bit but it's it's a very if i remember correctly it's very compact there's only a few keywords
yeah uh reverse polish for the arithmetic and you know it's very close to assembly almost
and it's bare stripped downness and so the way that I've come across Forth most often is that
an electrical engineer will need to deal
with a small processor,
8 or 16-bit,
and won't want to involve
the software people until the board is up
a little bit. And so
they port their own,
probably ported
from six other projects.
It's their version of Forth.
And they port it to their new board
and they use that to test it out.
Yeah, because I think it's pretty damn easy
to write a Forth compiler.
It is small.
It is really pretty small.
You can do a lot more with it.
You can add,
I want to say standard IO,
but of course that's C.
You can add printfs and everything.
Serial port stuff.
But it is a nice, small,
there is no compiler
for my
system, and I need it to come up
sort of implementation.
Yeah.
So yeah. I look forth, although I haven't used it
in years. Going back to the article
that Chris and Dave posted,
or linked to,
that's a great thing to go backwards
from, too, if you're trying to learn architecture,
is to get fourth up and running
on something. Yeah.
Yeah, I would rather do fourth than just about any other
thing, because it's big
enough to be hard and small enough to be useful.
Yeah. Maybe it was
the other way. I don't know.
It was a great combination of difficult and useful. I feel like we should mention Fortran way I don't know it was a great combination of difficult
I feel like we should mention Fortran
I haven't used Fortran in
17 years
still big in science
it is still big in science
we were talking to
Karen Schell she was on talking about
climate studies
like a year ago
and yeah yeah fortran the other thing i will say
is that if you do learn more than one language it gets easier to learn yeah more than two
there's like i said before there's high-level kind of conceptual arrangements of how languages work.
And once you understand those, a lot of it is just syntax.
Syntax and idioms and libraries.
Yeah.
I mean, Python, okay, fine, the basic syntax I'm good with.
But the idioms for how you get through a long list of things just sliced the right way.
And that always sort of, I never get that right.
That's the kind of thing where you use it more.
But it's not like moving from a foreign language to another foreign language.
It's not like moving from English to French even.
It's like once you learn a nice computer language,
you've got all the romance languages.
I can take almost any new language and read
code and kind of make sense of what's
happening. I can't look at
German and make any sense of what's happening.
I'm sitting here thinking about
Perl. Besides Perl.
Besides Perl.
Which is a very useful language.
Perl has been described as
a write-only language. Perl. Which is a very useful language. Perl, as has been described, is a write-only language.
Yes.
Perl and assembly.
Yeah.
Okay, enough about languages.
Okay.
Listener emails?
Sure.
Tom asks,
In a previous podcast, you've covered quite a bit about how software engineers can get into the hardware side of things.
Do you know any good resources for people that want to go from an electronics degree and have picked up software along the way but don't have more formal learning?
And so he wants to know about how do you actually teach C from the ground up for an embedded slant?
Do you have anything?
I mean, my book tries to do that,
but it's not quite what he's asking. I'm really conflicted because
I think you can learn to program by yourself
on projects and with stuff you find.
But I'm going to say,
I really feel like a little bit of formal computer science
is better to start with than saying,
I'm going to go learn C.
I think an introductory computer science course
is more valuable as a foundation.
Even if they're doing it in some lame language, like.
I don't care because the concepts are the important part.
And if you don't understand the concepts,
something like C can be extremely daunting.
Pointers, memory, how memory is organized,
loops and conditional things that sound simple to us.
I just remember people being very baffled by when they were first encountering them in introductory courses. And learning some
computer science or learning from a computer science text kind of takes away some of the
painful bits that you don't need to really worry about right now and just gets you to understand some of the concepts.
Even if you just started and kind of skimmed through
and kind of got some familiarity with the language,
and not the computer language, but the language of computer science.
Here's what we mean when we say function.
Here's what we mean when we say switch statement.
Yeah.
And here's a state machine.
It doesn't really matter what language it is. There is going to be a state statement. Yeah. And here's a state machine. It doesn't really matter what language it is.
There is going to be a state machine.
But, you know, in a lot of ways,
it's how I've approached electronics and failed.
In that, oh, I'll just build a circuit.
And I have these parts,
and I know some stuff about digital logic.
But I don't know anything about electronics.
So I don't really understand fundamental concepts very well
about impedance and resistance.
And those are the places I get hung up.
And so I think that people who jump right into,
oh, I'm going to learn to program, and then do,
I think they end up with some pretty bad blind spots in the same way
and might end up doing really
idiosyncratic things it depends on your goal too if you're just doing it for fun who cares
but no he was he was uh he actually mentioned that they were hiring in sydney for c and arm
and msp430 of course this was like a month ago so i'll see if he still got the job open and put it
in the show notes but i think it sounded like he was trying to get enough done professionally
that he wanted to do a good job.
Yeah.
And I don't know what his background is.
Maybe he's already had that course.
I think most people who come out of a university
have had an introductory computer science course,
no matter what degree you take in STEM.
I mean, if you're asking about the details of C,
I learned from Jarn Strusip, and it wasn't that bad.
I'm not going to say the naming, because they screwed it up, didn't I?
I don't know. It was just fun.
Yeah.
Yeah, well, he's asking further here,
something that covers things like when to use volatile static, etc., but also writing C for embedded versus PC.
All the resources I found generally start okay, and then they start argv, argc, and malloc-ing things. Yeah. Do you know any books that are C for embedded programming?
I know Riley has one, I think.
But no, maybe not.
I can't think of one.
Oh, look.
Maybe there is one and I'm just not thinking of it.
Actually, I'll look on my bookshelf first
before I look on the line.
But no, there isn't a great resource that I know about
that is
you're an electrical engineer, here's C
in my book I try to do
you're an electrical engineer, here's the theory of computer science
in a way that won't make you totally barf
but I didn't cover C
that's been one of the criticisms of my book
it has so few actual code examples
because I didn't want to get bogged down in languages
yeah
I think there could be a very short
a very short description of important things in C for embedded programmers
and he says it here, volatile, static
things like dynamic versus static memory.
Yeah, but as soon as you did that,
I would want to talk about the things
you don't learn from a C book.
Like, what's a map file
and why is it the most useful thing ever?
And why you really do have to look at the link file
and then you get into,
why you have to read the data sheet
so you can build a link file
and now you get into why you have to read the data sheet so you can build a link file. And now you're at a book
and you only spent like 10 pages on C.
I guess that's the answer.
C is not the hard part.
C is not the hard part.
People get caught up on languages.
Yeah.
And I don't think C is the hard part.
It doesn't matter what language you're developing in.
It's the entire ball of wax that's the hard part. It doesn't matter what language you're developing in. It's the entire ball of wax that's the hard part.
Okay. Well, let's call that answered-ish.
None of which I learned in school.
Well, you went through a different track. We had a software engineering
class where
they introduced version control.
That's not a map file.
No, but that was the class
where they talked about some of those other
professional things you find out
after you get out of college.
And I know link files
were discussed there.
Because none of us understood why we would ever
use them until one day I saw
an embedded system.
I'm like, oh!
What class was that?
It was called software development
because they weren't allowed to call it software engineering
because it was in the CS department.
All right.
That was one I didn't take.
It was probably the only CS course I didn't take.
Math majors.
Moving along.
Joe asked if I would care to elaborate on my OpenOCD rant, which I started at some point and then just kind of fizzled.
Elaborate away and I will sit back and enjoy my beverage.
I was actually going to say no because it had been so long since I used OpenOCD that I figured my information was all out of date. I mean, it had been six years since
I tried it last on an Atmel
ARM something. A 4004?
I don't remember what it was.
And it was annoying then because it would crash randomly and GDB would work
for a little while and then GDB wouldn't.
And I didn't know where my problem was.
Was my OpenOCD daemon crashing or was my board crashing or was my software or electrical?
It was just, I had run software hard enough without adding another variable of what is your JTAG doing today.
And so I figured this was all old, you know, OpenOCD, it's been years,
it must have fixed them. Yeah, I had occasion to use it last week.
I spent about 45 minutes trying to get my board to boot for the first time and it was a pain in the neck and
I don't know what happened but the thing that finally fixed it was figuring out that OpenOCD
was not starting properly. OpenOCD was starting and then crashing and it wasn't that hard to fix, but nowhere in there did it say, the reason OpenOCD is crashing is because your JTAG widget,
your JTAG emulator is not plugged into the port that I want.
Okay, you're talking over serial.
Either figure it out yourself by querying all of the available ports,
or tell me so I can type it in.
Don't just crash in the
background and then say, this code
does not load properly.
Yeah. I just
can't...
I'm not going to say that
any tools for embedded
systems are good, but that
sounds like first-day learning curve stuff.
I mean, I've had similar problems
with J-Linklink or it's like
oh i don't know what happened stuff disconnected haha or you're sitting at that break point you've
been trying to get to for three hours and we're here and we're oops i disconnected no reason i
mean that stuff happens in all those things it wasn't that it disconnected it was that the error
message it gave me was so yeah well you... No, it was first day stuff. That's what I remember about OpenOCD is that everything I went to try to do, it would fail in the background and I wouldn't figure out that that was the part that failed. What's really sad about all of these things is I can dismiss your rant because,
well, hey, all the tools are awful.
So what are you complaining about?
This was more awful.
Which is a terrible dismissal.
No.
It's a terrible thing to say, but it's true.
Yeah.
No, it was, I've used a lot of different crappy embedded tools.
And OpenOCD is.
Well, you get what you pay for.
The other ones are thousands of dollars too.
I know.
All right.
So that was my OpenOCD rant.
I know some of you are going, no, it's great.
It's free.
It's wonderful.
It probably is, but I want something that's great and free and wonderful and working.
Does it work now?
It worked for about 15 minutes, and then I loaded the code I wanted,
and then I could use the other J-Link, actually, with the IAR.
I see.
So, yeah, it worked briefly.
All right.
Okay, Dennis sent us a board.
Well, not an actual physical board.
The $20 Linux board.
Yes.
And I don't remember it because that was a while ago.
And all you have here is that $20 Linux board.
So let me figure out if I can find that again.
One second. Computing. Computing.
Here we go. It's vocore.io.
And it calls itself a coin-sized Linux computer with Wi-Fi.
$19 MIPS.
$19 MIPS core Wi-Fi.
It's on a little tiny board with breakouts along the edges.
And it looks pretty darn cool.
USB, Ethernet I squared C spy comma
etc
open source
designed to
run
the open
WRT
router thing
so you can turn it
into a Wi-Fi router
stick it on your dog
or something
yeah
the tiniest
router on the earth
I bet we could find
a smaller one
it was pretty tiny so you were going to you were going to have an existential crisis over this thing the tiniest router on the earth. I bet we could find a smaller one.
It was pretty tiny.
So you were going to have an existential crisis over this thing.
I was thinking about it, yeah.
Go for it.
Okay. Okay.
So the ESP8266 is the little $4 Wi-Fi chip that's pretty cool. And slapping that thing on everything makes me believe they're painful.
We're going to have 3 trillion Internet of Things devices next year
or something that sounds very markety.
The ESP really was sort of an eye-opener for, okay, yes.
But this is $20, which is still, I mean, it's pretty expensive.
But it's a Linux box.
$20, let me, I'm just going to go back there.
$20 is pretty expensive.
Do you remember what a dev kit cost 10 years ago?
This isn't a dev kit.
I mean, it is a dev kit, but it's an OEM part.
I mean, the idea is you buy the whole thing.
And it's $19.
And it's $19.
And on some bombs, that dollar would make a huge difference.
But if Linux, I mean, maybe I should give up on C and start... Wait, C? Start doing everything in Linux and Python and all this stuff.
I mean, if Linux...
And Python's still going to be slow.
Oh, there's that.
I did discover that with Raspberry Pi, yes.
I'm just...
I'm boggled.
It probably isn't very power efficient.
That's our last thing to hold on to is embedded software engineers.
It's probably not very power efficient.
Yes.
The only thing keeping us from all turning into Linux developers
is probably not going to work very long on a battery.
It is.
So we've got maybe two more years left.
That's my fear.
But yeah, that'll be in the show notes. I thought it was pretty cool. Thank you, Dennis.
It's pretty cool. It's real. They have a forearm. Seems pretty active.
It's all open source, I believe. Like open source
hardware as well. So yeah,
it's terrifying.
But you know, the electrical engineer should be terrified too.
Wait a minute, it's 1999.
I actually didn't see that, but all right.
Yes.
So our podcast in 2017 will probably be called the Linux something podcast.
Expect that change.
Not me, man. Free BSD.
Let's see.
Star Wars is coming out.
That is true. Were you aware of that?
I was not aware of that.
Yeah.
They're just re-releasing one of the old ones or something?
Or is it a new cartoon thing for another TV series?
Apparently, some people out there, some people we actually know and talk to regularly, don't really remember what they need to know about Star Wars and want to know if they have to go back and watch the whole prequels.
The what's?
So you're not participating in this part of the show, are you?
I'm not sure what this part of the show is about.
Star Wars.
Oh, okay.
Yes, Star Wars movie.
There's a movie coming out.
Yes, it's going to be after.
Okay, so there's the main ones, four, five, and six.
I honestly believe that nobody knows all of this.
I'm telling you people asked.
Who?
What people?
I didn't want to name names.
Okay, so in 1977, there was a movie called Star Wars. It was later renamed to Episode IV, A New Hope,
to fit in better with Empire Strikes Back,
which was its sequel, which came out in 1980.
That movie was further followed up by Episode VI, Return of the Jedi,
previously named Revenge of the Jedi about a month beforehand,
but changed because it didn't make sense for some reason.
Revenge is not a Jedi concept.
Sure.
Despite the fact of what happened with Anakin Skywalker and those little...
Sure, George Lucas.
And that was the end of the series.
Until?
There were some other stuff that happened in the 90s that we won't talk about.
Those are known as the prequels.
It's okay to skip those.
I was talking about the special editions.
Oh, I see. Okay.
So, and then, so there's a movie coming
out that is set 30
years. Which is
actual physical time. Approximate calendar time.
After the Return of the Jedi movie.
So, in order to be fully prepared,
you need to watch episodes 4, 5,
and 6. And we can sum up
the prequels?
No.
Oh, no, I can sum up the prequels.
Obi-Wan summed up the prequels in episode four in like 30 seconds.
Oh, I was just going to say, Luke, I am your father.
That was all the prequels.
Did you just spoil Star Wars?
I did just spoil Star Wars.
Anyway.
But I will not be spoiling The Force Awakens for anyone.
I can do it.
Go ahead.
Let's hear.
So Jar Jar, who was a prequel character,
wakes up after 30 years in cryo sleep.
And it turns out that everything that happened before was a dream
this is all jar jar's dream yeah and then the rest of the movie is um inception like him trying
to explain to all of his friends what happened and as is usual people explaining their dreams
is extremely exciting so i'm looking forward to seeing them.
Let's move on.
All right.
You know from last year, they all know you're a huge Star Wars nerd.
Sure.
All right.
I say that like you're the only one. Like I'm not the one that was wearing BB-8 accessories. I saw in, I believe, London,
but definitely that island where London is located.
He asked us for advice.
He's doing an embedded systems course with computer vision.
He's having a ball, and he wants a job in Silicon Valley
and wondered how that can happen.
People keep asking us this like we've gotten jobs recently.
I think that if you are not a U.S. citizen
and you want to work in Silicon Valley,
higher education is the way to go.
Either that or a big, big company who can sponsor you.
Yeah.
It's not that easy and it's gotten more difficult. Yeah, It's not that easy. No. And it's gotten more difficult.
Yeah, there's the H-1B path or there's come to university.
Yeah.
Oh, well, there is the international exchange program.
Spend a year going to uni here.
Right.
Yeah.
Stuart found the JY901.
It is an InvenSense MPU6050, which is an inertial sensor and a small micro.
And it's all put together on a board.
And it's got sensor fusion, serial output.
And it was sort of cool.
Its manual and getting started guide are on Scribd.
Why Scribd where you have to pay for it,
but you can actually read it there.
You just can't download the PDFs.
Yeah, it was sort of cool, but those...
So wait a minute.
Those manuals were...
It's an actual MPU-6050 or is it knockoff?
It's translated. It... It's an actual MPU6050 or is it knockoff?
It seemed to be an actual.
From InvenSense?
From InvenSense.
Why is it all in Chinese?
I think because the micro and sensor fusion manufacturer is Chinese.
And that's who they want their market to be.
So you get that thing and the $20 Linux board and you're done.
Yeah, you can rule the world with those.
Depressing.
A little bit.
It's kind of like having your job replaced by robots.
In one way, it's very exciting because robots, but then no job.
A part's less exciting I gave away
Wendell's book
I gave it to
Jonathan in Zimbabwe
we have listeners
in Zimbabwe
we do
we have a couple
in South Africa
and other African
countries
it's pretty cool
Zimbabwe
so it's just
much more fun to say
it is
I liked Jonathan's story best
of the ones i received all right let's hear it um all right okay it's sort of long it is
he said that he had lots of options there was the time he packed a rocket with fast gunpowder
instead of the nice slow burning mix the time he ground the flash powder a little too enthusiastically
and filled his room with smoke.
And the exploding
paste incident. Don't ask.
I really want to ask. I know.
The time he used
old hydrated ammonium nitrate
to mix with zinc.
Burns
when exposed to water.
Whole lab to be evacuated. Again. My favorite chemicals are the ones that burn when exposed to water. The whole lab to be evacuated again.
My favorite chemicals are the ones that burn when exposed to water.
Homemade rockets, pyromania, unsympathetic cops.
But actually what he submitted, not any of those,
he submitted his all-time favorite experiment. What you do when you start out,
you squish some strawberries in a sandwich bag with some water, salt, and dish soap.
And I've heard this also works with bananas, so it should be able to work wherever you are.
You filter the mixture in a glass. By tilting the glass and gently pouring rubbing alcohol or drinking any high concentrated alcohol, you get two layers of liquid.
The top is clear.
The bottom is the strawberry goo or banana goo.
And then you watch a stringy white stuff float into the clear layer.
You can pick up the stringy white stuff with a toothpick and play with it. And what is it?
It is DNA. It's the actual DNA strands.
So, yeah. You want to show somebody your DNA?
No, show somebody a strawberry's DNA? Then you
can. I think he will do well
with Wendell's Build It Yourself Science Laboratory book.
Frighteningly well.
But why?
Why does that work?
I don't know.
I bet you could figure that out if you wanted to.
No, I just want to be told.
Ah, well, there's alcohol and filtration and DNA.
DNA floats in alcohol.
Great.
Thank you to the rest of you who sent me stories along with your entries.
They were excellent stories.
I quite enjoyed them.
Jonathan's story was my favorite, but he won because Chris chose his Excel number,
not because it was my favorite.
And that actually covers my list.
What else do you want to talk about?
Really?
I thought there was something else on here.
There used to be more on here, but, you know.
You removed it?
There's some Arduino thing.
Arduino to SparkFun thing.
Oh, see, I just flipped around too much.
That was about mice, feeding mice.
Feeding mice.
I had a client come.
I talked a little bit on Element 13 about feeding mice
and trying to get to low power systems from a standard Arduino.
And the secret there was to go to Arduino Pro because it removed the USB chip.
And so you didn't have to power it all the time.
And that was just huge savings.
But there was still a lot of things sucking up power.
And they wanted to be able to monitor the mice feeding online.
And so I looked around and ended up with this
SparkFun thing because it was cheap and it was ESP8266 based, which I'm pretty amused by.
The project still had the requirement that a motivated high school student should be able
to build it. So I couldn't get too complicated. I ended up still using the Arduino IDE for the code and buying all of my parts off the shelf and
Adafruit Boost and only modifying small things. But it was pretty miraculous. The Arduino version,
which I did power optimize, lasted a week. Most of the power was used by the motor subsystem when it was on, and then when sleeping, the
Arduino doesn't sleep as low as it could, and the pellets are found by optical diode.
So having that diode on all the time meant it was sucking power.
That power is still in the new system, but that's about it.
Everything else is down into micros, low microamps.
So, yeah, now it lasts for 30 days.
They're happy.
See?
Even if it was Linux, you'd still have to figure stuff like that out.
Yes.
Yes, indeed.
So yeah,
that was my Arduino
to SparkFun story,
or SparkFun thing story.
And then at SuperCon,
I helped out
at the SparkFun thing
workshop because I'm like,
oh, I've used one.
I can totally help you.
But it turned out
most of the problems had to do with installing Arduino and then installing all the SparkFun things on
top of the base Arduino. I really wasn't very good at that. There was that one person who,
I apologize if you actually listened to the show, but yeah, I suggested, after I suggested he
reinstall the driver and then I suggested he close and restart Arduino, and then I just gave up and said I suggested he reinstall his Microsoft operating system.
It's always a good thing to do.
I don't know.
Reinstall it with something other than that.
That was maybe not helpful.
Alrighty then.
Well, should we wrap up for Thanksgiving?
Happy Thanksgiving, everyone.
Yes.
If you're based in the U.S., this weekend will be a long one.
And you can shop.
And remember, if you want to buy a Glowforge, you can still use our link.
And to the person who actually did, thank you.
All right.
All right. All right.
I think we'll call it.
Call it what?
Call it done.
Okay.
Thank you for chatting with me, Christopher.
And for producing the show.
And for unpacking your whole studio.
It looks wonderful.
And thank you all for listening.
I don't know that we're going to do mushy Thanksgiving things this year,
but I am thankful for where the podcast is and all that it's done.
So my final thought this week will come from Epicurious.
Do not spoil what you have by desiring what you have not.
Remember that what you now have was once among the things you only hoped for.
That was harder to read than I expected.
All right, Embedded FM is an independently produced radio show that focuses on the many aspects of engineering.
It is a production of Logical Elegance, an embedded software consulting company in California.
If there are advertisements in the show, we did not put them there and do not receive
any revenue from them. At this time, our sole sponsor remains Logical Elegance.
Bye.
Bye.