Rebuilding the Runtime
Build the CDX runtime library from source
Application builds default to prebuilt CM4 libraries: lib\Release\libcdx_runtime.a
or lib\Debug\libcdx_runtime.a. Sources are included for optional rebuilds of
libcdx_runtime.a.
Included sources and prerequisites
source\model-runtime\src_lib: CM4 startup integration, runtime and CDX API.source\model-runtime\include: public headers for the standalone source build.source\src\model_ipc: shared IPC and calibration implementation.source\src\cd\outputs: DBC packing implementation.source\model-runtime\release: CMake library build definition used for the prebuilt libraries.licenses\nxpandlicenses\cmsis: required SDK sources, startup assembly, device/CMSIS headers and original third-party notices.
Install Arm GNU GCC 10.3 or newer, CMake 3.21 or newer and Ninja per the
Installing Tools.
The compiler version in release-manifest.json identifies the bundled-library
compiler, not an exact-match application requirement. Use the supplied ARM
toolchain file for matching Cortex-M4, Thumb, FPv4-SP-D16 and hard-float ABI settings.
No separate SDK download, firmware repository, VisualGDB, MATLAB, .NET SDK,
documentation tools or signing client is needed. Ginmake is required for example
applications, not this library. This workflow rebuilds neither bundled cdx.exe
nor CM7 display firmware.
Including GEMS sources grants no open-source licence. The applicable GEMS agreement still governs them. Retain all third-party notices.
Run commands from the application root containing cdx-runtime, in PowerShell
or Command Prompt. Keep outputs outside the downloaded runtime to preserve its
release inventory and prebuilt libraries.
Build and use the sources in an application
With supplied presets:
1cdx-runtime\bin\cdx.exe verify-release --runtime cdx-runtime
2cmake --preset cm4-release -DCDX_RT_BUILD_FROM_SOURCE=ON
3cmake --build --preset cm4-releaseFor Debug, configure and build separately:
CMake builds bundled GEMS and SDK/CMSIS sources and links the resulting library
instead of the prebuilt one. With the supplied layout, the archive is
build\cm4-release\cdx-runtime\runtime-source\lib\libcdx_runtime.a
(or the corresponding cm4-debug path).
Firmware finalization and .cdxmodel packaging are unchanged.
- Release uses
-O3 -DNDEBUG. - Debug uses
-Og -g3. CDX_RT_BUILD_FROM_SOURCEis for CM4 only, notCDX_RT_BUILD_SIMULATOR.
Each build directory caches this choice. cdx compile and
cdx compile --preset cm4-debug reuse it without MATLAB. cdx build also
regenerates/stages the model when recorded inputs or outputs are stale.
matlab+compile always requests generation. Migrate old no-MATLAB scripts to compile.
No compiler on PATH? Add "-DCDX_RT_TOOLCHAIN_BIN=C:\Tools\arm-eabi\bin"
(with your path) to each configure command.
Return to prebuilt libraries:
1cmake --preset cm4-release -DCDX_RT_BUILD_FROM_SOURCE=OFF
2cmake --build --preset cm4-release
3cmake --preset cm4-debug -DCDX_RT_BUILD_FROM_SOURCE=OFF
4cmake --build --preset cm4-debugBuild only the library
No application or Ginmake is needed. Verify the distribution before configuring:
this CMake project performs no inventory checks.
Use absolute toolchain and SDK/CMSIS paths. Replace C:\work\my-project with
your application root:
1cmake -S cdx-runtime\source\model-runtime\release -B build\runtime-release -G Ninja -DCMAKE_BUILD_TYPE=Release "-DCMAKE_TOOLCHAIN_FILE=C:\work\my-project\cdx-runtime\cmake\arm-gcc.cmake" "-DCDX_RT_SDK_ROOT=C:\work\my-project\cdx-runtime\licenses\nxp" "-DCDX_RT_CMSIS_ROOT=C:\work\my-project\cdx-runtime\licenses\cmsis"
2cmake --build build\runtime-release --target cdx_runtimeOutput: build\runtime-release\lib\libcdx_runtime.a.
For Debug, configure with -B build\runtime-debug and -DCMAKE_BUILD_TYPE=Debug,
then build build\runtime-debug.
The standalone project enforces GCC 10.3 minimum but not the manifest’s exact compiler version. Application builds still require GNU C/C++ and Cortex-M4 hard-float flags.
Do not overwrite cdx-runtime\lib or alter the manifest to disguise rebuilt
archives as supplied binaries. Prefer the application source-build option
to leave release files intact.
Local changes and source-level debugging
Unmodified distributions, including bundled sources, pass verify-release.
For intentional source changes, review and retain them, then explicitly disable
content-hash checks:
1cdx-runtime\bin\cdx.exe verify-release --runtime cdx-runtime --skip-manifest-hashes
2cmake --preset cm4-release -DCDX_RT_BUILD_FROM_SOURCE=ON -DCDX_RT_VERIFY_MANIFEST_HASHES=OFF
3cmake --build --preset cm4-releaseThese commands warn that file integrity is unverified. Required files, compiler/ABI compatibility and manifest structure remain checked. The CLI integrity policy lists operations allowing local changes.
Restore original release files and set CDX_RT_VERIFY_MANIFEST_HASHES=ON
to re-enable content-hash validation. Do not disable it for normal builds.
Keep changed public API headers consistent between include and
source\model-runtime\include. Application and standalone builds use their
respective copies.
Debug libraries, including supplied prebuilts, contain relative paths:
- Resolve
./model-runtime/src_liband./src/model_ipcagainstcdx-runtime\source. - Resolve SDK/CMSIS paths against
cdx-runtime, underlicenses\nxpandlicenses\cmsis.
Sources do not replace target/debugger setup or physical-hardware validation.