NetBurner 3.5.8
PDF Version
EFFS-STD Multiple Partitions

Example Path: examples/EFFS/Std/SystemFileSystem/MultiPartition

EFFS Multiple Partitions

This example demonstrates how to create and manage multiple EFFS-STD partitions on the SOMRT1061 Application Flash. The partition table supports up to 8 partitions (0-7). By default only partition 0 exists, spanning all of Application Flash. This example splits the flash so that a guaranteed amount is reserved for NNDK system use while the rest is available for general application storage.

Why partition? With a single partition, application files and system storage share the same space. If user files fill the partition, there may not be enough free space left to update the application firmware. Creating a second partition reserves dedicated space for the system, preventing file storage from starving firmware updates.

How It Works

On startup the application:

  1. Calls init() and starts the HTTP web server (StartHttp())
  2. Waits up to 5 seconds for an active network connection
  3. Reads the current partition table from Application Flash
  4. Presents an interactive serial-console menu whose options depend on whether a second partition already exists

Menu Options

When no second partition exists

Option Action
1 Create a 1 MB second partition

When a second partition already exists

Option Action
1 Show the current partition layout
2 Remove all extra partitions and restore a single partition

After the menu action completes (or on reset/skip), the application reads the filesystem from every active partition and prints a directory tree for partition 0.

Repartitioning Process

Both creating and removing partitions follow the same general cycle:

  1. Backup - every file on each active partition is read into RAM (directory structure, content, timestamps, and permissions are all preserved)
  2. Unmount & Erase - all drives are unmounted and the entire flash chip is erased
  3. Write new layout - for creation, a new partition table is written with partition 0 shrunk and a new partition appended at the end of flash; for removal, no table is written so the system reverts to the default single partition on next boot
  4. Mount & Format - each partition in the new layout is mounted and formatted
  5. Restore - backed-up files are written back to their original partitions

Caution: Do not cycle power while the flash is being erased or repartitioned. Interrupting this process will result in data loss.

When removing partitions, only files from partition 0 are restored. Files on secondary partitions (1-7) are discarded.

Web Server

The application starts an embedded HTTP server that serves a simple page from the html/ directory (index.html, style.css, logo.jpg). Connect to the device's IP address in a browser to view it.

Building

Platform:** SOMRT1061 only

Build with the standard NetBurner make command. The makefile automatically runs comphtml to generate src/htmldata.cpp from the files in html/ whenever they change.