Skip to content

no_std, regc tool, fix enum resolution, more safety #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rcgoodfellow
Copy link
Collaborator

@rcgoodfellow rcgoodfellow commented Aug 1, 2025

  • Adds no_std support.
  • Adds a regc tool for checking/compiling/viewing RSF specs.
  • Support for descriptors: registers that are not managed directly by the RPI but indirectly through things like DMA descriptor rings.
  • Fixes type resolution issues when enums are referenced across modules.
  • Via no_std support, infallible get/set/mask field operations bitset#4 there are now no unwraps needed on field get/set methods.
  • Eliminate expect/unwrap from generated code and add a test to make sure it does not find it's way back in.

@rcgoodfellow rcgoodfellow changed the title no_std support and regc tool no_std, regc tool, bitset bump, more safety Aug 5, 2025
@rcgoodfellow rcgoodfellow changed the title no_std, regc tool, bitset bump, more safety no_std, regc tool, fix enum resolution, more safety Aug 5, 2025
@rcgoodfellow rcgoodfellow requested a review from Copilot August 5, 2025 21:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds no_std support to the Rust RPI library, introduces a regc tool for working with RSF specs, and eliminates unwrap/expect calls from generated code for improved safety. The changes also fix enum resolution issues across modules and add support for descriptor registers.

  • Converts the library to no_std for embedded compatibility
  • Replaces fallible operations in generated code with proper error handling
  • Restructures the codebase into a workspace with separate rust_rpi crate

Reviewed Changes

Copilot reviewed 14 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
rust_rpi/src/lib.rs Adds no_std support and moves OutOfRange error definition inline
rust_rpi/Cargo.toml Creates new rust_rpi crate package definition
lib/tests/codegen.rs Updates test paths and adds checks to prevent unwrap/expect in generated code
lib/test_data/nic_rpi.rs Shows generated code changes with proper error handling instead of unwraps
lib/src/rust_codegen.rs Major refactoring to eliminate unwraps and improve enum handling
lib/src/parser.rs Improves error handling and updates test paths
lib/src/model.rs Refactors module path handling and improves type resolution
lib/src/lib.rs Removes unused modules from library exports
lib/src/common.rs Adds utility method for Component trait
lib/src/ast.rs Minor debug trait addition and test path updates
lib/Cargo.toml Creates lib crate package definition with workspace dependencies
examples/nic.rsf Updates enum width from 2 to 3 bits
Readme.md Documents new regc tool and primitive types
Cargo.toml Converts to workspace structure
Comments suppressed due to low confidence (3)

rust_rpi/Cargo.toml:4

  • Rust edition "2024" does not exist. The available editions are "2015", "2018", and "2021". This should be changed to "2021" which is the latest stable edition.
edition = "2024"

lib/Cargo.toml:4

  • Rust edition "2024" does not exist. The available editions are "2015", "2018", and "2021". This should be changed to "2021" which is the latest stable edition.
edition = "2024"

Cargo.toml:8

  • Rust edition "2024" does not exist. The available editions are "2015", "2018", and "2021". This should be changed to "2021" which is the latest stable edition.
edition = "2024"

@rcgoodfellow rcgoodfellow marked this pull request as ready for review August 5, 2025 21:18
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