Skip to content

Commit 3626b66

Browse files
Merge pull request #274 from rust-embedded/include-device
`riscv-rt`: include device in link.x
2 parents dea1d98 + 7bb910d commit 3626b66

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- New `device` feature to include `device.x` in `link.x`. This feature is based
13+
on the current implementation of `cortex-m-rt`.
14+
1015
### Changed
1116

1217
- Linker file now refers to standard exceptions and interrupts only when the

riscv-rt/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ v-trap = ["riscv-rt-macros/v-trap"]
3737
u-boot = ["riscv-rt-macros/u-boot", "single-hart"]
3838
no-interrupts = []
3939
no-exceptions = []
40+
device = []

riscv-rt/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ fn add_linker_script(arch_width: u32) -> io::Result<()> {
2424
let interrupts_content = fs::read_to_string("interrupts.x")?;
2525
include_content.push_str(&(interrupts_content + "\n"));
2626
}
27+
// If device is enabled, include the device.x file (usually, provided by PACs)
28+
if env::var_os("CARGO_FEATURE_DEVICE").is_some() {
29+
include_content.push_str("/* Device-specific exception and interrupt handlers */\n");
30+
include_content.push_str("INCLUDE device.x\n");
31+
}
2732

2833
content = content.replace("${INCLUDE_LINKER_FILES}", &include_content);
2934

0 commit comments

Comments
 (0)