Skip to content

Add heap-free mw::com skeleton and proxy examples#692

Open
jorgecasal wants to merge 16 commits into
eclipse-score:mainfrom
etas-contrib:jorgecasal/heap-free-examples
Open

Add heap-free mw::com skeleton and proxy examples#692
jorgecasal wants to merge 16 commits into
eclipse-score:mainfrom
etas-contrib:jorgecasal/heap-free-examples

Conversation

@jorgecasal

@jorgecasal jorgecasal commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request adds examples that show how to use the mw::com skeleton and proxy without using the heap during normal operation.

The examples are under examples/heap_free/, grouped by scenario:

  • event_send_receive: skeleton sends events, proxy receives them.
  • event_field_update: skeleton updates a field, proxy reads it.
  • start_find_service: proxy finds a service, then uses it.
  • bidirectional_discovery: two apps that both provide and consume.

Each group has its own skeleton, proxy, BUILD file, and config, so it can be built and run on its own. A small helper in heap_check/ checks that no heap allocation happens once the operational phase starts.

Known limitation

The async receive handler cannot run without the heap yet, because the skeleton side allocates when a receiver registers. This is a known framework limit (see the TODO in scoped_event_receive_handler.h). The examples use polling instead.

jorgecasal added 13 commits July 2, 2026 17:02
Add four example binaries demonstrating heap-free usage of the
score::mw::com API for ASIL-B/FFI components:

- event_send_receive/skeleton: zero-copy event send via SHM ring buffer
- event_send_receive/proxy: service discovery and subscription
- event_field_update/skeleton: event and field update without heap
- event_field_update/proxy: polling receive for events and fields

Each example uses a two-phase model where all allocating API calls
(Create, OfferService, Subscribe, FindService) happen during init,
and the operational phase uses only shared-memory-backed operations
(Allocate, Send, GetNewSamples, Update). A lightweight operator new
override in heap_check.h aborts on any heap allocation after
forbid_heap() is called, verifying the constraint at runtime.
Rename examples:: namespace to sensor:: across all heap-free example
sources and update include guard to follow path-based convention.
Add tags = ["lint"] to validate_json_schema_test targets.
Remove redundant comments that restate what the code already says.
Deduplicate BUILD and .cpp header summaries — .cpp is now canonical.
Add "Run alongside the skeleton" note to proxy file headers.
Replace SCORE_LANGUAGE_FUTURECPP_ASSERT_PRD_MESSAGE with the idiomatic
if (!result.has_value()) { LogError; return EXIT_FAILURE; } pattern for
Result<T> checks, matching the ipc_bridge example. Operational-phase error
returns call allow_heap() before returning so teardown stays valid. Remove
redundant comments already covered by the README.
Both applications concurrently offer their own service and discover the
other via StartFindService without deadlocking. Document as Pair D in the
heap-free README.
Add a skeleton to the start_find_service example so it runs in isolation
like the other heap-free groups, instead of depending on the
event_send_receive skeleton.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant