TLA+

TLA+ is a formal specification language that is used for modeling the behavior of systems and algorithms, especially distributed and concurrent systems.

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Embedded Swift

8 May 2024 by Phillip JohnstonSwift is one of the newest languages to enter the embedded space thanks to a new, experimental compilation mode. You can now use Swift to target ARM and RISC-V microcontrollers. This new compilation mode disables certain language features, like runtime reflection and ABI stability to produce standalone, statically linked binaries that can be run on a microcontroller. While this mode requires disabling certain language features, the aim is to not make it a separate Swift dialect, but to rather be a subset that feels very close to the “full” Swift language. For now, Embedded Swift …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Python

Python is a widely used general-purpose scripting language.

Table of Contents:

  1. Resources
  2. On Embedded Artistry

Resources

  1. Learning Python
  2. Advanced
  3. Style Guides
  4. Quality Enforcement

Learning Python

Advanced

Style Guides

Quality Enforcement

  • Linters are tools for finding potential bugs and style problems in Python source code. They find problems that are typically caught by a compiler for less dynamic languages like C and C++.
  • Black is a Python formatter
  • Type Checking
    • Mypy is a static type checker for Python that aims to add compile-time type checking with no runtime overhead.

On Embedded Artistry

libc

The C standard library is commonly known as “libc”. This library provides the macros, types, and function implementations for the C programming language.

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Markdown

5 November 2019 by Phillip Johnston • Last updated 9 June 2021Markdown is a lightweight markup language with plain text formatting syntax. Its design allows it to be converted to many output formats. Markdown is often used to format in-source documentation (e.g., a README). There are many different flavors of Markdown, each using a common core specification but adding additional features of their own. Table of Contents: Specifications Learning Markdown Specifications John Gruber’s Markdown page discusses the original flavor CommonMark is a proposal for a standard, unambiguous Markdown syntax specification GitHub Flavored Markdown Spec describes the dialect of Markdown supported …

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Ada

Ada is a statically-typed, imperative, object-oriented programming language. Ada’s design philosophy is to favor compile-time errors over run-time errors. It is primarily used to develop safety critical systems.

To access this content, you must purchase a Membership - check out the different options here. If you're a member, log in.

Rust

Rust is a systems programming language that places an emphasis on memory and concurrency safety. Because of these factors, it is gaining traction in the embedded community.

Table of Contents:

  1. Books
  2. From Around the Web
    1. Learning Rust
    2. Code Analysis
    3. Rust for Embedded
    4. Safety-Critical Rust
    5. Rust Patterns
    6. Mixing Languages

Books

From Around the Web

Learning Rust

Code Analysis

Rust for Embedded

Safety-Critical Rust

Ferrous Systems has been working on qualifying Rust for safety-critical system development with its Ferrocene toolchain.

Rust Patterns

Mixing Languages

C

C is a general-purpose imperative programming language widely used for embedded systems development.

Table of Contents:

  1. From Around the Web
    1. Beginners
    2. Standard Library
    3. Pointers
    4. Variadic Functions
    5. Volatile
    6. Security & Safety
    7. Undefined Behavior
    8. C11
    9. References
  2. Tools
  3. Advanced Techniques
    1. Bitwise Operations
  4. Exceptions
  5. Objects in C
  6. Information Hiding in C
  7. Polymorphism and Inheritance in C
  8. From Embedded Artistry
  9. Recommended C Libraries

From Around the Web

Beginners

The classic introductory recommendation for programming in C is Brian W. Kernighan and Dennis M. Ritchie’s The C Programming Language.

If you prefer more of a course-based approach, Learn Code the Hard Way has a Learn C the Hard Waycourse. We recommend this course because it provides hands-on demos and examples.

An excellent C crash course can be found on Embedded.fm in the Embedded Wednedsays series:

The following Embedded.fm articles can be used to build upon your new C knowledge:

The Atoms of Confusion website provides information on making confusing code constructs more understandable. Review these common C confusion points to improve your programming abilities. Avoid unclear constructs whenever you’re able to.

For an in-depth test of your C knowledge, try figuring out the Bad C Analysis interview question.

Standard Library

The C standard library is commonly called libc, and occasionally stdlib or cstdlib.

For more information and relevant links, see the dedicated glossary entry.

Articles related to standard library evolution:

Pointers

Pointers are the foundation of C, yet many developers are intimidated by them. These resources will help you better understand pointers.

Variadic Functions

Volatile

Embedded developers will defend their beloved volatile keyword to the death. Make sure you understand what the keyword actually does under the hood!

If in doubt, do not declare a variable volatile. Instead, cast it to volatile in the particular spot where you want to suppress optimizations.

Security & Safety

MITRE outlines common weaknesses found in software written in C. Familiarize yourself with these common security flaws to improve your programming abilities.

No, strncpy() is not a “safer” strcpy() points out the weaknesses with strncpy().

Secure Coding in C and C++ (2nd Edition) (SEI Series in Software Engineering)

Microsoft is working on Checked C, a language extension project that adds static and dynamic (runtime) checking for common errors such as buffer overruns, out-of-bounds memory accesses, and incorrect type casts.

For C coding standards with a focus on safety and security, see:

Undefined Behavior

Undefined behavior abounds in the C programming language, and programmers easily trip over it. Here are some resources to improve your knowledge on undefined behavior:

C11

References

Tools

Advanced Techniques

The following advanced techniques are reviewed below:

  1. Bitwise Operations
  2. Exceptions
  3. Information Hiding in C
  4. Objects in C
  5. Interitance in C

Bitwise Operations

The best resource for bit manipulation routines is Bit Twiddling Hacks. This code is in the public domain and is used in a variety of projects I’ve worked on.

Exceptions

You can implement exception-like behavior in C with libraries. Our favorite is CException, written by the Throw the Switch team.

Objects in C

For information on how to use “objects” in C, please see this Field Atlas entry.

Information Hiding in C

We can take the previous approach to objects in C further by applying information hiding and encapsulation using opaque pointers.

For a practical example that uses this technique, see Creating a Circular Buffer in C and C++.

Polymorphism and Inheritance in C

For information on how to use polymorphism and inheritance in C, please see this Field Atlas entry.

From Embedded Artistry

cdecl

/ / C, Tools, Uncategorized

C++

C++ is a compiled programming language originally derived from C. C++ supports object-oriented, generic, and functional programming features.

Table of Contents:

  1. Books
  2. C++ YouTube Playlist
  3. From Embedded Artistry
  4. From Around the Web
  5. Recommended C++ Libraries

Books

Here are our favorite C++ books:

C++ YouTube Playlist

We have a Youtube Playlist with our favorite lectures on C++.

From Embedded Artistry

From Around the Web

References

  • C++ Reference – the best online reference for the language
  • ISO C++ Website – the official C++ website
    • The Super-FAQ contains a treasure trove of knowledge that is especially useful to new developers
  • C++ Core Guidelines is a collaborative effort to provide guidelines for the effective use of C++ (since C++11).
  • C++ Best Practices – a “Collaborative Collection of C++ Best Practices” from Jason Turner
    • Covers the safety, maintainability, portability, thread-ability, and performance of C++ code

Blogs

Not active, but full of quality content:

On C++ Templates

Rainer Grimm, a C++ trainer, has a series that teaches you about C++ templates:

On C++ Concepts

Concepts are a new addition to C++20. The topic can be complex enough to deserve a bit of dedicated study.