diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml index d168dfb7..8081f901 100644 --- a/.github/workflows/changelog.yaml +++ b/.github/workflows/changelog.yaml @@ -19,6 +19,8 @@ jobs: filters: | riscv: - 'riscv/**' + riscv-macros: + - 'riscv-macros/**' riscv-pac: - 'riscv-pac/**' riscv-peripheral: @@ -39,6 +41,14 @@ jobs: changeLogPath: ./riscv/CHANGELOG.md skipLabels: 'skip changelog' missingUpdateErrorMessage: 'Please add a changelog entry in the riscv/CHANGELOG.md file.' + + - name: Check for CHANGELOG.md (riscv-macros) + if: steps.changes.outputs.riscv-macros == 'true' + uses: dangoslen/changelog-enforcer@v3 + with: + changeLogPath: ./riscv-macros/CHANGELOG.md + skipLabels: 'skip changelog' + missingUpdateErrorMessage: 'Please add a changelog entry in the riscv-macros/CHANGELOG.md file.' - name: Check for CHANGELOG.md (riscv-pac) if: steps.changes.outputs.riscv-pac == 'true' diff --git a/Cargo.toml b/Cargo.toml index c0505280..c8391343 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ resolver = "2" members = [ "riscv", + "riscv-macros", "riscv-pac", "riscv-peripheral", "riscv-rt", @@ -14,6 +15,7 @@ members = [ default-members = [ "riscv", + "riscv-macros", "riscv-pac", "riscv-peripheral", "riscv-rt", diff --git a/riscv-macros/CHANGELOG.md b/riscv-macros/CHANGELOG.md new file mode 100644 index 00000000..2ff758d3 --- /dev/null +++ b/riscv-macros/CHANGELOG.md @@ -0,0 +1,21 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +### Added + +- New `rt` and `rt-v-trap` features to opt-in `riscv-rt`-related code in `riscv::pac_enum` macro. + +### Changed + +- Moved from `riscv/macros/` to `riscv-macros/` +- Now, `riscv::pac_enum` macro only includes trap-related code if `rt` or `rt-v-trap` features are enabled. + +## [v0.3.0] - 2025-09-08 + +This crate was placed inside `riscv/`. Check `riscv/CHANGELOG.md` for details diff --git a/riscv/macros/Cargo.toml b/riscv-macros/Cargo.toml similarity index 91% rename from riscv/macros/Cargo.toml rename to riscv-macros/Cargo.toml index 749d8e5e..5a9bf252 100644 --- a/riscv/macros/Cargo.toml +++ b/riscv-macros/Cargo.toml @@ -4,7 +4,7 @@ authors = [ ] categories = ["embedded", "no-std"] description = "Procedural macros re-exported in `riscv`" -documentation = "https://docs.rs/riscv" +documentation = "https://docs.rs/riscv-macros" keywords = ["riscv", "register", "peripheral"] license = "MIT OR Apache-2.0" name = "riscv-macros" diff --git a/riscv-macros/README.md b/riscv-macros/README.md new file mode 100644 index 00000000..cf5844e9 --- /dev/null +++ b/riscv-macros/README.md @@ -0,0 +1,40 @@ +[![crates.io](https://img.shields.io/crates/d/riscv-macros.svg)](https://crates.io/crates/riscv-macros) +[![crates.io](https://img.shields.io/crates/v/riscv-macros.svg)](https://crates.io/crates/riscv-macros) + +# `riscv-macros` + +> Procedural macros for the `riscv` crate. + +This project is developed and maintained by the [RISC-V team][team]. + +## [Documentation](https://docs.rs/crate/riscv) + +## Minimum Supported Rust Version (MSRV) + +This crate is guaranteed to compile on stable Rust 1.61 and up. It *might* +compile with older versions but that may change in any new patch release. + +## License + +Copyright 2024-2025 [RISC-V team][team] + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +## Code of Conduct + +Contribution to this crate is organized under the terms of the [Rust Code of +Conduct][CoC], the maintainer of this crate, the [RISC-V team][team], promises +to intervene to uphold that code of conduct. + +[CoC]: ../CODE_OF_CONDUCT.md +[team]: https://github.com/rust-embedded/wg#the-risc-v-team diff --git a/riscv/macros/src/lib.rs b/riscv-macros/src/lib.rs similarity index 97% rename from riscv/macros/src/lib.rs rename to riscv-macros/src/lib.rs index 3192f1ad..d4c252d8 100644 --- a/riscv/macros/src/lib.rs +++ b/riscv-macros/src/lib.rs @@ -437,16 +437,14 @@ core::arch::global_asm!(" /// E3 = 3, /// } /// -/// fn main() { -/// assert_eq!(Exception::E1.number(), 1); -/// assert_eq!(Exception::E3.number(), 3); +/// assert_eq!(Exception::E1.number(), 1); +/// assert_eq!(Exception::E3.number(), 3); /// -/// assert_eq!(Exception::from_number(1), Ok(Exception::E1)); -/// assert_eq!(Exception::from_number(2), Err(2)); -/// assert_eq!(Exception::from_number(3), Ok(Exception::E3)); +/// assert_eq!(Exception::from_number(1), Ok(Exception::E1)); +/// assert_eq!(Exception::from_number(2), Err(2)); +/// assert_eq!(Exception::from_number(3), Ok(Exception::E3)); /// -/// assert_eq!(Exception::MAX_EXCEPTION_NUMBER, 3); -/// } +/// assert_eq!(Exception::MAX_EXCEPTION_NUMBER, 3); ///``` #[proc_macro_attribute] pub fn pac_enum(attr: TokenStream, item: TokenStream) -> TokenStream { diff --git a/riscv/CHANGELOG.md b/riscv/CHANGELOG.md index 632e6e87..2c675c5a 100644 --- a/riscv/CHANGELOG.md +++ b/riscv/CHANGELOG.md @@ -16,8 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - New `rt` and `rt-v-trap` features to opt-in `riscv-rt`-related code in `riscv::pac_enum` macro. - Add `mvien` + `mvienh` CSR -# Changed +### Changed +- Moved macros from `./macros/` to `../riscv-macros/` - Updated the license to `MIT or Apache-2.0` - Bump MSRV to 1.68 for latest version of syn 2.0 - Now, `riscv::pac_enum` macro only includes trap-related code if `rt` or `rt-v-trap` features are enabled. diff --git a/riscv/Cargo.toml b/riscv/Cargo.toml index 501f374e..f4e87491 100644 --- a/riscv/Cargo.toml +++ b/riscv/Cargo.toml @@ -30,5 +30,5 @@ rt-v-trap = ["rt", "riscv-macros/rt-v-trap"] critical-section = "1.2.0" embedded-hal = "1.0.0" riscv-pac = { path = "../riscv-pac", version = "0.2.0" } -riscv-macros = { path = "macros", version = "0.3.0", optional = true } +riscv-macros = { path = "../riscv-macros", version = "0.3.0", optional = true } paste = "1.0.15" diff --git a/typos.toml b/typos.toml index a4a8e72e..3a088783 100644 --- a/typos.toml +++ b/typos.toml @@ -1,2 +1,3 @@ [default] extend-ignore-re = ["[Ss][Ii][Ee]", "[Ss][Xx][Ll]", "[.]?useed[.,:]?", "[Ss][Tt][Ii][Pp]"] +extend-ignore-words-re = ["[Pp]endings", "PENDINGS"]