Providing portable applications that can be run on any hardware with Stratify OS installed

Providing a cloud platform for board firmware updates, sharing pre-built applications, as well as storing and retrieving data

Stratify OS is perfect for building hardware modules (like bluetooth, wifi, etc). Most module manufacturers use serialization or complex SDKs based on source code integration or scripting.

With Stratify OS, module manufacturers can define the BSP and root applications while allowing customers to build and run applications that run native C/C++ applications on the MCU using an easy-to-use POSIX API.

If you are a module maker interested in providing a simple-to-use SDK to your customers, we can help.

OS Built and Installed Independent of Applications

The first thing to understand is that the OS is built and installed independent of applications. A project for building Stratify OS for a particular board is called a board support package (BSP). The BSP is built using:

Board specific configuration tables

Any board specific code provided by the board manufacturer (such as custom drivers or kernel requests)

Stratify OS library (libsos_sys)

Stratify OS MCU family library (libsos_mcu_family)

e.g., STM32F446xx, STM32F723xx, LPC17xx, LPC40xx

Stratify Labs provides BSPs for many popular microcontroller development boards including:

For a custom BSP, you just have to change a few configuration tables which define which pins and drivers you want to include in the build. The BSP uses link level configuration settings which means you don’t have to build the Stratify OS libraries in order to create a custom BSP.

Stratify OS Library

The Stratify OS library includes code that is developed for the ARM Cortex M architecture to accomplish context switching, filesystem abstraction, mutexes, threads, etc. The OS functionality is accessible via a POSIX API including:

unistd: e.g., open(), close(), read(), write(), ioctl(), and usleep()

pthreads: e.g., pthread_create()

Semaphores

Mutexes

Message queues

Signals: e.g., kill()

The Stratify OS library is built per instruction set architecture and ABI:

armv7m (Cortex M3)

armv7e-m (Cortex M4)

Hard Float v4 (Cortex M4F)

Hard Float v5 single precision (Cortex M7)

Hard Float v5 double precision (Cortex M7)

Stratify OS MCU Library

The mcu specific libraries provide low level abstraction at the chip level. BSP drivers use the MCU libraries to provide access to hardware.

For example, the BSP includes a table of devices with entries like this:

DEVFS_DEVICE("spi0",mcu_spi,0,0,0,0666,USER_ROOT,S_IFCHR)

The line above means that “/dev/spi0” will use the “mcu_spi” driver on port 0 with no default configuration provided, with access permissions 0666, root ownership, and character device.

For the BSP to build correctly, the MCU library must implement the following functions:

Relocatable Programs

The code is built in a re-locatable fashion such that it is translated when it is installed to its execution location in either flash or RAM. The relocatable copy of the program can be installed in a data filesystem (e.g., on an external SD card) and then be loaded dynamically.

The code below uses the Stratify API to launch a program stored on a data filesystem.

#include <sapi/sys.hpp>
intmain(intargc,char*argv[](){printf("I am about to launch Hello World in a new process\n");Sys::launch("/home/HelloWorld");return0;}

The program above launches “HelloWorld” that is installed in the local folder “/home”. If “HelloWorld” exists in RAM or flash, it will be executed. If not, it will be dynamically installed to flash and executed.

Sys::launch() calls a Stratify OS function called launch(). Most system calls are based on the standard C library or POSIX API. However, because the Cortex M architecture does not have an MMU, launch() is used in lieu of the exec() and fork() function families.

What to do Now

Now that you understand the basics you can:

Set up an IDE (5 minutes. Skip this if you already have a CMake compatible setup that you like)