Architecture

August 2019: Apollo 11, Design for the Blind, Architecture

Welcome to the August 2019 edition of the Embedded Artistry Newsletter! This is a monthly newsletter of curated and original content to help you build superior embedded systems. This newsletter supplements the website and covers topics not mentioned there.

This month we'll cover:

  • Apollo 11: 50th anniversary
  • Electronics design for the blind
  • Ravioli, a tool for calculating the Koopman Spaghetti Factor
  • Embedded systems architecture resources
  • Embedded news from around the web
  • Embedded job postings
  • Updates to the Embedded Artistry Website

50th Anniversary of Apollo 11

July marked the 50th anniversary of the Apollo 11 mission, which has garnered much media attention and the launch of the spectacular Apollo 11 in Real Time project. While it's interesting to revisit the Apollo 11 program, we're going to focus on a different angle: the Apollo Guidance Computer (AGC).

Space programs serve as excellent examples for embedded system designs with extreme requirements.

It's common to see quotes about the AGC like this one from Michio Kaku:

“Today, your cell phone has more computer power than all of NASA back in 1969, when it placed two astronauts on the moon.”

But statements like these are misleading. In an age of room-sized computers, the 70-pound Apollo Guidance Computer was an engineering marvel. The computer was responsible for computing the navigational course to the moon and adjusting that course based on in-flight astronaut input. The AGC needed to communicate with 150 different devices onboard the spacecraft - an immense task even for today's systems. The computer enabled Apollo 11 to get to the moon, reach the surface, and return to earth autonomously. And after a quarter of a million miles - the AGC hit its target within 500-600 feet of the goal. Such a feat of engineering is worth studying, which is why we feature the Apollo 11 AGC in our Source Code Classics article. For a book on the subject, check out Apollo Guidance Computer: Architecture and Operations.

Also, while we're all thinking about the Apollo programs, we want to share this wonderful anecdote from Margaret Hamilton:

Often in the evening or on weekends I would bring my young daughter, Lauren, into work with me. One day, she was with me when I was doing a simulation of a mission to the moon. She liked to imitate me – playing astronaut. She started hitting keys and all of a sudden, the simulation started. Then she pressed other keys and the simulation crashed. She had selected a program which was supposed to be run prior to launch – when she was already “on the way” to the moon. The computer had so little space, it had wiped the navigation data taking her to the moon. I thought: my God – this could inadvertently happen in a real mission. I suggested a program change to prevent a prelaunch program being selected during flight. But the higher-ups at MIT and NASA said the astronauts were too well trained to make such a mistake. Midcourse on the very next mission – Apollo 8 – one of the astronauts on board accidentally did exactly what Lauren had done. The Lauren bug! It created much havoc and required the mission to be reconfigured. After that, they let me put the program change in, all right.

For more on the Apollo 11 50th anniversary and the Apollo AGC:

Electronics Design for the Blind

IEEE Spectrum recently published an article titled "You Don’t Need Sight to Read These Electronic Schematics". Our interest was immediately piqued. The article briefly detailed developments in enabling electronic design for the blind. Electronics work seems like an area where sight is critical. It is exciting this assumption has been proven false.

The article describes Lauren Race's thesis project, Designing Tactile Schematics, which researched standards and best practices for designing tactile schematics. Race initially tried to print schematics on Swell Touch Paper, which causes areas printed in black ink to swell up and create raised surfaces when passed through a fuser machine. She learned through usability testing that making existing schematics tactile did not make them readable. She then worked with user groups to modify symbols and create schematics that were readable to both sighted and blind people. You can find the culmination of her work in her Visual Style Guide, as well as a sample set of 50 schematics following the tactile style guide rules.

The article also mentions the Blind Arduino Project, which aims to overcome the barriers faced by blind people who want to participate in hardware prototyping. The Project offers occasional hands-on workshops teaching coding, soldering, and other skills to blind makers. They also document their learnings on the Blind Arduino blog and host a regular Bay Area Blind Arduino Monthly Meetup.

For more on enabling electronics design for the blind:

Ravioli: A Tool for Calculating the Koopman Spaghetti Factor

Matt Chernosky, who runs Electron Vector, has created a software quality tool dubbed Ravioli. This tool calculates the Koopman Spaghetti Factor, a software complexity metric created by Phil Koopman.

The Spaghetti Factor (SF) metric is calculated in the following manner:

SF = SCC + (Globals*5) + (SLOC/20)

Where:

  • SCC = strict cyclomatic complexity (for more information, see the Phil's article).
  • Globals = number of read/write global variables, excluding const variables and file-scope statics
  • SLOC = source lines of code, which focuses on actionable programming statements and excludes comments

Phil Koopman provides a helpful and actionable scoring guide. Here are Phil's thoughts on complexity scores:

  • 5-10 - This is the sweet spot for most code except simple helper functions
  • 15 - Don't go above this for most modules
  • 20 - Look closely; review to see if refactoring makes sense
  • 30 - Refactor the design
  • 50 - Untestable; throw the module away and fix the design
  • 75 - Unmaintainable; throw the module away; throw the design away; start over
  • 100 - Nightmare; probably you need to throw the whole subsystem away and re-architect it

Our complexity analysis tool of choice is Lizard, but we will be adding Ravioli to our CI suite for another perspective. Ravioli is currently targeted for C source files, but we think it can also be adapted for C++.

For more on Ravioli and the Spaghetti Factor:

Embedded Systems Architecture Resources

Last month we received multiple requests for resources to help learn about embedded systems security. This month we had many engaging conversations about architecting embedded systems, which surprised us because "architecture" and "design" are typically words that send programming teams running for the hills.

These conversations prompted us to share our collection of embedded systems architecture resources. Software architecture is a broad field, so we've focused our recommendations on a the following areas:

We also frequently write about systems thinking and software architecture on Embedded Artistry, and we will be publishing more articles on these topics as we develop our architectural skills.

Around the Web

We've grouped our August reading recommendations by these categories:

  • General
  • Embedded
  • Security
  • Hardware

General

The authors of Elements of Programming have released a free PDF copy of the book in honor of the 10 year anniversary. This is a programming classic, so definitely take this opportunity to read it.

All About Circuits published a great article discussing the Principles of Cache Design, a topic low-level programmers should be familiar with.

Memfault published an article describing how to get the most out of the linker map file.

Memfault also published an excellent tutorial on automating debugging tasks with GDB's Python API.

Hillel Wayne published an approach for identifying missing requirements using modeling.

Jonathan Boccara, author of the Fluent C++ blog, published a wonderful post addressing a common problem we see: duplicate global data. Check out his article, What Every C++ Developer Should Know to (Correctly) Define Global Constants.

Embedded

Jay Carlson authored an excellent post describing how he teaches embedded systems to EE undergraduate students. Jay's notes are valuable for anyone who teaches embedded systems topics to others.

Elecia White shared a GitHub repository, Machine Learning on Embedded Devices, which serves as a wonderful collection of resources for those interested in the intersection of ML and embedded systems.

Security

Researchers seem to have found a way around Bluetooth LE's MAC address randomization feature, which is used to prevent identifying and tracking devices.

Memfault published Fix Bugs and Secure Firmware with the MPU, a guide for securing ARM MCUs with the Memory Protection Unit.

All About Circuits looked at microcontrollers with security-focused hardware components in Secure Microcontrollers Address IoT Security

All About Circuits highlighted Hardware Security Vulnerabilities that Engineers Should Know. The article concludes with advice for securing embedded systems.

Hardware

EDN published a review of TI's new tutorial book titled Radiation Handbook for Electronics. The book is pitched as "a compendium of radiation effects topics for space, industrial and terrestrial applications." Checkout this book if you're interested in designing electronics for high-radiation environments.

All About Circuits published an introductory article on Understanding Schematics, a critical skill for all embedded engineers.

Job Postings

At IRNAS, innovation lab for hardware and IoT products, based in Maribor, Slovenia, we are expanding our crew with an Embedded Software Engineer, who will collaborate on interdisciplinary development of telecommunication solutions, IoT systems, 3D bio-printing and more. Find out more about the open job position and apply by visiting this link.

Hiring Embedded Engineers?

Is your company hiring embedded systems hardware/software engineers? Send us a short job ad with a link to the full job description. We will be happy to include it in our newsletter.

Website Updates

We expanded the Glossary with additional terms and links.

We updated Technology Radar statuses for items that were under evaluation.

We added additional Apollo 11 links to Programmers: Let's Study Source Code Classics.

New Articles

We published the following articles in July:

These were our most popular articles in July:

  1. Creating a Circular Buffer in C/C++
  2. std::string vs C-strings
  3. Demystifying Microcontroller GPIO Settings
  4. For Beginners
  5. Installing LLVM/Clang on OSX
  6. Migrating from C to C++: NULL vs nullptr
  7. C++ Casting, or: "Oh No, They Broke Malloc!"
  8. An Overview of C++ STL Containers
  9. What can software organizations learn from the Boeing 737 MAX saga?
  10. Jenkins: Running Steps as sudo

Thanks for Reading!

Have any feedback, questions, suggestions, interesting articles, or resources to recommend to other developers? Simply reply to this email!

While you're waiting for our next edition, check out the website or follow us on Twitter.

Happy hacking!

-Phillip & Rozi