Add heap-free mw::com skeleton and proxy examples#692
Open
jorgecasal wants to merge 16 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds examples that show how to use the
mw::comskeleton and proxy without using the heap during normal operation.The examples are under
examples/heap_free/, grouped by scenario: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.