Module System Overview

Modules are the reusable building blocks of Babel firmware. Each module owns one responsibility — LED control, UART communication, sensor sampling — behind a standardized module.yml interface. Compose firmware by mixing proven modules from the library, generating new ones with AI, or importing from GitHub, instead of rewriting low-level logic for every project.

Design for reuse

Keep each module focused on a single capability with clear inputs and outputs. Small, composable modules are easier to test, AI-generate, and share across boards.

module.yml Specification

Every module includes a module.yml file that declares metadata, entry points, parameters, dependencies, and interfaces.

name: led_blink_pattern
version: "1.0.0"
type: module
description: LED blink pattern controller with configurable patterns
entry:
  init: LED_BlinkPattern_Init
  loop: LED_BlinkPattern_Loop
params:
  - name: LED_PIN
    type: c_token
    default: GPIO_PIN_5
    description: GPIO pin for the LED
  - name: BLINK_DELAY_MS
    type: u32
    default: 500
    description: Delay between blinks in milliseconds
requires:
  - HAL_GPIO
interfaces:
  - name: LED_BlinkPattern
    provides:
      - LED_BlinkPattern_Init
      - LED_BlinkPattern_Loop

Field Reference

FieldTypeRequiredDescription
namestringYesUnique module identifier used by Babel and library indexing.
versionstring (SemVer)YesModule version for compatibility and updates.
type"module" or "driver"YesDeclares the module category.
descriptionstringYesHuman-readable summary of what the module does.
entry.initstringYesC function called during initialization phase.
entry.loopstringYesC function called repeatedly in the main runtime loop.
params[]arrayNoUser-configurable parameters exposed in Babel UI.
requires[]arrayNoRequired HAL/services/dependencies this module expects.
interfaces[]arrayNoDeclared interface contracts and provided symbols.

Writing Custom Modules

A custom module usually includes:

  • A header file (.h) with function declarations
  • A source file (.c) with implementation
  • A module.yml file with metadata and integration info

Minimal structure:

// led_blink_pattern.h
#ifndef LED_BLINK_PATTERN_H
#define LED_BLINK_PATTERN_H
 
void LED_BlinkPattern_Init(void);
void LED_BlinkPattern_Loop(void);
 
#endif
// led_blink_pattern.c
#include "led_blink_pattern.h"
 
void LED_BlinkPattern_Init(void) {
  // setup GPIO, initial state
}
 
void LED_BlinkPattern_Loop(void) {
  // periodic blink logic
}

Validation first

Before publishing, make sure function names in entry.init and entry.loop exactly match your C symbols.

Browsing the Library

Open the Library page in Babel to manage reusable assets across three tabs:

  1. Modules — Reusable firmware blocks. Add a module to your project with one click and configure its parameters in the workspace.
  2. Templates — Project starters (board + modules + peripheral setup). Includes the Babel Official gallery and any templates you have uploaded.
  3. AI Builder — Generate new modules from natural-language prompts (see the AI Features docs).

Library content can come from three sources: the Babel Official catalog, GitHub repositories you connect, or files you upload yourself.

Importing from GitHub

Connect a GitHub repository on the Library page and Babel will scan it for module.yml files, validate the schema, check required source/header files, and surface every valid module in your library. Re-sync at any time to pull in updates.

GitHub import best practice

Use tagged releases and semantic versioning so teams can pin stable module versions and avoid breaking changes when re-syncing.

Module System | Babel Docs