Skip to content

esp/gizclaw: Remove the local timespec_get shim #17

Description

@idy

Background

This issue supersedes h2vivi/firmwares#430 using the current GizOS ESP integration.

ESP-IDF 6.0's selected ESP32-S3 picolibc headers declare timespec_get(), but the target archives do not define it. GizOS currently links by carrying native_component_src/esp-idf6.x/h2_gizclaw/src/h2_esp_gizclaw_time_compat.c, a weak local definition of a standard C library symbol. Espressif accepted the diagnosis in espressif/esp-idf#18889 and is tracking the upstream implementation in open PR espressif/esp-idf#18890. The GizClaw C SDK still references timespec_get() in its default platform, even though GizOS injects its own PAL-backed clock for the client.

Goal

Consume an owning upstream portability fix and delete the GizOS-local weak timespec_get() ABI shim while keeping every maintained ESP32-S3 GizClaw firmware linkable.

Non-goals

  • Do not switch the repository from picolibc to newlib.
  • Do not retain the shim in another board, launcher, component or library.
  • Do not change GizClaw deadline semantics or replace monotonic time with wall-clock time in the injected GizOS platform.
  • Do not advance the pinned ESP-IDF or GizClaw revision without reviewing the full immutable dependency diff and native build matrix.

Code Changes Tree

tools/bazel/native_versions/esp_idf_commit.txt             # pin the first reviewed ESP-IDF revision that contains the upstream libc fix when that route is selected
tools/bazel/tests/test_external_native_roots.py             # reject a reintroduced local standard-library compatibility symbol in GizOS components
MODULE.bazel                                               # update the immutable GizClaw revision only if the owning SDK portability fix is the selected route
MODULE.bazel.lock                                          # synchronize the selected immutable upstream revision and integrity metadata
native_component_src/esp-idf6.x/h2_gizclaw/src/h2_esp_gizclaw_time_compat.c # (delete) remove the weak local timespec_get definition
guides/zh/developing/bazel.md                              # record the final ESP-IDF/GizClaw revision and link-validation boundary
guides/zh/developing/components/esp_idf6_x.md              # document that the ESP GizClaw component no longer owns libc ABI symbols

The component BUILD rule already discovers tracked component sources; deleting the compatibility file must remove it from both Bazel-declared native inputs and ESP-IDF CMake source projection without adding an empty replacement.

Design

Owning fix selection

Prefer the reviewed Espressif libc implementation once PR #18890 is present in a supported pinned ESP-IDF revision. If that cannot be consumed independently of a broader unsupported SDK update, fix the GizClaw default-platform portability in GizClaw/gizclaw and update GizOS to that immutable revision. In either route, the final GizOS tree contains no implementation of timespec_get().

The selected route and revision must be recorded in the Issue/PR with evidence that the defining symbol comes from its owning upstream archive or that no selected GizClaw object references it.

Clock boundary

libs/gizclaw continues to inject h2_pal_time_get_monotonic_ms() through gzc_platform_t.time_instant_ms. Removal of the default-platform link defect must not change that runtime clock owner or the bounded writer/platform contract.

Failure behavior

Unsupported SDK revisions, absent libc symbols, duplicate strong/weak definitions and accidental fallback to a host libc must fail during the exact ESP firmware link. A host test or Bazel query is not sufficient proof.

Test And Acceptance Criteria

Acceptance Criteria

  • The selected pinned upstream revision owns the portability fix and its immutable revision/integrity is recorded.
  • GizOS contains no definition, declaration override or linker injection for a local timespec_get() implementation.
  • libs/gizclaw still injects the PAL monotonic clock and its host contract tests pass.
  • Maintained ESP32-S3 GizClaw firmware images link without an undefined or duplicate timespec_get symbol.
  • No unrelated SDK, libc or time-semantics change is bundled with the cleanup.

Validation

rg -n "timespec_get" native_component_src boards projects libs
bazel mod deps --lockfile_mode=error
bazel test --config=macos_arm64 //libs/gizclaw:all
bazel build --config=esp32s3 //projects/example/targets/h2loader_tar_zlib/gizclaw-ping-speed/amoled:package
make guides-build
git diff --check
  • Inspect the final ESP32-S3 link map/archive symbols to prove the symbol owner or absence of the reference.
  • If the owning upstream change is not yet available in a supported revision, record BLOCKED with the upstream PR and keep this Bug open; do not remove the only linkable workaround prematurely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions