How fuxiaoy/arnics-os works
Project type and purpose
• Project Type: Embedded RTOS-based “operating system” framework with modular “departments” (business logic), a data‐platform layer, and third-party libraries.
• Purpose: Provide a social-biomimetic business framework (“Powerful Social Biomimetic Business System Architecture”) atop hardware, with common utilities, a core scheduler, data services, and pluggable business modules.
High-level layering (the main components)
1. Hardware Layer
– The MCU and peripherals (STM32 series in templates).
2. Board Support Package & Drivers
– drivers/bsp, drivers/common, drivers/component
– document/templete dirs show how BSP is structured.
3. HAL / Port Layer
– port/ (delay, reprintf, portInclude)
– rtosInterface/ (FreeRTOS wrapper, entry_rtos_api, rtosPort)
4. Common Utilities
– common/ (memory allocation, timing utilities)
– Inc/ (global typedefs, includes)
– thirdParty/ (Assert, RingBuffer, ufLog, syslog, fatfs, etc.)
5. Core Scheduler & State Machine
– core/
• processTask (task dispatch)
• ptThread (protothreads)
• separateSM (state-machine separation)
• arnicaCore (initialization, main loop)
6. Routine / Task Manager
– routine/arnicsTaskManager (interfaces to schedule tasks on top of core)
7. Data Platform
– dataPlat/
• dataApi (public API)
• dataCore (engine)
• dataManager (JSON store, lists, key/value)
• dataObj (parameter, systemCfg, systemStatus)
8. Business Modules (“Departments”)
– dePartment/centerAdministrative, centerBusiness, centerConsole, centerEvent, centerGuard, centerMedia
– Each has an entry_*_api and a _process implementation.
9. Documentation & Pictures
10. Templates
– document/templete/… STM32F103 & STM32L431 examples
Relationships & interactions
• Hardware ↔ BSP/Drivers: low-level register access
• Drivers & Port ↔ RTOSInterface: hardware abstraction + OS primitives
• RTOSInterface ↔ Core: scheduling, task creation, inter-task communication
• Core ↔ Routine: routine triggers tasks via the core scheduler
• Core & Routine ↔ Departments: “entry_*_api” functions register or invoke department logic
• Departments ↔ Data Platform: read/write parameters, config, system status
• All layers ↔ Third-Party: link in libraries (e.g. nnom for neural nets, modContact for modem comm, rollDB for TS DB)
• Documentation: out-of-band, not in execution but helpful for design.
Architectural patterns & principles
• Layered Architecture: clear separation HW → drivers → OS → core → middleware → business logic
• Plugin/Module Pattern: each “department” is a pluggable service adhering to a common entry_*_api interface
• Data Abstraction: dataPlat provides a unified API over JSON stores, structured objects, and persistent cfg/status
• Protothreads & State Machines: core/ptThread and separateSM encapsulate lightweight threading/state logic
Essential elements
– Each layer clearly labeled (Hardware, BSP/Drivers, HAL/RTOS Interface, Core, Data Platform, Departments, Third-Party)
– An entry point: “arnicsCore.init()” or “main()” at the top of the core layer
– Data flows: parameter read/write → dataPlat → storage
– Task flows: department entry_*_api → core scheduler → ptThread run