Skip to content

fix: build the FreeRTOS pack at any tick rate - #756

Merged
DavidCozens merged 2 commits into
mainfrom
fix/freertos-sysuptime-gate
Aug 12, 2026
Merged

fix: build the FreeRTOS pack at any tick rate#756
DavidCozens merged 2 commits into
mainfrom
fix/freertos-sysuptime-gate

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Closes #725.

Platform/FreeRtos/CMakeLists.txt carries SolidSyslogFreeRtosSysUpTime.c in
the SolidSyslogFreeRtos INTERFACE library, so linking SolidSyslog::FreeRtos
compiles that translation unit whether or not the integrator uses the callback.
Its static assert required a 64-bit TickType_t, or a 32-bit one whose
configTICK_RATE_HZ divides 100 — so a 32-bit target at FreeRTOS's own 1000 Hz
default failed to compile the whole pack, the mutex with it. Nothing we build
sees this: every FreeRTOSConfig.h in the repository is 100 Hz.

Change Description

The issue proposed gating the translation unit on the tick configuration, the
way the lwIP DNS resolver gates on LWIP_DNS. That cannot be written: the
condition has to hold in the preprocessor, and every FreeRTOS config — ours and
the form FreeRTOS's own demos use — defines the rate as a cast,
#define configTICK_RATE_HZ ((TickType_t) 100). #if (100 % configTICK_RATE_HZ) == 0 is a hard error on that, not a false, so the gate would break exactly the
configurations it exists to protect. Only the tick width is preprocessor-safe.

So the assert goes and the limit is documented instead. The adapter builds in
every configuration, and the two places an integrator looks say where the value
wraps early and what to do about it:

  • the adapter's own header, since that is where its behaviour is stated;
  • the FreeRTOS platform page, as a warning naming the 1000 Hz default
    explicitly and asking for an integrator-supplied
    SolidSyslogSysUpTimeFunction.

SolidSyslogSysUpTimeFunction in SolidSyslogMetaSd.h gains the property the
adapter actually trips over — the wrap must reach 2^32 hundredths, so a source
counter that rolls over sooner has to carry the phase across. It gave units and
the fact of wrapping but not that, so someone writing their own implementation
had nothing to check against. That doc comment is the contract's home; the
platform page and the adapter header link it rather than restating it.

1000 Hz is the default rate, so shipping a documented limit there is not the
end of it. #755 is raised against 0.2.0 to make the conversion correct at any
tick rate, and both the header note and the platform-page warning name it.

Test Evidence

No behaviour changed: the conversion is untouched and only a compile-time
assert was removed, so the existing tests are the coverage. All 22 test
executables pass on the freertos-host lane, SolidSyslogFreeRtosSysUpTimeTest
among them (4 tests, 4 checks). misra_suppressions.txt line-drift for the
removed assert was corrected by hand.

The issue asked for the gate to be proved by building in an unsupported
configuration. With no gate left there is nothing to prove that way, and adding
a second tick rate to the consumer-smoke config was dropped as sprawl.

Areas Affected

Platform/FreeRtos/ (tier 2) and the SolidSyslogSysUpTimeFunction doc comment
in Core/Interface/ (tier 1) — comments only, no signature or behaviour change.
Documentation and misra_suppressions.txt. Integrators outside the supported
tick envelope get a building pack where they previously got a compile error.

Summary by CodeRabbit

  • Documentation

    • Clarified sysUpTime requirements for monotonic RFC 3418 TimeTicks, including rollover and counter scaling behaviour.
    • Documented supported FreeRTOS tick configurations and limitations that may cause early uptime rollover.
    • Added guidance on mitigations, including providing a custom uptime function where required.
  • Compatibility

    • Unsupported 32-bit tick configurations are no longer rejected during compilation; their uptime limitations are now documented.

The sysUpTime adapter carried a static assert requiring a 64-bit TickType_t,
or a 32-bit one whose configTICK_RATE_HZ divides 100. The umbrella target
compiles that translation unit unconditionally, so an ordinary 1000 Hz
configuration cost the integrator the whole pack, the mutex included.

Remove the assert. The adapter builds everywhere and its header states where
the value wraps early; #755 tracks removing the limit itself.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR removes the FreeRTOS sysUpTime compile-time restriction, documents supported tick configurations and early rollover behaviour, clarifies the RFC 3418 uptime contract, and updates the related MISRA suppression.

