The fic Compiler
fic is the Fiducia compiler. fire drives it; run it directly to
check a project, build an image with explicit flags, or inspect an
intermediate form.
fic <PROJECT_DIR> --board <BOARD> --build-profile <PROFILE> [-o <IMG>] # image (default)
fic <PROJECT_DIR> --check # checks only
fic <PROJECT_DIR> --emit=<FORMAT> [-o <PATH>] # an intermediate form
PROJECT_DIR is a project directory.
By default fic compiles the project to a bootable Microkit image,
<project>.img (default output paths are in the project directory and
named after it): it runs the checks below, generates each PD’s C,
compiles and links it with the imported code, and packs the loader, the
seL4 kernel and the PD ELFs into the image. This needs --board,
--build-profile and the toolchain.
With --check, fic runs the checks only. It writes nothing but the
data-layer headers (include/gen/) that a project’s imported code reads:
$ fic demo/ring/ --check
✓ Parsed 1 system + 2 program files + 0 foreign module(s)
✓ Resolved names
✓ Resolved mapping vaddrs
✓ Built the resolved AST
✓ Built the typed AST
✓ Checked process bodies (tail references)
✓ Bound the kernel entry points of every protection domain
✓ Built the graphs and checked them (notified: receive-headed, receives at the head only; notified and protected: guarded choices)
✓ Type-checked information flow
✓ Checked channel dependency acyclicity (WF2)
--emit formats
--emit writes an intermediate form instead of the image:
| Format | Output (default) | Description |
|---|---|---|
rawast | stdout | The parsed syntax tree as JSON, before name resolution. |
ast | stdout | The syntax tree as JSON, after the front end’s checks. |
rast | stdout | The resolved tree as JSON: every name an id, vaddrs allocated. |
tast | stdout | The typed tree as JSON: every declaration typed, constants folded. |
ccfg | stdout | The graphs as JSON: per program, one graph per entry point. |
c | <project>/build/gen/ | The generated C, one file per PD; -o names the directory. |
dot | <project>.dot | The topology as a Graphviz graph: dot -Tpng <project>.dot -o <project>.png. |
xta | <project>.xta | The UPPAAL model, as the text verifyta reads. With --pretty, the same model as the XML the UPPAAL GUI opens, <project>.xml. Queries are yours to write: see fire verify. |
Only --check and the image run WF2.
Well-formedness
The Lean model’s flattening theorem assumes the checks below. All but the
tail references and the Sync receives are warnings: a finding is a program the theorem does not cover,
not a rejected one. The receive checks read the graph of the process bound
to microkit.notified, every process it reaches unfolded. The choice check
reads the bodies of the processes bound to microkit.notified and
microkit.protected, each choice on its own guards. Init is not checked.
The head is the steps an invocation starts with, through [], the left of
; and a called process. There every branch is a receive, and the message
picks the branch, and a branch is a receive, not a call. Everywhere else
the guards decide, each choice by its own: guards above a ; do not decide
the choice after it.
default is sugar: ρ₁ [] … [] ρₙ default ρ is ρ₁ [] … [] ρₙ [] [¬(b₁ ∨ … ∨ bₙ)] ρ,
the bᵢ the other branches’ guards (true when unguarded).
| Check | Finding |
|---|---|
Tail references (tailRec) | Error. A process references one being lowered in non-tail position. |
Receive-headed notified (recvHeaded) | The head has a guard or a step that is not a receive, in a notified that receives. |
| Receives at the head | A receive or IRQ await outside the head; two at the head on one channel or IRQ. |
Sync receives in protected | Error. The protected head is not unguarded Sync receives, one per channel; a receive or IRQ await after it; a Sync receive in init or notified. |
| Channel dependency (WF2) | The channels form a cycle; --allow-wf2-cycles skips the check. |
| Guarded choices | Outside the head, per choice: an unguarded branch, two branches that can both be enabled, or a state where none is. At the head: a branch that is a call. |
A program with a finding in either receive row is outside the deadlock freedom fic guarantees, and the warning says so.
Guards are decided over bool variables, foreign calls (opaque, equal calls
equal) and comparisons with constants at the variables’ widths. A warning can
be spurious; a clean result is a proof. Unlike the Lean model’s Wf3, every
pair of branches is compared, and a branch need not start with an event:
[g] e -> P [] [!g] Skip is decided.
Options
--check
Run the checks only. Conflicts with --emit.
-o, --output <PATH>
The output path, instead of the default for the image or the emit format.
-I, --include <DIR>
A directory searched for the headers that imported C files #include,
after the project directory and its include/ (repeatable, in order).
The C reader, Frama-C and the image build’s compiler all search it.
fire passes each project.include
entry this way.
--board <BOARD>, --build-profile <PROFILE>
Required for the image: the Microkit board (e.g. qemu_virt_aarch64)
and build profile (debug or release), a directory under
$MICROKIT_SDK/board/.
--pretty
With --emit=xta: write the model as the UPPAAL GUI’s XML.
--allow-wf2-cycles
Skip the WF2 check. WF2 rejects every cyclic channel dependency graph,
including systems that are deadlock-free (e.g. the asymmetric dining
philosophers, Hoare CSP §2.5.4, or demo/pingpong’s ping <-> pong).
Without the flag, a cycle is a warning and the build goes on. Use it when
deadlock freedom is established another way, typically by
fire verify on the model.
Language server
The Language Server Protocol server is a separate binary, fic-lsp
(analogous to rust-analyzer vs rustc), built from the fic-lsp
workspace crate and used by the editor integrations under editors/.
It ships in the release tarball beside fic and fire (see
Installation); it speaks LSP on stdio.
Environment variables
See Installation.
Diagnostics
Errors and warnings are rendered as annotated source snippets, pointing
at the .fis / .fi source: parse errors, duplicate names, undeclared
references, vaddr misalignment and overlaps, information-flow violations,
and the well-formedness findings.
Exit status
fic exits 0 on success, warnings included, and non-zero on any
error, so it is safe to use in scripts and CI.