The System module provides the runtime foundation used by higher-level Picofuse components.
More...
|
| | Memory |
| | Memory allocation primitives: arenas and the default heap wrappers built on them.
|
| |
| | Events |
| | The core event transport abstraction used by runloops and other producer/consumer workflows.
|
| |
| | Synchronization |
| | Mutexes, condition variables, wait groups, and atomic values used to coordinate access to shared state across threads.
|
| |
| | Data types and utilities |
| | Runes and strings, the flag-driven scanner built on them, and the stream I/O they read from.
|
| |
| | Execution |
| | Runtime execution: threads, pausing/stopping the process, and environment/signal integration.
|
| |
|
| file | assert.h |
| | Defines a custom assertion macro.
|
| |
| file | init.h |
| | System initialization and cleanup hooks.
|
| |
| file | panicf.h |
| | Defines the sys_panicf function for formatted panic messages.
|
| |
|
| void | sys_init (int argc, char *argv[], size_t arena_size, sys_stdio_t stdio) |
| | Initializes the system on startup. More...
|
| |
|
void | sys_exit (void) |
| | Cleans up the system on shutdown.
|
| |
The System module provides the runtime foundation used by higher-level Picofuse components.
It includes cross-platform abstractions for memory, threading, synchronization, timing, event queues, runloops, diagnostics, environment metadata, and process control.
◆ sys_assert
| #define sys_assert |
( |
|
condition | ) |
|
Value:do { \
if (!(condition)) { \
sys_panicf("[ASSERT] FAIL: %s, file %s, line %d", #condition, __FILE__, \
__LINE__); \
} \
} while (0)
Asserts that a condition is true.
- Parameters
-
| condition | The condition to check. |
If the condition is false, it will call panicf with an assertion failure message, including the condition, file name, and line number.
Definition at line 21 of file assert.h.
◆ sys_stdio_t
Standard input/output backend types.
| Enumerator |
|---|
| sys_stdio_none | No standard input/output backend.
|
| sys_stdio_uart | UART standard input/output backend.
|
| sys_stdio_usb | USB standard input/output backend.
|
| sys_stdio_rtt | SEGGER RTT standard input/output backend.
|
Definition at line 20 of file stdio.h.
SEGGER RTT standard input/output backend.
sys_stdio_t
Standard input/output backend types.
USB standard input/output backend.
No standard input/output backend.
UART standard input/output backend.
◆ sys_init()
| void sys_init |
( |
int |
argc, |
|
|
char * |
argv[], |
|
|
size_t |
arena_size, |
|
|
sys_stdio_t |
stdio |
|
) |
| |
Initializes the system on startup.
- Parameters
-
| argc | Argument count, as passed to main(). |
| argv | Argument vector, as passed to main(). On platforms with no real command line (such as Pico), pass 0/NULL; nothing reads them. |
| arena_size | Capacity in bytes for the default arena backing sys_malloc()/sys_calloc()/sys_realloc()/sys_free() (see sys/mem.h), or 0 to leave them routed straight through to the system allocator instead. |
| stdio | Standard input/output backend to initialize. Pass sys_stdio_none to select the platform default. |
◆ sys_stdin
Standard input stream.
Set by sys_init(), or NULL if no input stream is available.
◆ sys_stdout
Standard output stream.
Set by sys_init(), or NULL if no output stream is available.