Board Building: Eric Weddington, Atmel

Board Building: Eric Weddington, Atmel

Hi, this is Wayne again with a topic “Board Building: Eric Weddington, Atmel”.
Hi everyone, my name, is eric weddington, i’m the marketing manager for open source and communities at atmel. If you don’t know what we do already we’re the makers of the processors that are all that are on the arduino boards. My background is in software engineering, though, even though i may have a marketing title after my name, so i’ve been doing software for about 20 years. Most of that time has been software on embedded systems. It’S the firmware that goes on the chips, so i have a little bit of a different perspective than massimo or some of the other ones that are building boards out there, and i have a confession to make.

I have a secret that i like to share. I’Ve worked with a lot of hardware engineers, and invariably they come to me with their latest creation and they go eric eric eric. He got to check out this board. It’S got this new, you know abc xyz 2000 chip on there check it out and at this point is when i feel like i’m in sort of some highly stylized ritual.

Oh yes, i see oh yeah. Oh yes, you’re right! It is an abc xyz. 2000 chip on there, i see you um, but you know in the back of my mind, i’m always thinking it’s a black square on a board. What can i do with it? I’M a software engineer.

You know it’s the software. I think it’s a software that really kind of animates the whole yeah. If we can get it working, it’s a software that animates the whole thing there.

Board Building: Eric Weddington, Atmel

We go it’s alive, but really what this also points out is that there is this kind of complementary disciplines of software and hardware. That really makes everything happen. You know, hardware in a lot of ways is easy to design, there’s always exceptions to the rule. Software is a lot more complicated. It’S really easy to put together four lines and you know there’s your communication system, but you know it’s a software that actually makes everything happen.

Board Building: Eric Weddington, Atmel

That’S where the complexity resides for hardware, you incur a cost every time you manufacture it to reproduce it and software your cost is all up front. It’S next to nothing to reproduce. So really we have these two kind of complementary systems. So what i’d like to talk about is from the firmware side of things.

Board Building: Eric Weddington, Atmel

A lot of people will talk about the boards and you know how to go build them, and you know what you have to think about, but really what i’m going to talk about is how the software affects this. So, in the short amount of time i was trying to think of you know what are some principles. What are some kind of guiding thoughts, and the first one is premature. Optimization is the root of all evil, so i’m in colorado and some colleagues of mine tried to get me to they wanted me to go to the embedded systems. Uh meetup group in colorado springs and in there there was this uh these two guys. They were putting together a project they wanted to photograph lightning, and you know it has certain requirements.

You have to measure the light with a light sensor and be able to trigger the camera in enough time to capture the lightning and they used an arduino board to do the whole thing and it was fantastic. They demonstrated it and showed that, yes, you know they can, they can go, take pictures of lightning and then they showed the code up on the screen. You know arduino code and in the loop they were essentially taking some samples of from the light sensor and they were averaging them and they were doing the 256 values and adding them all up. And then you know doing the division and and then about two to three hands shot up out in the audience and the guys out there you know holding their hands up they’re going. Oh that is so inefficient.

I mean. Don’T you know how to do a moving average, and you know that would be so much faster to do it that way and the guys came back and they said it works. They didn’t need to go, do a moving average and make it as tight as possible, and that right there is the key when you’re at a prototyping stage. You don’t need to do the optimization.

Your whole point is to try to get your product up and going as quickly as possible, making sure it all works. But then there are times where you do want to optimize your code. If we can get this working all right. So when should you optimize your code when you move out of the prototyping stage, obviously you want to optimize your code to meet system requirements and constraints. Obviously, you may have timing issues that you have to work on or space issues, or you know you have to do things to your code for quality reasons, but something that a lot of people don’t really think about. Is that there’s a possible economic benefit for optimizing? Your code and what you have to do is you have to think in terms of scale we’re having a winner here, hello.

They have a finger raised, hold on just a minute. There we go scale, okay, very good. Okay, so you have to think in terms of scale and the companies that know how to think about scale are semiconductor manufacturers.

I’Ve worked for one if you’re billing, if you’re building a billion dollar fab, you learn very quickly to think about how to pay for it. So when you’re going from a prototype and you’re going to making your your professional product that you want to sell, you have to think in terms of the scale. So let’s go through a kind of a thought process here. Why would you want to think about scale? Let’S do the math okay, why would you want to spend a hundred thousand dollars on engineers and tools to save 100 bytes of code space? I mean it seems like a lot of money for a little bit of effort right, but you know you could go to a smaller chip with less memory that cost 10 cents less.

Now still, it seems like wow you’re spending a lot of money just to save 10 cents on a chip, but if you think in terms of scale, if you sell 10 million units, you’ve now saved a million dollars less your costs, you now save nine hundred thousand Dollars and that’s not chump change, so the next thing you need to know is know your tools. Compiler tool chains are very good, but they’re not perfect need to learn to inspect the assembly code. What is your compiler? What is it outputting? Because you need to know what happens on there, because you know that’s where you’ll find your optimizations one of the things to take a look at are compiler switches in gcc, there’s compiler switches for every single part of the process, and some can make those codes make Your code, smaller in certain ways, you need to know coding, tips and tricks. You know, depending upon what process are you using the compiler and all that, if you’re using a loop variable, maybe you don’t want to index it going from zero to your maximum value? Maybe you want to reverse it because it actually can make smaller code. I found out that switch statements which are used everywhere, like on pc platforms and software for those in embedded systems. You know compilers can generate your code uh for switch statements in about three or four different ways depending upon the heuristics.

That’S involved, so you really don’t have control over how the compiler is going to generate your code. So you want to change the techniques that you use so that way it helps the compiler pick the right path and generate the right code. Knowing your computer language, it’s good to understand how to use bitwise operators. You know another thing, too, is knowing data structures and algorithms.

I mean, if you’re going to code up a menu on an embedded system with a display. You learn very quickly that one of the most efficient ways to do that is to create an array of structures of pointers to functions, even though they may sound scary to you. Certainly there are white papers available. I know that atmel has white papers.

That goes through the various tips and tricks. Also, user forums are available, for example, avr freaks for the avr users and other forums where many users who’ve had a lot of years. Experience optimizing code can go help you so the last thing it’s kind of a little bit different than optimization is open source software licensing. So if you’re going from a prototype and now you’re going to make a product out of this, you find out that if you’re using open source licenses or if you’re, potentially thinking about it for your product, you have to really put some thought into it.

So the the typical disclaimer – i am not a lawyer, so i cannot give legal advice but from a business point of view, there’s a couple of questions that you really want to ask yourself. Do i want my code to be open to everyone? That is a valid question. You have an embedded system, it can be copied can be hacked you know. Perhaps you do want to keep your secret sauce secret.

Maybe you don’t. Maybe it makes business sense for you to create an open source platform to gain those adopters to gain that interaction from the community. Can i use this code without burdens to myself, if i’m taking some code in some library that i’m going to incorporate into my software? Can i use this code without burdens to myself or my customer when i distribute my product, so these two questions right here will inform your choices as to number one. If you want to use an open source license and b what kind of open source license you want to use, there’s a lot of different trade-offs and that’s what you have to balance everything out so again, like i said, the answers are dependent upon the intent of Your project or product so just to wrap up you’re going from a prototype to a product, don’t optimize too soon, if you’re working on your prototype, get it up and working when you go to a product optimize when you’re needed to meet system requirements. But there are possible economic benefits if you start thinking about scale, know your tools, just like your hardware tools out here. You know your your you have these maker spaces and you’re working on uh. You know various hardware things you have to know what your tools are know your software tools that helps you generate your software, and the last thing is that software licenses do matter. Thank you.

.