Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Embedded Software Architecture and Design

Similar presentations


Presentation on theme: "An Introduction to Embedded Software Architecture and Design"— Presentation transcript:

1 An Introduction to Embedded Software Architecture and Design
Class 4: From Architecture to Implementation December 4, 2014 Jacob Beningo, CSDP

2 Course Overview Introduction to Embedded Software Architecture
Software Architecture using UML Understanding Embedded Software Architectures From Architecture to Implementation Software Architecture of a UAV and Review

3 Session Overview Review of the Example Problem Architecture to Design
Design to Implementation Tips and Tricks

4 An Example Problem Review
Remote firmware updates System requires periodic firmware updates in the field without the use of specialized hardware Must blink an led in this mode Seamless ability to switch between app and update mode System requires the ability to be updated via UART simulates radio connectivity

5 Architecture to Design
Software Architecture Provides us different views of software in regards to User interactions with the system Environmental conditions Timing System states Etc Relate to requirements of the system Does NOT provide low level details

6 Architecture to Design

7 Architecture to Design
What is included in the design phase? Detailed planning of the software to the lowest levels! Such as ….. Flowcharting Function definitions Variable naming Task declarations API’s

8 Architecture to Design
Flow Charts Most common design element Consists of Entry point Conditionals Actions Exit point Keep them simple! Highlight enum and const

9 Architecture to Design
Flowcharting of the boot-loader

10 Architecture to Design
API’s Critical to creating reusable software Defines a common interface that can be used from one project to the next Identifies useful peripheral features If adhered to code can be reused and ported with ease Examples include ….

11 Architecture to Design
API’s continued Digital Input / Output API’s EEPROM

12 Architecture to Design
Operating System Selection What did the architecture dictate? Polling Interrupt Driven (Event-driven) Cooperative Scheduling Real-time Operating System Hybrid systems

13 Architecture to Design
Coding Standards Design stage is the perfect time to pick a coding standard! Sets the tone for how the firmware should look and feel Sets the do’s and don’t Sets the best practices to follow Hopefully verifiable by tools

14 Design to Implementation
Implementation is easy! Architecture for the general roadmap Design for the detailed flowcharts and layout What could possibly go wrong?

15 Design to Implementation
Bootloader Implementation // When the checksum has completed and the timer has expired for waiting for a // programming tool to respond, perform the branch checks. if((Checksum_Complete == TRUE) && (StartUpTmr == EXPIRED)) { if((*ResetVector != 0xFFFF) && // Does app reset vector exist? (Status != 'B') && // EEPROM status set? (Boot_ToolPresent != TRUE) && // Tool present? (Checksum_Valid != FALSE)) // Checksum valid? App_LoadImage(); } else Boot_LoadImage();

16 Design to Implementation
Tip #1 Limit Function Complexity Cyclomatic Complexity Kolmogorov complexity Function points

17 Design to Implementation
Tip #2 – Use Assertions

18 Design to Implementation
Tip #3 – Document Code Thoroughly Function Inputs Function Outputs Function use and behavior Related Functions Plenty of comments on what it does Maintainers and future self will thank you Use tools like Doxygen to generate documentation from code comments

19 Design to Implementation
Tip #4 – Avoid the use of Global Variables Encapsulate variables Use data hiding Object oriented design Prevents data corruption Reduces reentrancy issues Use static to declare local variables Use static to declare private functions

20 Design to Implementation
Tip #5 – Use Descriptive Naming Conventions Don’t use abbreviations but the whole descriptive word! If you use abbreviations then create a lookup table Call it what it is and don’t be cryptic! (Use long variable names) Use broad terms first then get specific Choose naming conventions and be consistent! Develop a coding standard to keep track of your conventions so that future you or maintainer can understand

21 Additional Resources Download Course Material for Edraw UML Templates
Updated C Doxygen Templates Misc Papers and Websites for further reading From under - Blog and Articles > Software Techniques > CEC Software Architecture Materials

22 Jacob Beningo Newsletters P.O. Box 400 Embedded Monthly
Linden, Michigan 48451 Newsletters Embedded Monthly Low Power Design Training Bootloaders Embedded Software C/C++ : : : Jacob_Beningo : Beningo Engineering : JacobBeningo : Embedded Basics Jacob Beningo Principal Consultant


Download ppt "An Introduction to Embedded Software Architecture and Design"

Similar presentations


Ads by Google