This note is an attempt to demystify an RTOS scheduler by building one. To start with, we will touch base on what a pre-emptive scheduler is and finally implement one for ARM Cortex-m cores. Most of the discussion is architecture agnostic. However, the scheduler we implement relies heavily upon the processor architecture. That isn’t a problem, we would discuss in detail the ARM cortex-m internals necessary to implement the scheduler.

If you are someone who already understands how pre-emptive schedulers work, you could skip a few sections and start from Intuition for Building a pre-emptive scheduler.

What is a pre-emptive scheduler?

Assume that we intend…


Firmware over the air(FOTA) has become an indispensable part of any IoT device. FOTA provides the flexibility of providing software patches and upgrades while the “Thing” is deployed. This project is aimed at making the life of esp8266 enthusiasts simple by providing a step by step guide to enable firmware updates over the air. The project can be found at:

The code for the project has been borrowed from:


Although the project is fully functional. It is aimed as an example for OTA feature and developers can add their custom modules to it. …

Why Random numbers(RN)?

This decade has seen an exponential growth of IoT devices and security attacks on them. IoT devices often compromise on security due to space, time and memory constraint. One such evident compromise is the use of not “truly” random number generators(RNG). Modern secure communication mechanisms are heavily reliant on the availability of true random number generators(TRNG). For example, here is how TLS relies on RNG’s for establishing secure communication:

  1. The client sends information to the server about which version of TLS it wants to use and other information.
  2. The server replies with similar information about TLS versions…

The Problem

In the recent past, there has been a tussle between various competing protocols like MQTT, XMPP, and CoAP to get their foots cemented in the IoT space. MQTT seems to emerge as a clear winner and is transitioning towards being adopted as the de facto protocol for constrained IoT edge devices. This is because MQTT aptly fits the necessities of IoT devices. Few properties of MQTT worth noting are:

  1. Simple protocol and hence lightweight software stacks which can be easily implemented in low memory footprint devices. …

The Problem

State machines are a mathematical abstraction that is used as a common software design approach to solve a large category of problems. I have always felt SM’s to be marvels of concise verbosity. The realization of state machines involves identifying the states and the events that result in a transition between the states. This approach of design usually looks elegant on the paper but most of the implementations diminish this elegance. Typical state machine implementations use switch-case based design, where each case represents a state. It is quite excruciating for the reader of such implementation to understand it…

Sudeep Chandrasekaran

An IoT specialist with a focus on developing secure scalable software. My interests wildly swing between embedded systems, cryptography, and physics.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store