Stratify Toolbox

by Stratify Labs, Inc.

A printf()-ing awesome flash & debug tool

View all updates Jan 12, 2021

I²C Bus Scanning & Our Open Source Embedded C++ Framework

by Tyler G

I2C Bus Scanning

I have spent the last four months building and refining all of the underlying C++ frameworks the Toolbox uses for its applications. With much of the underlying tooling complete, the Toolbox is starting to have some useful features!

While the Toolbox will primarily be used for printf() style tracing, it also has some peripheral features to help with board bring-up and general hardware software debugging. Check out the video below where I walk through doing a quick I2C bus scan.


The Toolbox has a big emphasis on ease-of-use. You can do an entire I2C scan without having to reference any external pinout information or having to deal with any software installation or setup.

Open Source Embedded C++ Framework

The application frameworks that power the graphics and IO for the above video are available on GitHub under an MIT license.

The framework is a redesign of the libraries I have been using for the last ten years. After a decade of writing C++ for microcontrollers, I learned many lessons and techniques I could apply to this project. The following are the central ideas of the redesign:

  • Thread Local Error Contexts
  • Method Chaining
  • Strong Arguments
  • RAII Everywhere
  • Filesystems Inspired Abstraction

I published a series of blog posts with more detail on how these principles work. One good example of how these principles can help to write more concise code is copying a file from one location to another. When I first started developing in C, this is how I handled a file copy:

int file_fd = open("file.txt", O_READONLY);
if( f < 0 ){ /*cascade the error up the chain*/ }

int new_file_fd = open("new_file.txt", O_APPEND | O_CREAT | O_TRUNC, 0666);
if( new_file_fd < 0 ){ /*cascade the error up the chain*/ }

char buffer[64];
int bytes_read = 0;

while( (bytes_read = read(file_fd, buffer, 64)) > 0 ){
  if( write(new_file_fd, buffer, bytes_read) < 0 ){
    //cascade the error up the chain

if( close(file_fd) < 0){ /*cascade the error up the chain*/ }
if( close(new_file_fd) < 0){ /*cascade the error up the chain*/ }

With the API framework, the same is accomplished with:

//copy file.txt -> new_file.txt
File(File::IsOverwrite::yes, "new_file.txt")
if( api::ExecutionContext::is_error() ){
  //something didn't work -- error context has the details

Stay Tuned

Firmware development of the Toolbox is finally starting to accelerate. Stay tuned for more updates soon on how you can use the Toolbox.

About the Author

Tyler G

StratifyLabs  ·  StratifyLabs  ·   HIGHLAND, UT

This project is launching soon.

Coming Soon


Stratify Labs, Inc.

Stratify Labs builds tools that help developers bring IoT products to life including Stratify OS. Stratify OS is a microcontroller operating system built specifically to handle the growing complexity demanded by IoT devices. It features complete kernel/application separation (in both the build and execution), filesystem and hardware abstraction, automatic updates, as well as built-in networking and security. We also are building the Toolbox (powered by Stratify OS), but you already knew that.

Tyler Gilbert

See Also

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects: