Logo
  • About

Courses

  • Introduction to Ada
    • Introduction
      • History
      • Ada today
      • Philosophy
      • SPARK
    • Imperative Language
      • Hello world
      • Imperative language - If/Then/Else
      • Imperative language - Loops
        • For loops
        • Bare loops
        • While loops
      • Imperative language - Case statement
      • Imperative language - Declarative regions
      • Imperative language - conditional expressions
        • If expressions
        • Case expressions
    • Subprograms
      • Subprograms
        • Subprogram calls
        • Nested subprograms
        • Function calls
      • Parameter modes
      • Subprogram calls
        • In parameters
        • In out parameters
        • Out parameters
        • Forward declaration of subprograms
      • Renaming
    • Modular Programming
      • Packages
      • Using a package
      • Package body
      • Child packages
        • Child of a child package
        • Multiple children
        • Visibility
      • Renaming
    • Strongly Typed Language
      • What is a type?
      • Integers
        • Operational semantics
      • Unsigned types
      • Enumerations
      • Floating-point types
        • Basic properties
        • Precision of floating-point types
        • Range of floating-point types
      • Strong typing
      • Derived types
      • Subtypes
        • Subtypes as type aliases
    • Records
      • Record type declaration
      • Aggregates
      • Component selection
      • Renaming
    • Arrays
      • Array type declaration
      • Indexing
      • Simpler array declarations
      • Range attribute
      • Unconstrained arrays
      • Predefined array type: String
      • Restrictions
      • Returning unconstrained arrays
      • Declaring arrays (2)
      • Array slices
      • Renaming
    • More About Types
      • Aggregates: A primer
      • Overloading and qualified expressions
      • Character types
    • Access Types
      • Overview
      • Allocation (by type)
      • Dereferencing
      • Other features
      • Mutually recursive types
    • More About Records
      • Dynamically sized record types
      • Records with discriminant
      • Variant records
    • Fixed-Point Types
      • Decimal fixed-point types
      • Ordinary fixed-point types
    • Privacy
      • Basic encapsulation
      • Abstract data types
      • Limited types
      • Child packages & privacy
    • Generics
      • Introduction
      • Formal type declaration
      • Formal object declaration
      • Generic body definition
      • Generic instantiation
      • Generic packages
      • Formal subprograms
      • Example: I/O instances
      • Example: ADTs
      • Example: Swap
      • Example: Reversing
      • Example: Test application
    • Exceptions
      • Exception declaration
      • Raising an exception
      • Handling an exception
      • Predefined exceptions
    • Tasking
      • Tasks
        • Simple task
        • Simple synchronization
        • Delay
        • Synchronization: rendezvous
        • Select loop
        • Cycling tasks
      • Protected objects
        • Simple object
        • Entries
      • Task and protected types
        • Task types
        • Protected types
    • Design by contracts
      • Pre- and postconditions
      • Predicates
      • Type invariants
    • Interfacing With C
      • Multi-language project
      • Type convention
      • Foreign subprograms
        • Calling C subprograms in Ada
        • Calling Ada subprograms in C
      • Foreign variables
        • Using C global variables in Ada
        • Using Ada variables in C
      • Generating bindings
        • Adapting bindings
    • Object Oriented Programming
      • Derived types
      • Tagged types
      • Classwide types
      • Dispatching operations
      • Dot notation
      • Private & Limited
      • Classwide access types
    • Standard Library: Containers
      • Vectors
        • Instantiation
        • Initialization
        • Appending and prepending elements
        • Accessing first and last elements
        • Iterating
        • Finding and changing elements
        • Inserting elements
        • Removing elements
        • Other Operations
      • Sets
        • Initialization and iteration
        • Operations on elements
        • Other Operations
      • Indefinite maps
        • Hashed maps
        • Ordered maps
        • Complexity
    • Standard Library: Dates & Times
      • Date and time handling
        • Delaying using date
      • Real-time
        • Benchmarking
    • Standard Library: Strings
      • String operations
      • Limitation of fixed-length strings
      • Bounded strings
      • Unbounded strings
    • Standard Library: Files & Streams
      • Text I/O
      • Sequential I/O
      • Direct I/O
      • Stream I/O
    • Standard Library: Numerics
      • Elementary Functions
      • Random Number Generation
      • Complex Types
      • Vector and Matrix Manipulation
    • Appendices
      • Appendix A: Generic Formal Types
        • Indefinite version
      • Appendix B: Containers
  • Introduction to SPARK
    • Overview
      • What is it?
      • What do the tools do?
      • Key Tools
      • A trivial example
      • The Programming Language
      • Limitations
        • No side-effects in expressions
        • No aliasing of names
      • Designating SPARK Code
      • Code Examples / Pitfalls
        • Example #1
        • Example #2
        • Example #3
        • Example #4
        • Example #5
        • Example #6
        • Example #7
        • Example #8
        • Example #9
        • Example #10
    • Flow Analysis
      • What does flow analysis do?
      • Errors Detected
        • Uninitialized Variables
        • Ineffective Statements
        • Incorrect Parameter Mode
      • Additional Verifications
        • Global Contracts
        • Depends Contracts
      • Shortcomings
        • Modularity
        • Composite Types
        • Value Dependency
        • Contract Computation
      • Code Examples / Pitfalls
        • Example #1
        • Example #2
        • Example #3
        • Example #4
        • Example #5
        • Example #6
        • Example #7
        • Example #8
        • Example #9
        • Example #10
    • Proof of Program Integrity
      • Runtime Errors
      • Modularity
        • Exceptions
      • Contracts
        • Executable Semantics
        • Additional Assertions and Contracts
      • Debugging Failed Proof Attempts
        • Debugging Errors in Code or Specification
        • Debugging Cases where more Information is Required
        • Debugging Prover Limitations
      • Code Examples / Pitfalls
        • Example #1
        • Example #2
        • Example #3
        • Example #4
        • Example #5
        • Example #6
        • Example #7
        • Example #8
        • Example #9
        • Example #10
    • State Abstraction
      • What's an Abstraction?
      • Why is Abstraction Useful?
      • Abstraction of a Package's State
      • Declaring a State Abstraction
      • Refining an Abstract State
      • Representing Private Variables
      • Additional State
        • Nested Packages
        • Constants that Depend on Variables
      • Subprogram Contracts
        • Global and Depends
        • Preconditions and Postconditions
      • Initialization of Local Variables
      • Code Examples / Pitfalls
        • Example #1
        • Example #2
        • Example #3
        • Example #4
        • Example #5
        • Example #6
        • Example #7
        • Example #8
        • Example #9
        • Example #10
    • Proof of Functional Correctness
      • Beyond Program Integrity
      • Advanced Contracts
        • Ghost Code
        • Ghost Functions
        • Global Ghost Variables
      • Guide Proof
        • Local Ghost Variables
        • Ghost Procedures
        • Handling of Loops
        • Loop Invariants
      • Code Examples / Pitfalls
        • Example #1
        • Example #2
        • Example #3
        • Example #4
        • Example #5
        • Example #6
        • Example #7
        • Example #8
        • Example #9
        • Example #10
  • Introduction to Embedded Systems Programming
    • Introduction
      • So, what will we actually cover?
      • Definitions
      • Down To The Bare Metal
      • The Ada Drivers Library
    • Low Level Programming
      • Separation Principle
      • Guaranteed Level of Support
      • Querying Implementation Limits and Characteristics
      • Querying Representation Choices
      • Specifying Representation
      • Unchecked Programming
      • Data Validity
    • Multi-Language Development
      • General Interfacing
        • Aspect/Pragma Convention
        • Aspect/Pragma Import and Export
        • Aspect/Pragma External_Name and Link_Name
        • Package Interfaces
      • Language-Specific Interfacing
        • Package Interfaces.C
        • Package Interfaces.C.Strings
        • Package Interfaces.C.Pointers
        • Package Interfaces.Fortran
        • Machine Code Insertions (MCI)
      • When Ada Is Not the Main Language
    • Interacting with Devices
      • Non-Memory-Mapped Devices
      • Memory-Mapped Devices
      • Dynamic Address Conversion
      • Address Arithmetic
    • General-Purpose Code Generators
      • Aspect Independent
      • Aspect Volatile
      • Aspect Atomic
      • Aspect Full_Access_Only
    • Handling Interrupts
      • Background
      • Language-Defined Interrupt Model
      • Interrupt Handlers
      • Interrupt Management
      • Associating Handlers With Interrupts
      • Interrupt Priorities
      • Common Design Idioms
        • Parameterizing Handlers
        • Multi-Level Handlers
      • Final Points
    • Conclusion
  • What's New in Ada 2022
    • Introduction
      • References
    • 'Image attribute for any type
      • 'Image attribute for a value
      • 'Image attribute for any type
      • References
    • Redefining the 'Image attribute
      • What's the Root_Buffer_Type?
      • Outdated draft implementation
      • References
    • User-Defined Literals
      • Turn Ada into JavaScript
      • References
    • Advanced Array Aggregates
      • Square brackets
      • Iterated Component Association
      • References
    • Container Aggregates
      • References
    • Delta Aggregates
      • Delta aggregate for records
      • Delta aggregate for arrays
      • References
    • Target Name Symbol (@)
      • Alternatives
      • References
    • Enumeration representation
      • Literal positions
      • Representation values
      • Before Ada 2022
      • References
    • Big Numbers
      • Big Integers
      • Tiny RSA implementation
      • Big Reals
      • References
    • Interfacing C variadic functions
      • References
  • Ada for the C++ or Java Developer
    • Preface
    • Basics
    • Compilation Unit Structure
    • Statements, Declarations, and Control Structures
      • Statements and Declarations
      • Conditions
      • Loops
    • Type System
      • Strong Typing
      • Language-Defined Types
      • Application-Defined Types
      • Type Ranges
      • Generalized Type Contracts: Subtype Predicates
      • Attributes
      • Arrays and Strings
      • Heterogeneous Data Structures
      • Pointers
    • Functions and Procedures
      • General Form
      • Overloading
      • Subprogram Contracts
    • Packages
      • Declaration Protection
      • Hierarchical Packages
      • Using Entities from Packages
    • Classes and Object Oriented Programming
      • Primitive Subprograms
      • Derivation and Dynamic Dispatch
      • Constructors and Destructors
      • Encapsulation
      • Abstract Types and Interfaces
      • Invariants
    • Generics
      • Generic Subprograms
      • Generic Packages
      • Generic Parameters
    • Exceptions
      • Standard Exceptions
      • Custom Exceptions
    • Concurrency
      • Tasks
      • Rendezvous
      • Selective Rendezvous
      • Protected Objects
    • Low Level Programming
      • Representation Clauses
      • Embedded Assembly Code
      • Interfacing with C
    • Conclusion
    • References
  • Ada for the Embedded C Developer
    • Introduction
      • So, what is this Ada thing anyway?
      • Ada — The Technical Details
    • The C Developer's Perspective
      • What we mean by Embedded Software
      • The GNAT Toolchain
      • The GNAT Toolchain for Embedded Targets
      • Hello World in Ada
      • The Ada Syntax
      • Compilation Unit Structure
      • Packages
        • Declaration Protection
        • Hierarchical Packages
        • Using Entities from Packages
      • Statements and Declarations
      • Conditions
      • Loops
      • Type System
        • Strong Typing
        • Language-Defined Types
        • Application-Defined Types
        • Type Ranges
        • Unsigned And Modular Types
        • Attributes
        • Arrays and Strings
        • Heterogeneous Data Structures
        • Pointers
      • Functions and Procedures
        • General Form
        • Overloading
        • Aspects
    • Concurrency and Real-Time
      • Understanding the various options
      • Tasks
      • Rendezvous
      • Selective Rendezvous
      • Protected Objects
      • Ravenscar
    • Writing Ada on Embedded Systems
      • Understanding the Ada Run-Time
      • Low Level Programming
        • Representation Clauses
        • Embedded Assembly Code
      • Interrupt Handling
      • Dealing with Absence of FPU with Fixed Point
      • Volatile and Atomic data
        • Volatile
        • Atomic
      • Interfacing with Devices
        • Size aspect and attribute
        • Register overlays
        • Data streams
      • ARM and svd2ada
    • Enhancing Verification with SPARK and Ada
      • Understanding Exceptions and Dynamic Checks
      • Understanding Dynamic Checks versus Formal Proof
      • Initialization and Correct Data Flow
      • Contract-Based Programming
      • Replacing Defensive Code
      • Proving Absence of Run-Time Errors
      • Proving Abstract Properties
      • Final Comments
    • C to Ada Translation Patterns
      • Naming conventions and casing considerations
      • Manually interfacing C and Ada
      • Building and Debugging mixed language code
      • Automatic interfacing
      • Using Arrays in C interfaces
      • By-value vs. by-reference types
      • Naming and prefixes
      • Pointers
      • Bitwise Operations
      • Mapping Structures to Bit-Fields
        • Overlays vs. Unchecked Conversions
    • Handling Variability and Re-usability
      • Understanding static and dynamic variability
      • Handling variability & reusability statically
        • Genericity
        • Simple derivation
        • Configuration pragma files
        • Configuration packages
      • Handling variability & reusability dynamically
        • Records with discriminants
        • Variant records
        • Object orientation
        • Pointer to subprograms
      • Design by components using dynamic libraries
    • Performance Considerations
      • Overall expectations
      • Switches and optimizations
        • Optimizations levels
        • Inlining
      • Checks and assertions
        • Checks
        • Assertions
      • Dynamic vs. static structures
      • Pointers vs. data copies
        • Function returns
    • Argumentation and Business Perspectives
      • What's the expected ROI of a C to Ada transition?
      • Who is using Ada today?
      • What is the future of the Ada technology?
      • Is the Ada toolset complete?
      • Where can I find Ada or SPARK developers?
      • How to introduce Ada and SPARK in an existing code base?
    • Conclusion
    • Hands-On: Object-Oriented Programming
      • System Overview
      • Non Object-Oriented Approach
        • Starting point in C
        • Initial translation to Ada
        • Improved Ada implementation
      • First Object-Oriented Approach
        • Interfaces
        • Base type
        • Derived types
        • Subprograms from parent
        • Type AB
        • Updated source-code
      • Further Improvements
        • Dispatching calls
        • Dynamic allocation
        • Limited controlled types
        • Updated source-code
  • SPARK Ada for the MISRA C Developer
    • Preface
    • Enforcing Basic Program Consistency
      • Taming Text-Based Inclusion
      • Hardening Link-Time Checking
      • Going Towards Encapsulation
    • Enforcing Basic Syntactic Guarantees
      • Distinguishing Code and Comments
      • Specially Handling Function Parameters and Result
        • Handling the Result of Function Calls
        • Handling Function Parameters
      • Ensuring Control Structures Are Not Abused
        • Preventing the Semicolon Mistake
        • Avoiding Complex Switch Statements
        • Avoiding Complex Loops
        • Avoiding the Dangling Else Issue
    • Enforcing Strong Typing
      • Enforcing Strong Typing for Pointers
        • Pointers Are Not Addresses
        • Pointers Are Not References
        • Pointers Are Not Arrays
        • Pointers Should Be Typed
      • Enforcing Strong Typing for Scalars
        • Restricting Operations on Types
        • Restricting Explicit Conversions
        • Restricting Implicit Conversions
    • Initializing Data Before Use
      • Detecting Reads of Uninitialized Data
      • Detecting Partial or Redundant Initialization of Arrays and Structures
    • Controlling Side Effects
      • Preventing Undefined Behavior
      • Reducing Programmer Confusion
      • Side Effects and SPARK
    • Detecting Undefined Behavior
      • Preventing Undefined Behavior in SPARK
      • Proof of Absence of Run-Time Errors in SPARK
    • Detecting Unreachable Code and Dead Code
    • Conclusion
    • References
      • About MISRA C
      • About SPARK
      • About MISRA C and SPARK
  • Introduction to GNAT Toolchain
    • GNAT Community
      • Installation
      • Basic commands
      • Compiler warnings
        • -gnatwa switch and warning suppression
        • Style checking
    • GPRbuild
      • Basic commands
      • Project files
        • Basic structure
        • Customization
      • Project dependencies
        • Simple dependency
        • Dependencies to dynamic libraries
      • Configuration pragma files
      • Configuration packages
    • GNAT Studio
      • Start-up
        • Windows
        • Linux
      • Creating projects
      • Building
      • Debugging
        • Debug information
        • Improving main application
        • Debugging the application
      • Formal verification
    • GNAT Tools
      • gnatchop
      • gnatprep
      • gnatmem
      • gnatmetric
      • gnatdoc
      • gnatpp
      • gnatstub

