Title: Microcontrollers, Basics Successful Software Development for MCUs
1Microcontrollers, Basics Successful Software
Development for MCUs
- 18 January 2012
- Jonathan A. Titus
2Anyone Can Program in C!
Sidney Harris
...but that doesnt mean they write GOOD code.
3How 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
4Investigate Model-Based Design
- In the not-so-good old days...
Courtesy of The MathWorks
5Model-Based Design I
Courtesy of The MathWorks
6Model-Based Design II
Courtesy of Texas Instruments
7Create 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
8Clutch-Control Model
Courtesy of The MathWorks
9Vehicle-Control Model
Courtesy of Maplesoft
10Model-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
11Model-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
12Model-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.
13Model-Based Design
- Helpful white papers
- "Adopting Model-Based Design Interactive Kit,"
The MathWorkshttp//www.mathworks.com/programs/te
chkits/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.a
spx. - "Developing Quality Embedded Systems Using
Model-Based Design," The MathWorkshttp//www.gist
l.com/2008/Using_Model_Based_Design.pdf
14Software Development
- If model-based design isnt right for you, what
other approaches can you take? -
- IAR VisualSTATE software
- Statecharts State-machine designs
- Flow-chart models
- DIY techniques?
15IAR VisualSTATE
"Designing a state machine to solve a problem,"
IAR Systems. http//tinyurl.com/7ckyejf
16(No Transcript)
17Statechart Design
"Practical UML Statecharts in C/C," 2nd ed.,
Miro Samek, Newnes-Elsevier, 2009. ISBN
978-0-7506-8706-5.
18Coding 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
19Coding Tools II
- Third-Party Tools
- Atollic
- GreenHills Software
- Hitex
- IAR
- Code-Red Technology
- Keil (ARM)
- HiTech (Microchip)
- Raisonance
- Rowley
- Custom Computer Services
- CodeSourcery (Mentor)
- MikroElektronika
20What 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
21What Should Software Tools Do?
- Simplify tracking projects, files, and revisions
Courtesy of Keil Software
22What Should Software Tools Do?
- Provide a smart color-coding editor
23What Should Software Tools Do?
- Simplify I/O and peripheral setup
Courtesy of Texas Instruments
24What Should Software Tools Do?
- Provide debug and test capabilities
Courtesy of Microchip
25What Should Software Tools Do?
- Quickly connect with program/debug pods
26Take 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
27Good 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.
28Hed
29Hed
30Hed
31Hed
32Hed
33Hed
34Hed
35Hed
36Hed