Config is now loaded at runtime via WebSocket (ConfigCtrlMessage) instead of from hardcoded TOML files. The emulator starts with no devices and waits for clients to send configuration. - Define FlatBuffers schemas: EmulationConfig, ComposeDeviceConfig, BaseDeviceConfig with recursive DeviceConfig union - Rename MemSegment.start → addr (flatcc builder/reader name collision) - Add ConfigCtrlMessage handler: validates STILL state, walks the device tree depth-first, assigns numeric IDs, responds with DeviceIdMappingNotif or ConfigLoadError - Add fb_build_config_device_id_mapping() and fb_build_config_error() FlatBuffer builders - Remove hardcoded device loading from main.c; iterate dynamically loaded devices in the exec loop - Fix double-free: freeConf() already frees the struct itself, remove redundant free() calls in config.c and base_device.c - Fix heap-buffer-overflow in device parseSpecsFromConfig: malloc for segment name was missing +1 for the null terminator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
include "mem_config.fbs";
|
|
include "clock.fbs";
|
|
|
|
namespace hmmmm.config;
|
|
|
|
// Configuration for a single base device (leaf node in the device tree).
|
|
// Equivalent to a standalone device TOML (e.g. AVRrc.toml, gpio.toml).
|
|
table BaseDeviceConfig {
|
|
libpath: string;
|
|
mem_segments: [MemSegment];
|
|
}
|
|
|
|
// A composite device that contains other devices.
|
|
table ComposeDeviceConfig {
|
|
devices: [DeviceEntry]; // child devices (base or compose)
|
|
projections: [Projection]; // memory projections between children
|
|
intercepts: [Intercept]; // memory intercepts between children
|
|
}
|
|
|
|
// A device can be either a leaf (base) or a container (compose).
|
|
union DeviceConfig {
|
|
BaseDeviceConfig,
|
|
ComposeDeviceConfig,
|
|
}
|
|
|
|
// Override for one memory segment within a child device.
|
|
// Only fields that need changing from the base config must be set.
|
|
table MemSegOverride {
|
|
segment: string;
|
|
addr: uint32;
|
|
len: uint32;
|
|
word_len: uint8;
|
|
executable: bool;
|
|
}
|
|
|
|
// One device entry in a device tree.
|
|
table DeviceEntry {
|
|
// Local identifier, unique within this composite (e.g. "core", "gpio_a").
|
|
id: string;
|
|
|
|
// Inline device configuration — either base or compose.
|
|
config: DeviceConfig;
|
|
|
|
clock: DeviceClockConfig;
|
|
overrides: [MemSegOverride];
|
|
}
|
|
|
|
// Root type when serialising a standalone device config to a binary file.
|
|
root_type BaseDeviceConfig;
|