Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f68a374
build: add ITF, rules_oci, rules_pkg and IFS toolchain
gordon9901 Aug 3, 2026
8a6b790
build: add json-schema-validator lint rule
gordon9901 Aug 4, 2026
359487a
feat(time_slave): add JSON config, schema and parser
gordon9901 Aug 4, 2026
c0d0585
docs(time_slave): add QNX setup manual
gordon9901 Aug 4, 2026
a34008c
test(time_slave): add QNX reference integration
gordon9901 Aug 4, 2026
73b425d
refactor: move json_schema_validator to tools/lint
gordon9901 Aug 19, 2026
c245a6f
Merge branch 'main' into ecarx_pr5_qnx_config_and_docs
gordon9901 Aug 19, 2026
c4ed1ec
chore: fix lockfile and copyright headers
gordon9901 Aug 19, 2026
1d6e2fc
Merge branch 'main' into ecarx_pr5_qnx_config_and_docs
gordon9901 Aug 20, 2026
1362635
fix: add manuals to time_slave docs toctree
gordon9901 Aug 20, 2026
f45b81f
fix: remove dangling doc reference in qnx_setup
gordon9901 Aug 20, 2026
b7993b2
fix: resolve MODULE.bazel.lock conflict with main
gordon9901 Aug 27, 2026
585f170
Merge branch 'main' into ecarx_pr5_qnx_config_and_docs
gordon9901 Aug 27, 2026
1b9b7f1
fix: inline json in qnx_setup to stay inside bundle root
gordon9901 Aug 28, 2026
d377229
test: add config_parser unit tests to boost coverage
gordon9901 Aug 28, 2026
d0e1103
fix: resolve MODULE.bazel.lock conflict with main
gordon9901 Aug 28, 2026
5d18206
fix: clang-format config_parser_test.cpp string alignment
gordon9901 Aug 28, 2026
0903bd9
docs(time_slave): restructure qnx_setup and config guide
gordon9901 Sep 1, 2026
7f61c0c
test(time_slave/qnx): generate SSH host key at boot
gordon9901 Sep 1, 2026
2cc1639
fix: resolve MODULE.bazel.lock conflict with main
gordon9901 Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ build:arm64-linux --extra_toolchains=@score_gcc_aarch64_toolchain//:aarch64-linu
build:x86_64-qnx --config=shared
build:x86_64-qnx --platforms=@score_bazel_platforms//:x86_64-qnx-sdp_8.0.0-posix
build:x86_64-qnx --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp_8.0.0
build:x86_64-qnx --extra_toolchains=@score_qnx_x86_64_ifs_toolchain//:ifs-x86_64-qnx-sdp_8.0.0

# -------------------------------------------------------------------------------
# Config dedicated to target platform CPU:arm64 and OS:QNX
Expand Down
53 changes: 53 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use_repo(
"score_gcc_x86_64_toolchain",
"score_qcc_aarch64_toolchain",
"score_qcc_x86_64_toolchain",
"score_qcc_x86_64_toolchain_pkg",
)

## Custom Module Loading
Expand Down Expand Up @@ -215,3 +216,55 @@ pip.parse(
requirements_lock = "//third_party/codeql:requirements_lock.txt",
)
use_repo(pip, "codeql_coding_standards_pip_hub")
## Integration Test Framework dependencies

bazel_dep(name = "score_itf", version = "0.2.0", dev_dependency = True)
git_override(
module_name = "score_itf",
commit = "98118b1fcd6c53244fb276e2c7668faaf15d2e10", # tag v0.4.0
remote = "https://github.com/eclipse-score/itf.git",
)

Comment on lines +221 to +227

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just observed this checking something in the code. Suggested simplification plus update to itf 0.5.0:

Suggested change
bazel_dep(name = "score_itf", version = "0.2.0", dev_dependency = True)
git_override(
module_name = "score_itf",
commit = "98118b1fcd6c53244fb276e2c7668faaf15d2e10", # tag v0.4.0
remote = "https://github.com/eclipse-score/itf.git",
)
bazel_dep(name = "score_itf", version = "0.5.0", dev_dependency = True)

bazel_dep(name = "bazel_skylib", version = "1.9.0", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.2.0", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.2.7", dev_dependency = True)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
oci.pull(
name = "ubuntu_24_04",
digest = "sha256:2e863c44b718727c860746568e1d54afd13b2fa71b160f5cd9058fc436217b30",
image = "ubuntu",
platforms = ["linux/amd64"],
tag = "24.04",
)
use_repo(oci, "ubuntu_24_04", "ubuntu_24_04_linux_amd64")

bazel_dep(name = "score_rules_imagefs", version = "0.0.3", dev_dependency = True)

imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True)
imagefs.toolchain(
name = "score_qnx_x86_64_ifs_toolchain",
sdp_to_import = "@score_qcc_x86_64_toolchain_pkg",
# imagefs extension does not remap 8.0.4 -> 8.0.0 for platform constraints,
# so use "8.0.0" here to match the only available sdp_version constraint
# value in @score_bazel_platforms. The actual SDP binary version comes
# from sdp_to_import (8.0.4).
sdp_version = "8.0.0",
target_cpu = "x86_64",
target_os = "qnx",
type = "ifs",
)
use_repo(imagefs, "score_qnx_x86_64_ifs_toolchain")

## JSON Schema validation (build-time lint)

