Microcontrollers, Basics Successful Software Development for MCUs 18 January 2012 Jonathan A. Titus
Anyone Can Program in C! Sidney Harris ...but that doesn’t mean they write GOOD code.
How Do You Start a Software Project? You must have a clear objective! Describe system architecture and behavior Simple projects: 1- to 5-person team Complex project: several teams Hardware engineers Software engineers Mechatronics engineers Sensor experts Graphical-user-interface designers
Investigate Model-Based Design In the “not-so-good” old days... Courtesy of The MathWorks
Model-Based Design I Courtesy of The MathWorks
Model-Based Design II Courtesy of Texas Instruments
Create an Executable Model Use modeling and simulation tools: MATLAB and Simulink: MathWorks www.mathworks.com LabVIEW and MatrixX: National Instruments www.ni.com Maple and MapleSim: Maplesoft www.maplesoft.com
Clutch-Control Model Courtesy of The MathWorks
Vehicle-Control Model Courtesy of Maplesoft
Model-Based Design Benefits Everything traces back to requirements Teams work with the same information Data flows up and down No prototypes needed to begin Tools can produce known-good code VHDL, Verilog, C, C++ Program MCUs and FPGAs
Model-Based Design Problems Large commitment of time and money Requires commitment to a new design discipline Needs a team “evangelist” Difficult to convince teams to use new tools
Model-Based Design "Driving Technical Change: Why People on Your Team Don't Act on Good Ideas and How to Convince Them They Should," by Terrence Ryan, The Pragmatic Programmers, 2010. ISBN: 978-1-93435-660-9.
Model-Based Design Helpful white papers: "Adopting Model-Based Design Interactive Kit," The MathWorks http://www.mathworks.com/programs/techkits/techkit_adopting_mbd.html. "Shortening the Embedded Design Cycle with Model-Based Design," National Instruments http://zone.ni.com/devzone/cda/tut/p/id/4074. "High-Performance Physical Modeling and Simulation," MapleSoft http://www.maplesoft.com/products/maplesim/index.aspx. "Developing Quality Embedded Systems Using Model-Based Design," The MathWorks http://www.gistl.com/2008/Using_Model_Based_Design.pdf
Software Development If model-based design isn’t right for you, what other approaches can you take? IAR VisualSTATE software Statecharts: State-machine designs Flow-chart models DIY techniques?
IAR VisualSTATE "Designing a state machine to solve a problem," IAR Systems. http://tinyurl.com/7ckyejf
Statechart Design "Practical UML Statecharts in C/C++," 2nd ed., Miro Samek, Newnes-Elsevier, 2009. ISBN: 978-0-7506-8706-5.
Coding Tools I MCUs have an associated C/C++ compiler MCU vendors supply software tools: Microchip -- MPLAB X Texas Instruments -- Code Composer Studio Freescale -- CodeWarrior Renesas -- High-Performance Embedded Workbench Rabbit Semiconductor -- Dynamic C Vendor tools “close to the chips” Try free or limited versions before you buy
Coding Tools II Third-Party Tools Atollic Custom Computer Services GreenHills Software Hitex IAR Code-Red Technology Keil (ARM) HiTech (Microchip) Raisonance Rowley Custom Computer Services CodeSourcery (Mentor) MikroElektronika
What Should Software Tools Do? Compile C, C++, and assembly-language Easily mix C/C++ and in-line assembly code Simplify tracking projects, files, and revisions Provide a “smart” color-coding editor Simplify I/O and peripheral setup Provide debug and test capabilities Quickly connect with program/debug pods Link to latest documents and manuals
What Should Software Tools Do? Simplify tracking projects, files, and revisions Courtesy of Keil Software
What Should Software Tools Do? Provide a “smart” color-coding editor
What Should Software Tools Do? Simplify I/O and peripheral setup Courtesy of Texas Instruments
What Should Software Tools Do? Provide debug and test capabilities Courtesy of Microchip
What Should Software Tools Do? Quickly connect with program/debug pods
Take Advantage of Other Resources Use dev kits as “golden platforms” for code tests Adopt a consistent coding style: Google C++ Style Guide If you are new to MCUs, start with a small board Arduino Uno, Digilent Uno32, ARM mbed Use vendor code libraries Visit and join MCU-user and MCU-software forums Embedded Systems Conference (ESC) 26 through 29 March 2012, San Jose, CA, USA
Good Embedded-System Books "Test-Driven Development for Embedded C," James W. Grenning, The Pragmatic Programmers, 2011. ISBN: 978- 1-93435-662-3. "Automated Defect Prevention: Best Practices in Software Management," by Dorota Huizinga and Adam Kolawa, Wiley Interscience, 2007. ISBN: 978-0-470-04212-0. "The Art of Designing Embedded Systems," 2nd ed., by Jack Ganssle, Newnes, 2008. ISBN: 978-0-7506-8644-0. "The Firmware Handbook," Jack Ganssle, ed., Newnes, 2004. ISBN: 978-0-7506-7606-9.
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed
Hed Text Bullets If Needed