Skip to content

Modernize EC to embedded-services main#4

Open
dymk wants to merge 1 commit into
mainfrom
dymk/issue-14-ec-modernization
Open

Modernize EC to embedded-services main#4
dymk wants to merge 1 commit into
mainfrom
dymk/issue-14-ec-modernization

Conversation

@dymk

@dymk dymk commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Bump odp-embedded-controller off the stale embedded-services@62d4ea9 pin onto current main (6d7dbbf, which carries F1.0's default_mctp_serial constructor from OpenDevicePartnership/embedded-services#906), porting the shared mock to:

  • the new battery Registration model (bs::Service::new(ArrayRegistration{ fuel_gauges: [&Mutex<GlobalRawMutex, MockFuelGauge>] }); the OEM drives the fuel gauge directly via update_dynamic_data()), replacing the removed Device / MockBattery / execute_event API; and
  • the new spawn_service! init-closure form (|resources| Service::new(resources, InitParams{..})) for the thermal sensor/fan and time-alarm services.

Why

The EC was 8 commits behind embedded-services main and could not consume the new default_mctp_serial constructor. This bump unblocks dropping the temporary fork [patch] override in the dev-qemu sp-serial work.

Scope

  • Shared code (the whole migration): 4 files in platform/platform-common/src/mock/{battery,thermal,time_alarm,mod}.rs.
  • Per-platform: lock bump on all 5 platforms (dev-qemu, dev-npcx, dev-imxrt, dev-mcxa, dev-mec); cargo-vet exemptions (crc 3.4.0, crc-catalog 2.5.0, embedded-mcu-hal 0.3.0) on the 4 CI platforms. No per-platform code changes — every platform consumes platform_common::mock only.
  • dev-mec (not in the CI matrix) is lock-bumped for local-build consistency but has no supply-chain/ store, so it gets no exemptions.

Verification

  • cargo check --locked + cargo clippy --locked: clean on all 5 platforms (host).
  • cargo fmt --check: clean.
  • CI here validates the gates that need the full environment: cargo vet, cargo deny, feature-powerset, and the dev-qemu integration-test.

Note for follow-up

The battery mock now emits MockFuelGauge values (3S Li-ion pack ~80%) rather than the old MockBattery constants. The current green two-QEMU e2e asserts only thermal GetTmp (MockSensor values unchanged), so there's no regression; a future Battery two-QEMU e2e must assert against the MockFuelGauge values.

Assisted-by: GitHub Copilot:claude-opus-4.8

@dymk dymk force-pushed the dymk/issue-14-ec-modernization branch 2 times, most recently from 8d43637 to aef5429 Compare June 26, 2026 21:29
Bump the embedded-services git pin off the stale 62d4ea9 onto current
main (6d7dbbf, which carries the new default_mctp_serial constructor),
porting the shared mock to the new battery Registration model and the
new spawn_service! init-closure form.

platform-common/src/mock:
- battery.rs: rewrite to the fuel-gauge Registration model. The OEM
  owns a Mutex<GlobalRawMutex, MockFuelGauge> and drives it directly;
  the service is bs::Service::new(ArrayRegistration{..}). Replaces the
  removed Device / MockBattery / execute_event API.
- thermal.rs: wrap the sensor and fan spawn_service! args in the new
  |resources| Service::new(resources, InitParams{..}) closures.
- time_alarm.rs: switch to the positional tas::Service::new closure.
- mod.rs: update the relay-handler battery type argument.

Bump all five platform locks (dev-mec was at 5cc395f1) and add
crc / crc-catalog / embedded-mcu-hal 0.3.0 cargo-vet exemptions to the
four CI platforms (dev-mec has no supply-chain store). No per-platform
code changes: every platform consumes platform_common::mock only.

dev-qemu unifies embedded-mcu-hal on crates.io: time-alarm-service
(from embedded-services main), embassy-qemu-riscv, and dev-qemu's own
HID dep all use the crates.io 0.3.0 rather than mixing crates.io and
git sources of the identical crate, which collide on defmt's derive
symbols under LTO (surfaces only in the release build, not cargo check).

Unblocks dropping the F1.1 fork [patch] override.

Assisted-by: GitHub Copilot:claude-opus-4.8
@dymk dymk force-pushed the dymk/issue-14-ec-modernization branch from aef5429 to 3563771 Compare June 26, 2026 22:12
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.

1 participant