bazel_dep(name = "nlohmann_json", version = "3.11.3", dev_dependency = True)

http_archive(
name = "json_schema_validator",
build_file = "//third_party/json_schema_validator:json_schema_validator.BUILD",
dev_dependency = True,
integrity = "sha256-g/YdgRL0heDT8ectUWELo5JLF5kmqDdq7zwDh3D68gI=",
strip_prefix = "json-schema-validator-2.1.0",
urls = ["https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.1.0.tar.gz"],
)
51 changes: 51 additions & 0 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions score/time_slave/config/qnx/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

exports_files(
["time_slave_qnx_config.json"],
visibility = ["//visibility:public"],
)
18 changes: 18 additions & 0 deletions score/time_slave/config/qnx/time_slave_qnx_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"iface_name": "emac0",
"domain_number": 0,
"pdelay_req_interval_ms": 1000,
"pdelay_warmup_ms": 2000,
"sync_timeout_ms": 3300,
"jump_future_threshold_ns": 500000000,
"shm_path": "/gptp_shmem",
"phc": {
"enabled": true,
"device": "emac0",
"step_threshold_ns": 100000000
},
"qnx": {
"bpf_device_prefix": "/dev/bpf",
"see_sent": true
}
}
109 changes: 103 additions & 6 deletions score/time_slave/docs/manuals/config/configuration_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,41 @@
TimeSlave Configuration
=======================

The behavior of the ``TimeSlave`` is controlled by the ``GptpEngineOptions`` structure. Currently, only a subset of these options can be overridden at runtime via command-line arguments. For all other options, the hard-coded default values are used.
The behavior of the ``TimeSlave`` is controlled via a JSON configuration
file. The schema is defined in
``score/time_slave/src/application/configuration/time_slave_config_schema.json``
and covers all runtime parameters: network interface, gPTP timing, PHC
adjustment, shared-memory path, and platform-specific options.

Configuration file location
---------------------------

The configuration file is resolved in the following order:

1. ``--config <path>`` command-line argument.
2. ``TIMESLAVE_CONFIG`` environment variable.
3. ``./etc/time_slave_config.json`` relative to the process working
directory.

If no configuration file is found at the resolved path, TimeSlave uses
built-in defaults (equivalent to the schema defaults) and logs an
informational message.

For backwards compatibility, the ``GPTP_IFACE`` environment variable
(when set) still overrides the ``iface_name`` field after the JSON config
is loaded.

Command-Line Arguments
-----------------------

The following argument is available to configure the ``TimeSlave`` at runtime: <tbd>
The following command-line arguments are available to configure the
``TimeSlave`` at runtime:

``--config <path>``
Path to the JSON configuration file. When provided, it takes precedence
over the ``TIMESLAVE_CONFIG`` environment variable and the default
``./etc/time_slave_config.json`` path. See :ref:`time_slave_configuration`
for the full resolution order.

Default Configuration (`GptpEngineOptions`)
--------------------------------------------
Expand Down Expand Up @@ -59,14 +87,83 @@ The following table lists all available options and their default values as defi
- ``disabled``
- Configuration for hardware clock (PHC) adjustments. Disabled by default.

PHC configuration
-----------------

To enable PTP Hardware Clock adjustment, set ``"phc"."enabled"`` to
``true``. The ``device`` field identifies the network interface whose
PTP clock is adjusted (e.g. ``"emac0"`` on QNX, ``"eth0"`` on Linux):

.. code-block:: json

{
"phc": {
"enabled": true,
"device": "emac0",
"step_threshold_ns": 100000000
}
}

When disabled (the default), gPTP runs in slave-only mode without
disciplining a hardware clock.

QNX-specific fields
-------------------

The optional ``"qnx"`` section holds QNX-only settings (ignored on
Linux):

.. code-block:: json

{
"qnx": {
"bpf_device_prefix": "/dev/bpf",
"see_sent": true
}
}

``bpf_device_prefix``
Path prefix for the BPF (Berkeley Packet Filter) devices used for raw
Ethernet frame capture. Defaults to ``/dev/bpf``.

``see_sent``
When ``true``, sent frames are also delivered to the RX BPF. This is
required to capture TX hardware timestamps for Pdelay_Req T1
measurement. Defaults to ``false``.

Example Invocation
------------------

.. code-block:: bash

# Start the TimeSlave, overriding the default interface name "emac0"
./time_slave
# Start the TimeSlave with a custom configuration file
./time_slave --config etc/time_slave_config.json

# Use a non-default interface without a config file (backwards compat)
GPTP_IFACE=emac1 ./time_slave

Example
-------

A representative QNX configuration:

.. code-block:: json

.. attention::
The runtime configuration is currently incomplete. To change parameters, you must modify the default values in the ``GptpEngineOptions`` structure and recompile the application. A comprehensive configuration mechanism (e.g., via a JSON file) will come soon.
{
"iface_name": "emac0",
"domain_number": 0,
"pdelay_req_interval_ms": 1000,
"pdelay_warmup_ms": 2000,
"sync_timeout_ms": 3300,
"jump_future_threshold_ns": 500000000,
"shm_path": "/gptp_shmem",
"phc": {
"enabled": true,
"device": "emac0",
"step_threshold_ns": 100000000
},
"qnx": {
"bpf_device_prefix": "/dev/bpf",
"see_sent": true
}
}
Loading
Loading