docs/reference/system-functional/osal.md
The Operating System Abstraction Layer (OSAL) provides a portable interface to operating system services, enabling F Prime applications to run on multiple operating systems without source code modifications. All platform-specific functionality (threads, files, synchronization, system resources) is accessed through the OSAL rather than through direct OS calls. The OSAL ships with a POSIX backend for Linux/macOS and a stub backend for platforms without full OS support. Additional backends (Zephyr, VxWorks, FreeRTOS) are available through community platform support packages.
The OSAL provides the following concurrency primitives:
The OSAL provides file and directory access:
The OSAL provides access to system-level information:
The console service provides a mechanism for writing messages to the system console output, used primarily for text event logging and diagnostic output.
In addition to the platform-specific core services, the OSAL provides generic services that are implemented independently of the underlying OS:
The OSAL uses a delegate pattern where each service has three layers:
Services are accessed either as singletons (for global operations like file system queries and CPU statistics) or as handles (for stateful objects like individual files, mutexes, and tasks). The OSAL is initialized once at system startup, though singletons will self-initialize on first use if explicit initialization is omitted.
All OSAL operations return typed status enumerations specific to each service. Platform backends translate native error codes into these status values so that application code never needs to interpret platform-specific errors.