fupsrl

04 — xcpWorkflow API: Model, Build, and Target Settings

2 min read Updated 15 July 2026

Call the public entry point with MATLAB name/value pairs. Option names are case-sensitive. The returned cfg structure contains resolved paths, target/toolchain information, discovered tasks, EPK, and generated artefact filenames.

cfg = xcpWorkflow("Name", Value, ...);

Model, output, and code-generation settings

Input Default Use
Model testSimulinkRaspberry Simulink model name without .slx.
WorkDir Project root Root used for relative paths and automatic modelParams.m discovery.
BuildDir Automatic Generated RTW directory. Normally leave empty so RTW.getBuildDir resolves it.
StageDir <WorkDir>/xcp_build Dedicated temporary source staging directory.
OutDir <WorkDir>/xcp_out Destination for ELF, A2L, HEX, and ProF outputs.
Deploy false Upload, install, start, and verify the runtime through SSH after the build.
GenericErt true Use temporary unsaved HardwareBoard=None and ert.tlc generation. Keep enabled for portable builds.
TargetProfile linux-aarch64 Selects ABI defaults: linux-aarch64, linux-armv7, linux-x86_64, or custom.
TargetArch Profile value aarch64, armv7, or x86_64. Required for a custom profile and validated against the ELF.
ProdHWDeviceType Profile value Simulink production-hardware setting. Required for a custom profile.
ModelInitScript auto auto runs <WorkDir>/modelParams.m when present; pass a script path or "" to disable it.

Build backend and local toolchain

Input Default Use
BuildMode local-cross local-cross builds on the host/WSL. remote is the legacy native target build. local is accepted as an alias.
Offline true Blocks remote build, deployment, and XCPlite updates. It does not block one-time local toolchain provisioning.
LocalBuildRunner auto auto, wsl, or native; selects where local build commands run.
WslDistribution auto WSL distribution name, or automatic compiler-aware selection.
AutoProvisionToolchain true Install missing Debian/Ubuntu WSL packages for the chosen profile.
LocalMakeCommand make Make executable on the selected local build host.
LocalCompiler Profile value C compiler; mandatory for custom.
LocalCxxCompiler Profile value C++ compiler; mandatory for custom.
LocalStrip Profile value Strip executable used when creating the runtime image.
LocalSysroot Empty Optional target Linux sysroot for userspace/GLIBC compatibility.
LocalCpuFlags Empty Optional CPU flags, for example -mcpu=cortex-a72. Leave empty for broad compatibility.
LocalExtraCFlags Empty Additional C/C++ compile flags.
LocalExtraLdFlags Empty Additional linker flags.
BuildJobs 0 Parallel make jobs. Zero selects the host CPU count.
RuntimeElfFile Automatic Advanced runtime ELF override; normally <OutDir>/<Model>.runtime.
StripRuntime true Strips debug sections from the deployed/flashed image while keeping the debug ELF for A2L/DWARF.
AllowExternalStage false Permit StageDir outside WorkDir. Use only for a dedicated staging location.

Common build recipes

% Explicit Ubuntu WSL selection
cfg = xcpWorkflow("Model", "myModel", ...
    "LocalBuildRunner", "wsl", ...
    "WslDistribution", "Ubuntu");

% Reproducible toolchain managed outside the workflow
cfg = xcpWorkflow("Model", "myModel", ...
    "AutoProvisionToolchain", false, ...
    "LocalCompiler", "aarch64-linux-gnu-gcc", ...
    "LocalCxxCompiler", "aarch64-linux-gnu-g++");

Validation rules worth knowing

The stage directory is guarded against accidental overlap with the project root, output directory, or XCPlite directory. Build job count must be a non-negative integer. A custom profile must specify target architecture, production hardware type, C compiler, and C++ compiler.