Changes

FreeRTOS sysUpTime behaviour

Layer / File(s) Summary
Uptime contract and adapter behaviour
Core/Interface/SolidSyslogMetaSd.h, Platform/FreeRtos/Interface/SolidSyslogFreeRtosSysUpTime.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c
The uptime contract now requires monotonic, phase-preserving RFC 3418 wrapping. The FreeRTOS adapter removes compile-time configuration rejection and documents divide-before-scale arithmetic and uint32_t wrapping.
Platform guidance and MISRA alignment
docs/platforms/freertos/index.md, misra_suppressions.txt
The platform documentation states tick-width and tick-rate limits, rollover behaviour, and available alternatives. The MISRA Rule 5.7 suppression targets the updated source line.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 755 — The PR addresses the documented early-wrap limitation in the FreeRTOS sysUpTime implementation but does not add rollover state.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The change removes the assertion, but it does not implement the required configuration gate, link-error behaviour, sibling gating, or build proof [#725]. Implement and verify the requested gate for the uptime sources, or update #725 and its acceptance criteria to approve the documented alternative.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: allowing the FreeRTOS pack to build at unsupported tick rates.
Description check ✅ Passed The description includes all required sections and explains the change, test evidence, affected areas, and issue context.
Out of Scope Changes check ✅ Passed The changes remain within the stated FreeRTOS build, uptime contract, documentation, and MISRA suppression scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/freertos-sysuptime-gate

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/platforms/freertos/index.md`:
- Around line 40-45: The FreeRTOS uptime documentation incorrectly generalizes
the 50-day rollover and misstates issue `#755`. Update the warning in the uptime
conversion section to explain that non-dividing rates lose phase continuity when
a 32-bit TickType_t rolls over, with roughly 50 days applying specifically to
1000 Hz and other rates having different periods; describe `#755` as tracking
support for arbitrary tick-rate conversion rather than removal of the
compile-time limit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b63e6b26-8f06-4211-86e4-e4469e97f00d

📥 Commits

Reviewing files that changed from the base of the PR and between e268841 and c250d39.

📒 Files selected for processing (5)
  • Core/Interface/SolidSyslogMetaSd.h
  • Platform/FreeRtos/Interface/SolidSyslogFreeRtosSysUpTime.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c
  • docs/platforms/freertos/index.md
  • misra_suppressions.txt

Comment thread docs/platforms/freertos/index.md Outdated
@DavidCozens

Copy link
Copy Markdown
Collaborator Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Reviews paused.

@github-actions

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   JUnit   build-linux-gcc (Whole Project): ✅ successful — 1529 passed
   JUnit   build-freertos-host-tdd-plustcp (Whole Project): ✅ successful — 1881 passed
   JUnit   build-linux-clang (Whole Project): ✅ successful — 1460 passed
   JUnit   sanitize-linux-gcc (Whole Project): ✅ successful — 1460 passed
   JUnit   integration-linux-openssl (Whole Project): ✅ successful — 16 passed
   JUnit   integration-linux-mbedtls (Whole Project): ✅ successful — 14 passed
   JUnit   integration-windows-openssl (Whole Project): ✅ successful — 16 passed
   JUnit   bdd-linux-syslog-ng (Whole Project): ✅ successful — 49 passed, 3 skipped
   JUnit   bdd-windows-otel (Whole Project): ✅ successful — 46 passed, 6 skipped
   JUnit   bdd-freertos-qemu-plustcp (Whole Project): ✅ successful — 45 passed, 7 skipped
   JUnit   bdd-freertos-qemu-lwip (Whole Project): ✅ successful — 45 passed, 7 skipped
   JUnit   build-windows-msvc (Whole Project): ✅ successful — 1302 passed
   JUnit   build-linux-tunable-override (Whole Project): ✅ successful — 1460 passed
   ⚠️   Clang-Tidy (Whole Project): No warnings
   ⚠️   CPPCheck (Whole Project): No warnings


Created by Quality Monitor v4.15.0 (#82d77af). More details are shown in the GitHub Checks Result.

@DavidCozens
DavidCozens merged commit 756bf64 into main Aug 12, 2026
37 checks passed
@DavidCozens
DavidCozens deleted the fix/freertos-sysuptime-gate branch August 12, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FreeRtos pack fails to build at any tick rate above 100 Hz, including the Mutex

1 participant