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_LoopField Reference
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique module identifier used by Babel and library indexing. |
version | string (SemVer) | Yes | Module version for compatibility and updates. |
type | "module" or "driver" | Yes | Declares the module category. |
description | string | Yes | Human-readable summary of what the module does. |
entry.init | string | Yes | C function called during initialization phase. |
entry.loop | string | Yes | C function called repeatedly in the main runtime loop. |
params[] | array | No | User-configurable parameters exposed in Babel UI. |
requires[] | array | No | Required HAL/services/dependencies this module expects. |
interfaces[] | array | No | Declared 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.ymlfile 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:
- Modules — Reusable firmware blocks. Add a module to your project with one click and configure its parameters in the workspace.
- Templates — Project starters (board + modules + peripheral setup). Includes the Babel Official gallery and any templates you have uploaded.
- 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.