Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
268: Add some Armv8-M assembly routines r=jonas-schievink a=hug-dev
Adds access to `MSP_NS` and the `BXNS` instruction.
Also adds `__dsb` which was missing.
Executed `cargo xtask assemble` and pushed everything, I hope that's enough.
Co-authored-by: Hugues de Valon <hugues.devalon@arm.com>
|
|
Adds access to MSP_NS and the BXNS instruction.
Also adds __dsb which was missing.
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
|
|
266: Implement InterruptNumber for bare_metal::Nr r=therealprof a=adamgreig
This PR aims to help backwards compatibility by implementing the new `InterruptNumber` trait (coming in cortex-m 0.7) for the old `bare_metal::Nr` trait. With this included in cortex-m 0.7, existing PACs generated from the current svd2rust (0.17) will work with cortex-m 0.7, and new PACs generated from a to-be-released svd2rust which uses `InterruptNumber directly will also work.
We can then remove this implementation in cortex-m 0.8 and upgrade cortex-m to depend on bare-metal 1.0 (or not depend on it at all) at that time.
With this PR in place, the upgrade path looks like:
* We release cortex-m 0.7, which users can upgrade to without needing a new PAC
* We release svd2rust 0.18, which will generate new PACs
* PACs update, now requiring cortex-m 0.7
* Users can update their PAC so long as they've already upgraded to cortex-m 0.7
* For cortex-m 0.8, we drop this impl and move off bare-metal 0.2, and a new PAC is required to use 0.8 onwards
Co-authored-by: Adam Greig <adam@adamgreig.com>
|
|
|
|
|
|
264: Tidy up some inline asm and add compiler fences where appropriate r=therealprof a=adamgreig
This PR updates the inline asm:
* Use compiler-assigned registers instead of specifying r0/r1/r2
* Write multi-line asm as multiple string literals, with normal Rust comments outside the strings
* Add ISB after writing to CONTROL as per ARM architectural requirements (see eg app note 321). As far as I can see no other requirements from AN321 apply here.
* Add compiler fences around enabling and disabling interrupts
* No runtime barriers are required, but the compiler fences ensure the compiler won't reorder instructions around these operations, which would break critical section soundness.
* Add compiler fences around DMB, DSB, ISB to align compiler behaviour with the barrier runtime behaviour.
* Add compiler fences after the cache enable routines and writing to CONTROL since those routines include an ISB instruction.
Open to feedback on whether more or fewer fences are necessary; I've thought about these a bit but I think it's a tricky subject. I think in general the FFI-esque treatment of the new `asm!` block probably does most of what we need, but I'm told LLVM may still reorder instructions around FFI calls, which we really don't want to happen here.
Co-authored-by: Adam Greig <adam@adamgreig.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
|
|
|
|
|
|
262: Merge asm implementations r=therealprof a=jonas-schievink
This replaces the implementation of `inline-asm` with the file I wrote in #259 (and some fixes).
All functions that call assembly now do so via a `call_asm!` macro that either dispatches to a call to an `#[inline(always)]` function containing the inline `asm!`, or to the FFI shim. This makes all functions that call into asm significantly shorter.
The FFI shim is now also macro-generated, which makes it very small.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
258: changelog: forward-port 0.6.3 release notes r=adamgreig a=jonas-schievink
Fixes https://github.com/rust-embedded/cortex-m/issues/252
Co-authored-by: Adam Greig <adam@adamgreig.com>
|
|
|
|
261: Replace shell scripts with integration test r=therealprof a=jonas-schievink
* Removes the Clippy check from CI (I don't think we should fail CI when Clippy finds something, it seems better to use the GitHub Actions plugin)
* Tests all targets (thumbv8m.base was missing)
* Bumps MSRV to 1.35.0 (to get the thumbv8m.base libcore)
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
259: Rust assembly stubs r=thalesfragoso a=jonas-schievink
Disclaimer: I have not tested any of this (help wanted, we have no tests in here).
Thanks to @therealprof for nerd-sniping me into oblivion.
Fixes https://github.com/rust-embedded/cortex-m/issues/254
Fixes https://github.com/rust-embedded/cortex-m/issues/194
Fixes https://github.com/rust-embedded/cortex-m/issues/139
# Summary
* Remove the assembly files in favor of a new `asm.rs`, which uses unstable inline assembly and provides a C ABI interface.
* Replace the shell scripts by a [`cargo-xtask`](https://github.com/matklad/cargo-xtask/).
* While we're at it, also pre-build artifacts that are compatible with linker-plugin LTO, fixing https://github.com/rust-embedded/cortex-m/issues/139 (again, not tested)
This means that contributors and maintainers just need ~~a nightly Rust compiler installed~~ to run `cargo xtask assemble`. No binutils, no assembler, no `ar`, no GCC/Clang, and especially nothing from the godawful Arm servers, fixing https://github.com/rust-embedded/cortex-m/issues/194. You don't even have to install the correct nightly Rust toolchain, `cargo xtask` does it for you (and installs all the thumb targets too).
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
260: Remove outdated TODO r=therealprof a=jonas-schievink
STIR has been wrapped in the NVIC (it isn't standalone)
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
257: Provide a delay driver based on SysTick r=thalesfragoso a=Disasm
Co-authored-by: Vadim Kaushan <admin@disasm.info>
|
|
|
|
|
|
|
|
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
|
|
256: Add embedded targets to docs.rs r=jonas-schievink a=hug-dev
Some modules of this repo are gated by the various targets and hence docs.rs does not show the documentation for them! Like the Armv8-M ones for [example](https://github.com/rust-embedded/cortex-m/issues/217#issuecomment-661039292) and the `cmse` module.
docs.rs now allows building for specific target and since [this PR](https://github.com/rust-lang/docs.rs/pull/633) even for targets available via `rustup`!
The `stm32f3_discovery` crate does it, look at ["Platform" on docs.rs](https://docs.rs/stm32f3-discovery/0.4.0/stm32f3_discovery/index.html).
So I think it would be very neat to have on `cortex-m` and I proposing to add the following targets. The first one will show by default, I choosed the latest and greatest for that 😄
I tested locally with `cargo doc --target ...` for all of them.
Co-authored-by: Hugues de Valon <hugues.devalon@arm.com>
|
|
Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
|
|
255: Remap debuginfo paths r=therealprof a=jonas-schievink
cc https://github.com/rust-embedded/cortex-m/issues/254
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
|
|
|
|
235: make 'fn ptr()' APIs to be 'const fn ptr()' r=therealprof a=JOE1994
This PR changes functions like `ITM::ptr()`, `DWT::ptr()` to become `const fn`s.
* functions like `ITM::ptr()`, `DWT::ptr()` return pointers that are cast from constants,
but currently these functions can't be used to define a constant. This PR will allow below code to compile.
```rust
use cortex_m::peripheral::ITM;
use cortex_m::peripheral::itm::RegisterBlock;
// Below line currently won't compile, since `ITM::ptr()` is not a `const fn`
const ITM_PTR: *mut RegisterBlock = ITM::ptr();
```
I couldn't think of disadvantages that might accompany this change, but please correct me if I'm wrong.
Thank you for reviewing this PR :+1:
Co-authored-by: JOE1994 <joseph942010@gmail.com>
Co-authored-by: Youngsuk Kim <joseph942010@gmail.com>
|
|
Co-authored-by: Daniel Egger <daniel@eggers-club.de>
|
|
|
|
|
|
|
|
This commit introduces new associated constants to Core Peripherals.
(pointers to the register block)
This commit also adds a notice that 'ptr()' APIs will be deprecated in
v0.7.
|
|
|
|
241: Add new InterruptNumber trait r=therealprof a=adamgreig
This is a first go at the new trait needed for https://github.com/rust-embedded/svd2rust/pull/455 since we removed `Nr` from bare-metal.
In this case I've written it as `unsafe trait InterruptNumber: Into<u16>` rather than providing a conversion method inside the trait; I think this is neat and idiomatic but please correct me if there's a reason to not do it like this.
[Here's](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4f2f8b9604b5a62298f9907780d844c7) a playground link showing an example implementation.
Co-authored-by: Adam Greig <adam@adamgreig.com>
|
|
251: Fix warnings r=therealprof a=thalesfragoso
This was causing CI to fail when using `-D warnings`.
Co-authored-by: Thales Fragoso <thales.fragosoz@gmail.com>
|
|
|
|
|