Professional Documents
Culture Documents
Architecture Design
Scope of Architecture Design:
defines the SW Components of the system, their interfaces and interaction, communication between components
define a layer structure
Views of Architecture
Functional Architecture and Physical Architecture (Diagrams: UML, Use Case, Component, Interaction, State)
Specific SW Architecture Activities
Impact Factors
Available resources, requested performance, functional safety issues, reuse, maintainability
Razvan Ardelean
Architecture Design
SW Architecture Concepts: Layering
Architecture
building blocks of the system, their interfaces, interactions, global concepts involving more components
Detailed Design
realization of the internals of the building blocks, describes the detailed interfaces for each component
Razvan Ardelean
Detailed Design
Common steps
Analyze the architectural description to understand the context of the SW component under design
Analyze SW component specific requirements
Identify additional functions from the relevant function area and are not necessarily covered by the requirements
Deal with complexity (if SW component complexity is high, divide in several SW subcomponents)
Consider reuse of SW-components (already tested, save time)
Define Quality criteria prioritization (memory consumption, CPU load, maintainability, reusability)
Decision for structured design or object oriented design
Structured Design
perform functional decomposition (support encapsulation, minimize dependencies, maintainability, testability)
static view by static function tree (function call overview)
design the functions behavior (consider design rules, maximum complexity)
categories of interfaces: global data, interface busses (CAN, LIN, SPI), services (callback functions)
traceability from the detailed SW design to the SW architecture description and requirements specification
Razvan Ardelean
Detailed Design
Mapping to the file structure
For each detailed SW design at least one source code file is required
Each source code file refers to exactly one SWDD
Macros
sometimes are necessary: reduce stack overhead, provide variability at compile-time, performance and ROM
size, define constants
Module global variables
respect naming convention and standardized types
where shared variables can not be avoided, a risk analysis is mandatory (protection needed?)
Function description and dynamic behavior
dynamic behavior - the principle workflow of a function and the relation between input and output parameters
for each function: signature, return value, list of parameters, description, precondition, post condition
Multitasking specific
reentrance and task safety, initialization of data, identify critical sections, shared variables analysis
Razvan Ardelean
Embedded software
The application is in close connection with the electronics or hardware
The target is a microcontroller specific for a functionality, not a PC with a general purpose processor
Inputs and outputs are signals, communication busses CAN, LIN, SPI
The application may be reused from one microcontroller to another (code according to ANSI C standard)
Special care for CPU load (execution time is critical)
Response time to signals is very important (real time response)
Power management is important for battery powered devices (transition low power - high power)
Why C language?
Portability
Code shall be efficient (real time)
Code shall be small (generated executable is small)
Hardware interfaces (direct access by addressing)
A compiler is available for every microcontroller
Razvan Ardelean
Embedded software
Layering: Platform (HW dependent: scheduler, drivers) and Application (less HW dependent)
Define common types in platform, for portability we cannot relay on standard data types of the C language
Awareness of endian-nes: big/little endian (avoid unions for portability)
Special keywords:
volatile - prevents compiler optimizations (mandatory to be used for shared variables)
register - try to keep that variable in a CPU register (forces compiler optimizations)
static - used for a global variable, for a function, for a local variable
inline - the code of the function is inserted at the caller point instead of using the stack overhead
const - declare that a variable or a function parameter is constant
Bit manipulation: RAM space is small, every bit can be used (implementation: structure with bitfields)
Write efficient code: binary math (shift), avoid complex addressing and unsafe pointer arithmetic
Awareness of stack consumption: parameters and local variables
Keep the functions simple: no more than 100 ELOC, cyclomatic complexity smaller than 15
Razvan Ardelean
Razvan Ardelean
Razvan Ardelean