Panel For Example Panel For Example Panel For Example
Zorb: An Open-Source Framework for Bare-Metal MCUs

Zorb: An Open-Source Framework for Bare-Metal MCUs

Author : Adrian September 03, 2025

When developing microcontroller projects, performance and memory constraints often prevent the use of large, general-purpose frameworks. In these situations, lightweight software frameworks become particularly important. This article introduces Zorb, an open-source software framework designed for bare-metal microcontroller applications.

 

1. Introduction to Zorb

Zorb is a lightweight embedded framework built on object-oriented principles.

The goal of the Zorb framework is to enable rapid application development on chips that cannot run operating systems like Linux, avoiding the need to reinvent the wheel.

The initial design of the Zorb framework includes the following features:

  • Time system (zf_time)
  • Ring buffer (zf_buffer)
  • List management (zf_list)
  • Finite State Machine (FSM) (zf_fsm)
  • Event handling (zf_event)
  • Timer management (zf_timer)
  • Task scheduling (zf_task)

The first six features are sufficient for creating purely event-driven programs, meeting the needs of most small to medium-sized embedded applications. The task scheduling feature is included to meet the real-time requirements of more demanding applications.

Alternatively, the first six features can be used as a standalone module on top of an existing embedded operating system to handle event-driven logic.

 

2. Environment Setup

The hardware environment for this demonstration uses an STM32F429 development board. It utilizes UART1 for debug printing and the SysTick timer for system timekeeping.

 

3. Debugging

Setting up a proper debugging environment is a critical first step in development. This setup uses UART1 for debug output (mapping `printf`), with debug messages categorized into three levels. A host PC application can later use these levels to highlight messages accordingly.

/****************************************************************************** * Description: Initializes the hardware environment * Parameters: None * Return: None ******************************************************************************/ void BSP_init(void) { /* Configure the Nested Vectored Interrupt Controller (NVIC) priority group */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); /* Initialize the debug UART */ Debug_USART_init(); /* Initialize SysTick */ SystemTick_init(); }

 

4. Assertions

Using assertions at critical points in the code during development can help locate bugs more easily.

/****************************************************************************** * Description: Handles assertion failures * Parameters: (in)-pFileName - The name of the source file * (in)-line - The line number where the assertion failed * Return: None ******************************************************************************/ void ZF_assertHandle(uint8_t *pFileName, int line) { ZF_DEBUG(LOG_E, "file:%s line:%d:asserted\n", pFileName, line); while (1); }

 

5. Time Scheduling

To minimize resource consumption, the framework's minimum time slice is set to 1 ms. This requires configuring the SysTick timer to generate an interrupt every 1 ms. Inside the interrupt service routine, a tick counter for the framework is incremented.

/****************************************************************************** * Description: SysTick interrupt service routine * Parameters: None * Return: None ******************************************************************************/ void SysTick_Handler(void) { /* Provide a time tick for the Zorb framework */ ZF_timeTick(); }

 

6. Conclusion

This article covers the basic setup, which serves as the foundation for the entire framework. All future features will be developed on top of this environment.

A well-configured debug output environment helps in quickly locating bugs, thereby improving development efficiency.