Skip to content

Commit d79290b

Browse files
Merge pull request #358 from rust-embedded/riscv-macros
Move `riscv-macros` to root directory
2 parents fe2f55f + 5a44c41 commit d79290b

File tree

9 files changed

+84
-11
lines changed

9 files changed

+84
-11
lines changed

.github/workflows/changelog.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
filters: |
2020
riscv:
2121
- 'riscv/**'
22+
riscv-macros:
23+
- 'riscv-macros/**'
2224
riscv-pac:
2325
- 'riscv-pac/**'
2426
riscv-peripheral:
@@ -39,6 +41,14 @@ jobs:
3941
changeLogPath: ./riscv/CHANGELOG.md
4042
skipLabels: 'skip changelog'
4143
missingUpdateErrorMessage: 'Please add a changelog entry in the riscv/CHANGELOG.md file.'
44+
45+
- name: Check for CHANGELOG.md (riscv-macros)
46+
if: steps.changes.outputs.riscv-macros == 'true'
47+
uses: dangoslen/changelog-enforcer@v3
48+
with:
49+
changeLogPath: ./riscv-macros/CHANGELOG.md
50+
skipLabels: 'skip changelog'
51+
missingUpdateErrorMessage: 'Please add a changelog entry in the riscv-macros/CHANGELOG.md file.'
4252

4353
- name: Check for CHANGELOG.md (riscv-pac)
4454
if: steps.changes.outputs.riscv-pac == 'true'

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = "2"
33
members = [
44
"riscv",
5+
"riscv-macros",
56
"riscv-pac",
67
"riscv-peripheral",
78
"riscv-rt",
@@ -14,6 +15,7 @@ members = [
1415

1516
default-members = [
1617
"riscv",
18+
"riscv-macros",
1719
"riscv-pac",
1820
"riscv-peripheral",
1921
"riscv-rt",

riscv-macros/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- New `rt` and `rt-v-trap` features to opt-in `riscv-rt`-related code in `riscv::pac_enum` macro.
13+
14+
### Changed
15+
16+
- Moved from `riscv/macros/` to `riscv-macros/`
17+
- Now, `riscv::pac_enum` macro only includes trap-related code if `rt` or `rt-v-trap` features are enabled.
18+
19+
## [v0.3.0] - 2025-09-08
20+
21+
This crate was placed inside `riscv/`. Check `riscv/CHANGELOG.md` for details

riscv/macros/Cargo.toml renamed to riscv-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = [
44
]
55
categories = ["embedded", "no-std"]
66
description = "Procedural macros re-exported in `riscv`"
7-
documentation = "https://docs.rs/riscv"
7+
documentation = "https://docs.rs/riscv-macros"
88
keywords = ["riscv", "register", "peripheral"]
99
license = "MIT OR Apache-2.0"
1010
name = "riscv-macros"

riscv-macros/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[![crates.io](https://img.shields.io/crates/d/riscv-macros.svg)](https://crates.io/crates/riscv-macros)
2+
[![crates.io](https://img.shields.io/crates/v/riscv-macros.svg)](https://crates.io/crates/riscv-macros)
3+
4+
# `riscv-macros`
5+
6+
> Procedural macros for the `riscv` crate.
7+
8+
This project is developed and maintained by the [RISC-V team][team].
9+
10+
## [Documentation](https://docs.rs/crate/riscv)
11+
12+
## Minimum Supported Rust Version (MSRV)
13+
14+
This crate is guaranteed to compile on stable Rust 1.61 and up. It *might*
15+
compile with older versions but that may change in any new patch release.
16+
17+
## License
18+
19+
Copyright 2024-2025 [RISC-V team][team]
20+
21+
Permission to use, copy, modify, and/or distribute this software for any purpose
22+
with or without fee is hereby granted, provided that the above copyright notice
23+
and this permission notice appear in all copies.
24+
25+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
26+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
27+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
28+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
29+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
30+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
31+
THIS SOFTWARE.
32+
33+
## Code of Conduct
34+
35+
Contribution to this crate is organized under the terms of the [Rust Code of
36+
Conduct][CoC], the maintainer of this crate, the [RISC-V team][team], promises
37+
to intervene to uphold that code of conduct.
38+
39+
[CoC]: ../CODE_OF_CONDUCT.md
40+
[team]: https://github.com/rust-embedded/wg#the-risc-v-team

riscv/macros/src/lib.rs renamed to riscv-macros/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,14 @@ core::arch::global_asm!("
437437
/// E3 = 3,
438438
/// }
439439
///
440-
/// fn main() {
441-
/// assert_eq!(Exception::E1.number(), 1);
442-
/// assert_eq!(Exception::E3.number(), 3);
440+
/// assert_eq!(Exception::E1.number(), 1);
441+
/// assert_eq!(Exception::E3.number(), 3);
443442
///
444-
/// assert_eq!(Exception::from_number(1), Ok(Exception::E1));
445-
/// assert_eq!(Exception::from_number(2), Err(2));
446-
/// assert_eq!(Exception::from_number(3), Ok(Exception::E3));
443+
/// assert_eq!(Exception::from_number(1), Ok(Exception::E1));
444+
/// assert_eq!(Exception::from_number(2), Err(2));
445+
/// assert_eq!(Exception::from_number(3), Ok(Exception::E3));
447446
///
448-
/// assert_eq!(Exception::MAX_EXCEPTION_NUMBER, 3);
449-
/// }
447+
/// assert_eq!(Exception::MAX_EXCEPTION_NUMBER, 3);
450448
///```
451449
#[proc_macro_attribute]
452450
pub fn pac_enum(attr: TokenStream, item: TokenStream) -> TokenStream {

riscv/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616
- New `rt` and `rt-v-trap` features to opt-in `riscv-rt`-related code in `riscv::pac_enum` macro.
1717
- Add `mvien` + `mvienh` CSR
1818

19-
# Changed
19+
### Changed
2020

21+
- Moved macros from `./macros/` to `../riscv-macros/`
2122
- Updated the license to `MIT or Apache-2.0`
2223
- Bump MSRV to 1.68 for latest version of syn 2.0
2324
- Now, `riscv::pac_enum` macro only includes trap-related code if `rt` or `rt-v-trap` features are enabled.

riscv/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ rt-v-trap = ["rt", "riscv-macros/rt-v-trap"]
3030
critical-section = "1.2.0"
3131
embedded-hal = "1.0.0"
3232
riscv-pac = { path = "../riscv-pac", version = "0.2.0" }
33-
riscv-macros = { path = "macros", version = "0.3.0", optional = true }
33+
riscv-macros = { path = "../riscv-macros", version = "0.3.0", optional = true }
3434
paste = "1.0.15"

typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[default]
22
extend-ignore-re = ["[Ss][Ii][Ee]", "[Ss][Xx][Ll]", "[.]?useed[.,:]?", "[Ss][Tt][Ii][Pp]"]
3+
extend-ignore-words-re = ["[Pp]endings", "PENDINGS"]

0 commit comments

Comments
 (0)