Repository navigation
feat(uds_c): a UDS server over DoIP for C firmware, served from tables of handlers - #96
Draft
FelicianoAngulo2 wants to merge 2 commits into
Draft
FelicianoAngulo2 wants to merge 2 commits into
FelicianoAngulo2 wants to merge 2 commits into
Conversation
…s of handlers The new crate holds everything a C firmware needs to serve UDS over DoIP from the stack, against the fixed C contract it ships as include/uds_c.h. UdsLayer and its tables mirror the header's structures, with the layouts asserted for 32-bit targets on both sides and compared field by field with the host's C compiler by a test. TableApp<P: Policy> implements every service uds_services stages over an ordered list of layers, the earlier entry winning, declines through serves those no layer has a handler for, so they are serviceNotSupported, and is built in a const context; the Policy states the layers, the sessions and their timing, the transition rule and the limits, and TableApp::validate refuses tables the server cannot serve safely. A handler answers through uds_record_copy into the record the server lends it while it runs, pends and is canceled through the operation-status protocol, and a reset or session change runs every layer's check and prepare before its response and every layer's execute, the last layer's first, from execute_deferred once the response is out. nal adapts the header's socket calls to edge-nal, cancel-safe; doip names the entity and transport over them, starts discovery and polls the server; the time-driver feature gives embassy-time's clock over uds_now_ms. The crate restates the lint standard with unsafe_code at deny and is not a default member, since it enables simple_doip's connection feature, so CI lints, tests, documents and packages it in its own job, packaging unverified until the APIs it calls are on crates.io, runs its tests under Miri, and builds it for both bare-metal targets at the MSRV. It depends on uds_on_ip, so it is published last and carries the release tag. The embedded probe is unchanged.
uds_record_copy_16_be, uds_record_copy_32_be and uds_record_copy_64_be copy a u16, u32 or u64 into the lent record at an offset, in big-endian order, the byte order of UDS records, bounded as uds_record_copy bounds a copy, so a C handler no longer packs the bytes itself; a float goes as its IEEE 754 bits. The test firmware's seed handler answers through uds_record_copy_16_be.
This branch has not been deployed
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.
The new
uds_ccrate embeds the uds_stack server in C firmware: the firmware lists its identifiers and handlers in C tables (uds_c.h), supplies non-blocking sockets and a clock, and polls the server from one task. Handlers answer throughuds_record_copy, bounded by each identifier's table length, so C never writes server memory.uds_record_copy_16_be,_32_beand_64_becopy an integer big-endian, the byte order of UDS records. The governance tool admits the restated lint table that relaxesunsafe_codefor this crate alone.Depends on #95.
Issue URL
Towards https://github.com/luminartech/halo/issues/5100
Testing
Run on this branch with the commits of the PRs below it, each commit alone and on the stack's top:
validate,governance, the Sphinx needs build, and prose (plain and CI's--strict crates/uds_c)cargo test --workspace --all-features; clippy on the host and forthumbv7em-none-eabihfjust embeddedbuilds on 1.91 for both targets and the size check (matches the baseline)cargo docwith-D warnings;pre-commit run --all-filesci.ymlandcargo package -p uds_c --no-verify