Labs

  • Introduction to Ada: Laboratories
    • Imperative Language
      • Hello World
      • Greetings
      • Positive Or Negative
      • Numbers
    • Subprograms
      • Subtract procedure
      • Subtract function
      • Equality function
      • States
      • States #2
      • States #3
      • States #4
    • Modular Programming
      • Months
      • Operations
    • Strongly Typed Language
      • Colors
      • Integers
      • Temperatures
    • Records
      • Directions
      • Colors
      • Inventory
    • Arrays
      • Constrained Array
      • Colors: Lookup-Table
      • Unconstrained Array
      • Product info
      • String_10
      • List of Names
    • More About Types
      • Aggregate Initialization
      • Versioning
      • Simple todo list
      • Price list
    • Privacy
      • Directions
      • Limited Strings
      • Bonus exercise
        • Colors
        • List of Names
        • Price List
    • Generics
      • Display Array
      • Average of Array of Float
      • Average of Array of Any Type
      • Generic list
    • Exceptions
      • Uninitialized Value
      • Numerical Exception
      • Re-raising Exceptions
    • Tasking
      • Display Service
      • Event Manager
      • Generic Protected Queue
    • Design by contracts
      • Price Range
      • Pythagorean Theorem: Predicate
      • Pythagorean Theorem: Precondition
      • Pythagorean Theorem: Postcondition
      • Pythagorean Theorem: Type Invariant
      • Primary Color
    • Object Oriented Programming
      • Simple type extension
      • Online Store
    • Standard Library: Containers
      • Simple todo list
      • List of unique integers
    • Standard Library: Dates & Times
      • Holocene calendar
      • List of events
    • Standard Library: Strings
      • Concatenation
      • List of events
    • Standard Library: Numerics
      • Decibel Factor
      • Root-Mean-Square
      • Rotation
    • Solutions
      • Imperative Language
        • Hello World
        • Greetings
        • Positive Or Negative
        • Numbers
      • Subprograms
        • Subtract Procedure
        • Subtract Function
        • Equality function
        • States
        • States #2
        • States #3
        • States #4
      • Modular Programming
        • Months
        • Operations
      • Strongly typed language
        • Colors
        • Integers
        • Temperatures
      • Records
        • Directions
        • Colors
        • Inventory
      • Arrays
        • Constrained Array
        • Colors: Lookup-Table
        • Unconstrained Array
        • Product info
        • String_10
        • List of Names
      • More About Types
        • Aggregate Initialization
        • Versioning
        • Simple todo list
        • Price list
      • Privacy
        • Directions
        • Limited Strings
      • Generics
        • Display Array
        • Average of Array of Float
        • Average of Array of Any Type
        • Generic list
      • Exceptions
        • Uninitialized Value
        • Numerical Exception
        • Re-raising Exceptions
      • Tasking
        • Display Service
        • Event Manager
        • Generic Protected Queue
      • Design by contracts
        • Price Range
        • Pythagorean Theorem: Predicate
        • Pythagorean Theorem: Precondition
        • Pythagorean Theorem: Postcondition
        • Pythagorean Theorem: Type Invariant
        • Primary Colors
      • Object-oriented programming
        • Simple type extension
        • Online Store
      • Standard library: Containers
        • Simple todo list
        • List of unique integers
      • Standard library: Dates & Times
        • Holocene calendar
        • List of events
      • Standard library: Strings
        • Concatenation
        • List of events
      • Standard library: Numerics
        • Decibel Factor
        • Root-Mean-Square
        • Rotation
  • Bug Free Coding
    • Let's Build a Stack
      • Background
      • Input Format
      • Constraints
      • Output Format
      • Sample Input
      • Sample Output
Logo

Introduction to Embedded Systems Programming

This course will teach you the basics of the Embedded Systems Programming using Ada.

This document was written by Patrick Rogers, with review by Stephen Baird, Tucker Taft, Filip Gajowniczek, and Gustavo A. Hoffmann.

Download PDF Download EPUB

Contents:

  • Introduction
    • So, what will we actually cover?
    • Definitions
    • Down To The Bare Metal
    • The Ada Drivers Library
  • Low Level Programming
    • Separation Principle
    • Guaranteed Level of Support
    • Querying Implementation Limits and Characteristics
    • Querying Representation Choices
    • Specifying Representation
    • Unchecked Programming
    • Data Validity
  • Multi-Language Development
    • General Interfacing
      • Aspect/Pragma Convention
      • Aspect/Pragma Import and Export
      • Aspect/Pragma External_Name and Link_Name
      • Package Interfaces
    • Language-Specific Interfacing
      • Package Interfaces.C
      • Package Interfaces.C.Strings
      • Package Interfaces.C.Pointers
      • Package Interfaces.Fortran
      • Machine Code Insertions (MCI)
    • When Ada Is Not the Main Language
  • Interacting with Devices
    • Non-Memory-Mapped Devices
    • Memory-Mapped Devices
    • Dynamic Address Conversion
    • Address Arithmetic
  • General-Purpose Code Generators
    • Aspect Independent
    • Aspect Volatile
    • Aspect Atomic
    • Aspect Full_Access_Only
  • Handling Interrupts
    • Background
    • Language-Defined Interrupt Model
    • Interrupt Handlers
    • Interrupt Management
    • Associating Handlers With Interrupts
    • Interrupt Priorities
    • Common Design Idioms
      • Parameterizing Handlers
      • Multi-Level Handlers
    • Final Points
  • Conclusion

Copyright © 2023 AdaCore. All rights reserved.    Creative Commons License
Legal   |   Privacy Policy   |   Report an Issue