Skip to content

Toolbox

TinyToolbox — Platform Adaptation & Utility Library for Edge Devices

TinyToolbox provides the foundation layer for the Tiny* ecosystem: platform-specific adaptation, hardware abstraction, and common utilities. Currently targets ESP32 with planned STM32 support.


Architecture

  • TIME — Time Management


    tiny_time · Running time, SNTP sync, datetime
    tiny_get_running_time() · µs since boot
    sync_time_with_timezone() · Internet time sync (semaphore-based)
    tiny_get_current_datetime() · Human-readable time
    tiny_ntp_set_sync_hook() · NTP hook for FTSP integration
    tiny_format_*() · Unix conversion & time formatting
    NTP state tracking · TinyNtpSync_t

    Notes →

  • Platform Adaptation


    ESP-IDF integration layer
    FreeRTOS · esptimer · esplog · heap management
    Custom driver bridge (node_rtc, etc.)
    node_config.h · Node identity & WSN role (GATEWAY/LEAFNODE)

    Code →

  • FTSP — WSN Time Sync (via tiny_measurement)


    Flooding Time Synchronization Protocol over ESP-NOW
    Gateway: periodic beacon broadcast + NTP anchor
    Leaf: linear regression clock skew correction
    Sync viz: RGB LED status (WHITE → GREEN → MARQUEE)
    Microsecond precision · Drift compensation

    Details →

  • Command (Planned)


    MQTT command parser framework
    Unified command dispatch
    Scheduled & delayed task triggers

    Log →


Quick Start

#include "tiny_toolbox.h"

// Get running time since boot (microseconds)
TinyTimeMark_t t0 = tiny_get_running_time();

// Synchronize time via SNTP (call once after WiFi is up)
sync_time_with_timezone("CST-8");

// Get current date and time
TinyDateTime_t now = tiny_get_current_datetime(true);
printf("Current time: %04d-%02d-%02d %02d:%02d:%02d\n",
       now.year, now.month, now.day,
       now.hour, now.minute, now.second);

Dependency Chain

ESP-IDF (FreeRTOS, esp_timer, esp_log)  ──►  tiny_toolbox
                                          ┌─────────┼─────────┐
                                          │                   │
                                     Platform              Utilities
                                   Adaptation              (TIME, ...)
                                  Custom Drivers
                                  (node_rtc, ...)
  • No dependency on other Tiny* modules — toolbox is the lowest layer
  • Platform-specific — adaptation layer must be modified when porting (e.g., ESP32 → STM32)
  • All higher Tiny* modules (tinymath, tinydsp, tiny_ai) depend on toolbox for platform access

Code Structure

include/    tiny_toolbox.h · tiny_toolbox_config.h
time/       tiny_time.h · tiny_time.c

Platform Porting Notes

ESP32 is the primary target

Currently developed and tested on ESP32 only. Porting to STM32 or other platforms requires modifications to the adaptation layer (FreeRTOS → CMSIS-RTOS, esp_timer → HAL timer, etc.).

Submodule pattern

Each submodule is independent and can be included separately. tiny_toolbox.h serves as a directory that integrates all submodules — tiny_toolbox.c is a formal placeholder without specific functionality.