Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
filters: |
riscv:
- 'riscv/**'
riscv-macros:
- 'riscv-macros/**'
riscv-pac:
- 'riscv-pac/**'
riscv-peripheral:
Expand All @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
resolver = "2"
members = [
"riscv",
"riscv-macros",
"riscv-pac",
"riscv-peripheral",
"riscv-rt",
Expand All @@ -14,6 +15,7 @@ members = [

default-members = [
"riscv",
"riscv-macros",
"riscv-pac",
"riscv-peripheral",
"riscv-rt",
Expand Down
21 changes: 21 additions & 0 deletions riscv-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion riscv/macros/Cargo.toml → riscv-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
40 changes: 40 additions & 0 deletions riscv-macros/README.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 6 additions & 8 deletions riscv/macros/src/lib.rs → riscv-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion riscv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion riscv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 1 addition & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -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"]