NetBurner 3.5.6
PDF Version
FS_BulkStore

Config FS BulkStore Application

Overview

The Config FS BulkStore application demonstrates how to use the config_fs_bulkstore class to store large binary blobs in a filesystem while managing their contents through the NetBurner configuration system. This example shows how to handle persistent storage of large data objects that might exceed the limitations of the standard configuration space.

Features

  • Bulk Storage Management: Store large binary data blobs in the filesystem
  • Configuration Integration: Manage bulk storage objects via the NetBurner config system
  • Flexible Storage Options: Support for both fixed and movable storage paths
  • File System Operations: Built-in commands for file manipulation (cat, rm, fsls)
  • Command-Line Interface: Interactive serial console with argument parsing
  • Network Support: Full network stack initialization with diagnostics

Architecture

Core Components

  1. config_fs_bulkstore: Main class for managing large binary blobs
    • Stores data in filesystem while providing config system interface
    • Supports both fixed and movable storage paths
    • Handles runtime path changes when configured as movable
  2. Argument Parser: Robust command-line argument parsing system
    • Supports various data types (int, uint, string, bool, flags)
    • Handles quoted arguments and escape sequences
    • Provides detailed error reporting
  3. Console Commands: File system management commands
    • cat: Display file contents
    • rm: Delete files
    • fsls: List filesystem contents with tree structure

Configuration Objects

The application creates two bulk storage objects:

// Fixed path bulk store
static config_fs_bulkstore gMyBulkStore{
appdata, "/MyBulkStore.bin", false, "MyBulkStore"
};
// Movable path bulk store
static config_fs_bulkstore gMyMovableBulkStore{
appdata, "/MyMoveableBulkStore.bin", true, "MyMovableBulkStore", NULL, false
};

Usage

Starting the Application

  1. The application initializes the filesystem (if not already available)
  2. Sets up the network stack with diagnostics enabled
  3. Waits for network connectivity (up to 5 seconds)
  4. Drops to serial configuration mode for interactive use

Available Commands

  • cat <file_path>: Display the contents of a file
  • rm <file_path>: Delete a file from the filesystem
  • fsls: List all files and directories in a tree structure
  • help: Show available commands (inherited from config system)

Command Line Features

The argument parser supports:

  • Flags: Single character flags (e.g., -a, -v)
  • Quoted Arguments: Single and double quotes with escape sequences
  • Multiple Data Types: Integers, unsigned integers, strings, booleans
  • Optional/Required Parameters: Flexible parameter definitions

Build Requirements

  • NetBurner development environment
  • Platform with filesystem support (or EFFS Std filesystem)
  • Standard C++ compiler support

Configuration Space

The application reports configuration space usage on startup:

  • Shows current usage vs. maximum available space
  • Helps monitor config system utilization

Error Handling

The argument parser provides detailed error messages:

  • Unknown flag identification
  • Too few/many arguments detection
  • Invalid argument format reporting
  • Clear error location indication

Network Features

  • Full network stack initialization
  • ARP and HTTP protocol support
  • System diagnostics enabled for debugging
  • 5-second network connectivity timeout

File System Integration

The application integrates with the NetBurner filesystem:

  • Automatic filesystem initialization on platforms without native support
  • Full file manipulation capabilities
  • Recursive directory traversal
  • File size reporting

Example Usage

Config Tree Demo built at 12:34:56 on Jan 01 2024
'?' for commands
Config space used: 1024 of 65536 bytes (max)
Aborted to Serial Config (BOOT) to continue boot
type help for commands
> cat /MyBulkStore.bin
> fsls
> rm /temporary_file.txt

Technical Details

Memory Management

  • Uses NetBurner's SMPool buffer system for efficient memory usage
  • Configurable buffer sizes for different operations
  • Automatic buffer cleanup and management

Threading

  • Main application runs in continuous loop with 1-second delays
  • Uses NetBurner's OSTimeDly for cooperative multitasking
  • Thread-safe configuration system integration

Platform Support

  • Conditional filesystem initialization based on platform capabilities
  • Portable across different NetBurner hardware platforms
  • Configurable for different storage backend implementations

Development Notes

This application serves as a reference implementation for:

  • Integrating large data storage with NetBurner's config system
  • Building interactive command-line interfaces
  • Implementing argument parsing
  • Managing filesystem operations in embedded systems