Components and Linking#
RCSW is divided into components, roughly one per top-level directory under
include/rcsw. It can be built as one monolithic library or as one library
per component; consumers link rcsw::rcsw or the component targets
accordingly (see As a Dependency). Every component uses core and
al, and most also depend on a few others. Those dependencies matter most
in a shared component build, because every shared library must resolve its
own symbols when it is linked.
Dependencies between components#
Every component needs core (status codes, rcsw_alloc()) and
al (types, clocks). Every component that logs (algorithm, console, ds,
multithread, swbus and tool) also needs the ER plugin it was built with. The
other link-time dependencies are:
Component |
Needs |
Because |
|---|---|---|
stdio |
The |
|
er, LOG4CL plugin |
ds |
The installed modules are kept in an |
er, |
stdio |
The plugin prints through |
utils |
al |
|
algorithm |
utils |
The sorts swap elements with |
ds |
algorithm, utils |
|
multithread |
ds, utils |
|
swbus |
multithread, ds |
Packets live in |
tool (grind) |
utils, and the ER plugin’s |
Timing uses the |
console (minimon) |
stdio, utils, version |
Its interactive stream is |
Note
With the LOG4CL plugin, ds and er depend on each other: the data
structures log through LOG4CL, and LOG4CL keeps its modules in an
llist. A shared component build therefore can’t resolve
either library on its own; link them together, or use a monolithic or
static build.
Components lists which components exist on each platform.
Character output#
RCSW_CONFIG_STDIO_PUTCHAR names the function stdio uses to
emit one character, and RCSW_CONFIG_STDIO_GETCHAR the one it
reads with. Where that function lives depends on the build:
Shared build: the stdio library must resolve the function when it is linked, before any application exists. Use a libc function (the default,
putchar/getchar).Static build: the function is resolved when the application is linked, so it can be one the application provides, such as a board support package’s UART routine or a test harness’s capture function.
The bundled printf library expects a putchar_() function; RCSW’s stdio
defines it to forward to stdio_putchar(), so applications don’t
provide it.