feat: add display UI with splash screen, dashboard, and RSSI sparkline

Implement full SSD1306 OLED display support:
- Splash screen on boot (1.5s) with project name, version, board
- Dashboard showing radio state, config, counters, RSSI/SNR
- RSSI history sparkline (64-sample ring buffer, 2px-wide bars)
- DisplayOn/DisplayOff host commands routed via dedicated channel
- Pure render functions against generic DrawTarget (no hardware coupling)
- Display on/off control bypasses radio task entirely

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Opus 4.6 committed 2026-03-29 20:42:54 -06:00
1 parent 7064110293
commit 3102fc747a
17624 files changed
+4564928 -38

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"files":{".cargo/config.toml":"906b46f92d786174dfce31f1d338770568d3617c5b93e8331fc9d3377cd6afe6",".cargo_vcs_info.json":"c87d46603cc3b1b815eea03f189804adc90607ae72e5c5c50d33ac79d2bc04ad","CHANGELOG.md":"38cb74681fbfb3f0f0d6a0fb3dfb41ad2eded8302776f8edbf2a77a6ae5b5ff6","Cargo.lock":"08d150b9fbdf3e8a902a04a6e8b57563c139758285fcc1da17d58931c9142cd7","Cargo.toml":"2bade3faff536bea755d13fbcabfb3ea35d6c6dce957df79af1786399520575e","Cargo.toml.orig":"fbd8d2d40237341c7407e3692cec4310191a985479eacbaba05561adfa67b650","README.md":"19fbdc898f675a2fcec4d061513105364af1cce851ee32704204a4c1853a79ec","build.rs":"99ca7a5ed5ad2697a406a5cf0fb3e8547a04a2ca5e26b4db43d49ab592f92f4a","ci/script.sh":"69a9358ed9c6b17447cb51ca34506c4d8b3a069b415cfa1264636cc332983d09","examples/alignment.rs":"3c653dbf7be49e7e0b9bd9f3b5d9fb56f62267c178ee338e0d5f04eff924f357","examples/cfg-static.rs":"a82b62a4af2792bc15add71de6845836d2bcf16f08fb55768b2ad640bc6001f4","examples/data_overflow.rs":"b339968260f9ea3f8454cc8bb2ce532be50bcf9b81f13b607a89bbfa7fb0e1d1","examples/device.rs":"b1e6e10b7fbdf0784bc9dead47596572c42d518f767f4bda5c7457417ac75eff","examples/divergent-default-handler.rs":"ddcceb8a6bcf939e66320e1c876932b5f9b0c58a5f70797ddf63a86a17478611","examples/divergent-exception.rs":"6c286edd17afa258e202fe72d3c682410de6310cb9327134816d4684907d6006","examples/entry-static.rs":"e5579c8e8a7d414cd51af983eadd87e39b334e4d6312f48d557c00e3ef6b2b48","examples/hard-fault-trampoline.rs":"f214137ae3d05b177f78dc270bb6fdd33618eeeffd4ad33fde12878ab22c5694","examples/main.rs":"82b9d5d1649e8da328cca8f6dab6144be3443f8a1e4cc76a43f4bea364173451","examples/minimal.rs":"f66ace7010aa8a5b8ca47a97b254939047314b46cedb19689e4625d71a9cbad3","examples/override-exception.rs":"8aafc496badda846f42b9a75c47426175b3e70841d08e7b41371c1413827943a","examples/pre_init.rs":"2a13b45353761ec4f632ee89e865f46d353c02fb73b6d72768e9ef498dba9946","examples/qemu.rs":"bbc31554710816cb238cee8ac670a869c414fe200aa8c048874d2692e9b222bd","examples/state.rs":"6927d661beced2acaa6059cf394298e4d1ccd3d17175945123a41e67cdfc792c","examples/unsafe-default-handler.rs":"aabce6a3380be15d3d059b9dbf809b93f67ecd750c38d83190fdc9f8a1f286aa","examples/unsafe-entry.rs":"a0db7e3961800989cb2658efdaff86cd7f9459414b899f4b69117c752692484a","examples/unsafe-exception.rs":"ea534617e988672dfaf385c403818f55f295de2531af1d3ecd0d5984d7b9187f","examples/unsafe-hard-fault.rs":"4139e666b022b172a6772f24c70b699f7cda0228185428d5be2c7c92650e5614","examples/unsafety.rs":"e39698bc3e75cae3e7a96d5e008b2ca3fb47970c024863698a7b55b8bf3fc1c4","examples/warnings.rs":"4fd9ee498f738161f618d2feb9b4045398647361feffc84a8027437e0926e333","link.x.in":"c6890afc1cefc9f78574104c7c0cd06ec5c485df3e441021b4c2b3593ccaf5c7","src/lib.rs":"e530ce139e7d53337f468aab4102df11f95caf808914f1bda8937ae1ace03c86","tests/README.md":"c955f3a0b55d39230f90b8dbfd59d39e8463c6391e9f0a33c98dfda9d16e6c21","tests/compile-fail/default-handler-bad-signature-1.rs":"fda1cfe10f8546bafe63d07cbe3307fa73e56ef001dece4b7724a11a586c05a1","tests/compile-fail/default-handler-bad-signature-2.rs":"1f59db99c9d1e46e3823a34224d19b0d41531e6813b52a2ede822b69c5c63ac1","tests/compile-fail/default-handler-hidden.rs":"a75665fe6a89a19f33a2c2d0fc3495f433a17544d0a8d3c07f0a53a9847d6991","tests/compile-fail/default-handler-twice.rs":"df94e46696f6ff0486c178ce0c1f615a2432630feb5da01dca0f694536a7aed1","tests/compile-fail/duplicate-static.rs":"0ce0e47bd2ff975921ef0246812f63e3b5ef86c9e7459213acddae2be4fa907d","tests/compile-fail/entry-args.rs":"b375df87c096746c6ffec50d923f8c8c135483a4667895da67d45aa1c1699a78","tests/compile-fail/entry-bad-signature-1.rs":"0febd74608e8659038a7459b5680190bc4a82be7879c42e052c4d1b45cb93288","tests/compile-fail/entry-bad-signature-2.rs":"80cc72e8221bdbad15d2866e675d7dd18ef6bf2a1159823e811f9f243bf2ecb5","tests/compile-fail/entry-bad-signature-3.rs":"36b831e838a0ad53127426ee8abb742dbb94586d08ef1b96568e00592bcfed01","tests/compile-fail/entry-hidden.rs":"c8d30a641aa8b935716b64c32bd7eceee05bd1d19b21e8bb4751fc526c50bca4","tests/compile-fail/entry-soundness.rs":"d44ed5a86a882c84b105dab182d6057e04faceb80be98a1d21ee3f66221867eb","tests/compile-fail/entry-twice.rs":"d838b3ca815fee86e26b5c349ff436639cce79875ca0cc7cf7e79d44532bfb6c","tests/compile-fail/exception-args.rs":"c02ae0ba76fcae0fdf0c4da0d74e565377b763e4a7bafd552e905895283681da","tests/compile-fail/exception-bad-signature-1.rs":"e5b92cc8b663e159f113449badadba1a41e13282eb015ea029a07e2733e8b867","tests/compile-fail/exception-bad-signature-2.rs":"ee0b8e063aa683f5c962f5d5fa40dbc82194d7a6b8cecd46e3ac5025f7c548e3","tests/compile-fail/exception-hidden.rs":"9e3bb7dcdb090e5afefba4e83abf333b1f9ea3d01ed138f4181e6f6796a46ac1","tests/compile-fail/exception-nmi-unsafe.rs":"1262c0b3b376b10f4fdc7f50d91ad244714761f5c183128aa73c940dc33e4327","tests/compile-fail/exception-soundness.rs":"ffb5e5cd19c11b52325e77a5706ba9ccf47a892f3a46e82d70b603a527871ef9","tests/compile-fail/exception-twice.rs":"bba3c0c92d22a99a7672aaf1037001b35a77eb0527191753bdfd585b6e279af0","teLine truncated
+34
View File
@@ -0,0 +1,34 @@
[target.thumbv6m-none-eabi]
runner = "qemu-system-arm -cpu cortex-m0 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
[target.thumbv7m-none-eabi]
runner = "qemu-system-arm -cpu cortex-m3 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
[target.thumbv7em-none-eabi]
runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
[target.thumbv7em-none-eabihf]
runner = "qemu-system-arm -cpu cortex-m4 -machine lm3s6965evb -nographic -semihosting-config enable=on,target=native -kernel"
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# uncomment ONE of these three option to make `cargo run` start a GDB session
# which option to pick depends on your system
# runner = "arm-none-eabi-gdb -q -x openocd.gdb"
# runner = "gdb-multiarch -q -x openocd.gdb"
# runner = "gdb -q -x openocd.gdb"
rustflags = [
# LLD (shipped with the Rust toolchain) is used as the default linker
"-C", "link-arg=-Tlink.x",
# if you run into problems with LLD switch to the GNU linker by commenting out
# this line
# "-C", "linker=arm-none-eabi-ld",
# if you need to link to pre-compiled C libraries provided by a C toolchain
# use GCC as the linker by commenting out both lines above and then
# uncommenting the three lines below
# "-C", "linker=arm-none-eabi-gcc",
# "-C", "link-arg=-Wl,-Tlink.x",
# "-C", "link-arg=-nostartfiles",
]
+6
View File
@@ -0,0 +1,6 @@
{
"git": {
"sha1": "91772718fec2e07b0ccabeb019e509a53d3eecda"
},
"path_in_vcs": "cortex-m-rt"
}
+699
View File
@@ -0,0 +1,699 @@
# 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]
## [v0.7.5]
- Fix incorrect dependency on cortex-m-rt-macros in v0.7.4 which led to
incorrect HardFault handlers being generated.
- MSRV is now Rust 1.61 to support syn verions >=2.0.68
- The `_stack_end` symbol is added, e.g. for use with MSPLIM (#565)
- Macros now expand to include an `unsafe` block and `allow(static_mut_refs)`
when generating the `&'static mut` references in entry/interrupt handlers
(#561, #558)
- `expect` attribute now permitted on entry/interrupt handlers (#557)
- Up to 496 interrupts now permitted on ARMv8-M (#555)
- Add new `paint-stack` feature which writes a fixed value to the entire stack
during initialisation (#548)
- The hard fault handler `_HardFault` is now placed in the `.HardFault.user`
linker section (#535)
## [v0.7.4]
- Add `zero-init-ram` feature to initialize RAM with zeros on startup.
This can be necessary to properly initialise hardware error detection.
- Add optional `exception` argument for `HardFault`.
It has one option `trampoline` which is `true` by default. When set to `false`,
no trampoline will be created and the function will be called as the
exception handler directly.
- MSRV increased to 1.60.0 to align with `embedded-hal` version 1.
- Improve linker error message when code does not fit into flash.
- Update documentation on using custom linker scripts and linker sections
and on the `pre_init` function.
## [v0.7.3]
- Fixed a potential miscompilation caused by the initial stack pointer
not being 8-byte aligned. This issue affected 0.7.1 and 0.7.2; for
more details please see [the advisory] ([#467]).
- A linker error is generated if the initial stack pointer is not 8-byte aligned ([#464]).
- The initial stack pointer is now forced to be 8-byte aligned in the linker script,
to defend against it being overridden outside of the cortex-m-rt linker script ([#465]).
[the advisory]: https://github.com/rust-embedded/cortex-m/discussions/469
[#464]: https://github.com/rust-embedded/cortex-m/issues/464
[#465]: https://github.com/rust-embedded/cortex-m/issues/465
[#467]: https://github.com/rust-embedded/cortex-m/issues/467
## [v0.7.2]
- MSRV is now Rust 1.59.
- Moved precompiled assembly blobs to `global_asm!`, requiring Rust 1.59.
- Add new `set_vtor` and `set-sp` features to conditionally set the VTOR and SP
registers at device reset ([#423]).
- Allow (unstable) `naked` attribute on interrupt handlers and `pre_init`.
## Fixes
- Fix `cortex_m_rt::exception` macro no longer being usable fully-qualified ([#414])
- Fix veneer limit position in linker script ([#434]).
[#414]: https://github.com/rust-embedded/cortex-m/issues/414
[#423]: https://github.com/rust-embedded/cortex-m/issues/423
[#434]: https://github.com/rust-embedded/cortex-m/issues/434
## Notes
- From this release onwards, cortex-m-rt lives in the cortex-m repository;
issue numbers refer there.
## [v0.7.1]
## Fixes
- Fix stack unwinding past `Reset` function ([#337])
[#337]: https://github.com/rust-embedded/cortex-m-rt/pull/337
## [v0.7.0]
### New Features
- Add support for CMSE secure gateway veneers ([#297]).
- Allow using the crate with custom target JSON specs ([#304]).
- Export Exception enum for other crates to use ([#224]).
[#224]: https://github.com/rust-embedded/cortex-m-rt/pull/224
[#297]: https://github.com/rust-embedded/cortex-m-rt/pull/297
[#304]: https://github.com/rust-embedded/cortex-m-rt/pull/304
### Fixes
- Various fixes to the linker script ([#265], [#286], [#287], [#323]).
- Use the correct ABI for the `main` symbol ([#278]).
- Add barriers after FPU enabling ([#279]).
- (ARMv6-M) Set LR value to a known value on reset ([#293]).
- Added CFI and size info to external assembly subroutines (`HardFaultTrampoline` and `FpuTrampoline`) ([#294]).
- Allow building the crate for macOS targets ([#306], [#310]).
- Perform RAM initialization in assembly, to avoid potential UB in Rust ([#301]).
- Perform volatile reads of ICSR in DefaultHandler ([#315]).
[#265]: https://github.com/rust-embedded/cortex-m-rt/pull/265
[#278]: https://github.com/rust-embedded/cortex-m-rt/pull/278
[#279]: https://github.com/rust-embedded/cortex-m-rt/pull/279
[#286]: https://github.com/rust-embedded/cortex-m-rt/pull/286
[#287]: https://github.com/rust-embedded/cortex-m-rt/pull/287
[#293]: https://github.com/rust-embedded/cortex-m-rt/pull/293
[#294]: https://github.com/rust-embedded/cortex-m-rt/pull/294
[#301]: https://github.com/rust-embedded/cortex-m-rt/pull/301
[#306]: https://github.com/rust-embedded/cortex-m-rt/pull/306
[#310]: https://github.com/rust-embedded/cortex-m-rt/pull/310
[#315]: https://github.com/rust-embedded/cortex-m-rt/pull/315
[#323]: https://github.com/rust-embedded/cortex-m-rt/pull/323
### Breaking Changes
- Make `ExceptionFrame`s fields private, adding setters and getters instead
([#239]).
- Only allow certain attributes on handlers, and apply them to the trampoline
too ([#228]).
- Make it unsafe to define exception handlers for NMIs ([#289]).
- Check that exceptions exist on the target chip when registering a handler for
them ([#308]).
[#239]: https://github.com/rust-embedded/cortex-m-rt/pull/239
[#228]: https://github.com/rust-embedded/cortex-m-rt/pull/228
[#289]: https://github.com/rust-embedded/cortex-m-rt/pull/289
[#308]: https://github.com/rust-embedded/cortex-m-rt/pull/308
### Other
- Change macros crate to use same version number as cortex-m-rt crate ([#245]).
- Discourage use of `pre_init` in documentation ([#248]).
- Backport: Use `links` in Cargo.toml to prevent multiple linking of
cortex-m-rt ([#276]).
[#245]: https://github.com/rust-embedded/cortex-m-rt/pull/245
[#248]: https://github.com/rust-embedded/cortex-m-rt/pull/248
[#276]: https://github.com/rust-embedded/cortex-m-rt/pull/276
## Backport release: [v0.6.15] - 2021-07-12
### Fixed
- Backport: Mark .bss as NOLOAD ([#265])
- Backport: Fix possible overflow of .data region ([#286])
- Backport: Perform volatile reads of ICSR in DefaultHandler ([#315])
### Other
- Backport: Use `links` in Cargo.toml to prevent multiple linking of
cortex-m-rt ([#276])
- Backport: Use same verison for macros crate as for cortex-m-rt itself
([#245])
[#245]: https://github.com/rust-embedded/cortex-m-rt/pull/245
[#265]: https://github.com/rust-embedded/cortex-m-rt/pull/265
[#276]: https://github.com/rust-embedded/cortex-m-rt/pull/276
[#286]: https://github.com/rust-embedded/cortex-m-rt/pull/286
[#315]: https://github.com/rust-embedded/cortex-m-rt/pull/315
## [v0.6.14] - 2021-05-19
### Fixed
- Backport: Allow building the crate for macOS targets ([#306], [#310]).
[#306]: https://github.com/rust-embedded/cortex-m-rt/issues/306
[#310]: https://github.com/rust-embedded/cortex-m-rt/issues/310
## Backport release: [v0.6.13] - 2020-09-07
### Fixed
- (ARMv6-M) Set LR value to a known value on reset (as the ARM spec requires)
- Added CFI and size info to external assembly subroutines (`HardFaultTrampoline`)
## Backport release: [v0.6.12] - 2020-01-26
### Fixed
- Fixed lint warnings getting emitted on macro-generated code.
## [v0.6.11] - 2019-12-04
### Changed
- Macros now generate a second trampoline function instead of randomizing the
function's symbol name. This makes the build deterministic.
- [breaking-change] `static mut` resources no longer have `'static` lifetime
except in the `#[entry]` function (this is a soundness fix; see [#212]).
[#212]: https://github.com/rust-embedded/cortex-m-rt/issues/212
## [v0.6.10] - 2019-07-25
### Fixed
- Linker template now takes and discard `*(.ARM.exidx)`
## [v0.6.9] - 2019-07-11
### Added
- Input `.uninit.*` sections are now collected into an output `.uninit` section.
Uninitialized static variables are meant to be placed in these sections. The
output `.uninit` section is not initialized by the runtime.
## [v0.6.8] - 2019-04-02
### Fixed
- Correct stack-pointer is selected on `HardFault`
- Linker template now takes and discard `*(.ARM.extab.*)`
- Misc. documentation fixes
### Changed
- Architecture added: `armv8-m.main`
- Cortex-M team added to `authors`
- The nightly build is allowed to fail in CI
## [v0.6.7] - 2018-12-15
### Fixed
- entry / exception / interrupt: `#[cfg]` attributes used on `static mut`
variables are now properly handled.
## [v0.6.6] - 2018-12-06
### Changed
- Misuse of attributes now produce compiler errors with proper spans instead of
panicking messages.
- The `HardFault` symbol has been renamed to `HardFaultTrampoline`; likewise the
`UserHardFault` symbol has been renamed to `HardFault`. If you were using
breakpoints on `UserHardFault` to detect hard fault you should now put those
breakpoints on the `HardFault` symbol.
### Fixed
- Attributes on local `static mut` variables (declared at the beginning of
`entry` / `interrupt` / `exception`) are now respected.
- The "GDB can now unwind HardFault callstacks" fix from the previous release
broke `HardFault`'s' `&ExceptionFrame` argument (the pointer was off by 8
bytes). This release fixes that problem without compromising GDB's ability to
unwind `HardFault`s.
## [v0.6.5] - 2018-10-23
### Changed
- We now keep `.stack_sizes` by default, for use with external tooling.
- (macros) New `#[interrupt]` attribute added, similar to `#[exception]` for
use with device-specific interrupt handlers.
### Fixed
- GDB can now unwind HardFault callstacks
## [v0.6.4] - 2018-09-25
### Changed
- (macros) Improved the error message when any of the attribute is used on the
wrong kind of item.
### Fixed
- (macros) The expansion of the `exception` attribute now uses the `extern "C"`
ABI which is what the hardware expects.
- (macros) `entry` and `exception` now respect the declared unsafety. That is
`#[entry] unsafe main() -> !` won't require `unsafe` blocks to use `unsafe`
API.
## [v0.6.3] - 2018-09-09
### Fixed
- Fixed the `rand` problem for real.
## [v0.6.2] - 2018-09-09
### Fixed
- Worked around a Cargo limitation that broke builds that depend on `rand`.
- Updated the documentation link in the README to point to working docs.
## [v0.6.1] - 2018-09-06
### Changed
- Produce a better error message if two (or more) copies of `cortex-m-rt` are
going to be linked into a binary.
## [v0.6.0] - 2018-09-06
### Changed
- [breaking-change] the `entry!`, `pre_init!` and `exception!` macros have been
replaced with attributes: `#[entry]`, `#[pre_init]` and `#[exception]`,
respectively. This also changes the toolchain requirement to 1.30-beta or
newer.
## [v0.5.3] - 2018-08-27
### Changed
- This crate no longer depends on `arm-none-eabi-gcc`.
## [v0.5.2] - 2018-08-11
### Added
* A `pre_init!` macro and related functionality to run a function immediately
after reset, before memory initialisation
### Changed
- The `entry!` and `exception!` macros now also accept a closure instead of a path.
- `DefaultHandler` and `UserHardFault` now default to an infinite loop if left undefined.
### Fixed
* Linked script modified to correctly detect `FLASH` overflow caused by `.data`
## [v0.5.1] - 2018-05-14
### Fixed
- A recompilation problem where this `cortex-m-rt` would be recompiled every time `cargo build` is
invoked.
## [v0.5.0] - 2018-05-12
### Added
- An `entry!` macro to set the entry point of the program.
- A `heap_start` function that returns a pointer into the start of the heap region.
- A `device` feature. When disabled this crate provides the interrupt vectors; when enabled the
interrupt vectors are expected to be provided by another crate. Read the documentation for
details.
### Changed
- This crate now compiles on the beta and stable channels.
- [breaking-change] this crate now requires `arm-none-eabi-gcc` to be installed and available in
`$PATH` to compile.
- [breaking-change] the `start` lang item has been removed. The standard `main` interface won't
work. Instead use `#![no_main]` and the `entry!` macro. See documentation for details.
- [breaking-change] the `default_handler!` macro has been merged into the `exception!` macro. Use
`exception!(*, ..)` to set the default exception handler.
- [breaking-change] there's no weak default handler so a default handler must be defined by the
application, or one of its dependencies.
- [breaking-change] the syntax of the third argument of the `exception!` handler has changed. See
the documentation of the macro for details.
- [breaking-change] the exception names that the `exception!` macro accepts has changed to match the
CMSIS specification. See the documentation of the macro for the list of names it accepts.
- [breaking-change] The number of symbol interfaces has been reduced. Check the advanced section of
the documentation for details.
## [v0.4.0] - 2018-04-09
### Added
- LLD support. The linker script provided by this crate has been tweaked to support both LLD and GNU
LD. To use LLD as a linker change `.cargo/config` to look like this:
``` diff
[target.thumbv7m-none-eabi]
rustflags = [
"-C", "link-arg=-Tlink.x",
- "-C", "linker=arm-none-eabi-ld",
- "-Z", "linker-flavor=ld",
+ "-C", "linker=lld",
+ "-Z", "linker-flavor=ld.lld",
]
```
### Removed
- [breaking-change] Stack overflow protection has been removed. Unfortunately, supporting this
feature produces totally wrong `arm-none-eabi-size` reports when LLD is used to link the
program. If you need the stack overflow protection feature you can continue to use version
v0.3.13+.
- [breaking-change] The "abort-on-panic" Cargo feature, which provided a `panic_fmt` implementation,
has been removed. If you were using this feature you can instead use a [panic implementation
crate][panic-impl].
[panic-impl]: https://crates.io/keywords/panic-impl
## [v0.3.15] - 2018-04-08
### Fixed
- Support the newest nightly
## [v0.3.14] - 2018-04-01
### Fixed
- `dev` channel support
## [v0.3.13] - 2018-02-17
### Added
- Fictitious `.stack` and `.heap` linker sections that represent the locations of the stack and the
heap in RAM. You can visualize these linker sections by running `arm-none-eabi-size -Ax` over your
binary.
- Zero cost stack overflow protection when you use the `cortex-m-rt-ld` linker. Check documentation
for details.
- A `_heap_size` symbol that indicates how large the heap is. This symbol is only used when
`cortex-m-rt-ld` is used as a linker.
## [v0.3.12] - 2018-01-17
### Fixed
- Support for recent nightlies.
## [v0.3.11] - 2018-01-17 - YANKED
### Changed
- Dynamically support recent nightlies, which have the `termination` lang item, and
nightly-2017-09-22, which doesn't. That nightly version is used by the docs.rs builder. Supporting
that version instead of rejecting it ensures this crate and its reverse-dependencies will get
their documentation built by the docs.rs service.
## [v0.3.10] - 2018-01-17 - YANKED
### Removed
- The nightly date check from build script that improved error messages for users of old,
unsupported nightlies. Unfortunately the check was preventing this crate and reverse-dependencies
from getting their documentation build on docs.rs
## [v0.3.9] - 2018-01-07
### Fixed
- `cargo doc` warnings
## [v0.3.8] - 2017-12-29
### Added
- `Termination` lang item
### Changed
- The `start` lang item to match the new signature
## [v0.3.7] - 2017-12-23
### Added
- Support for overriding the DEBUG_MONITOR exception handler on ARMv7-M.
## [v0.3.6] - 2017-10-03
### Fixed
- Builds with multiple codegen units by forcing the linker to look harder for the exceptions vector
table.
## [v0.3.5] - 2017-07-21
### Fixed
- Remove duplication of default exception handlers. This saves 32 bytes of Flash
memory (.text).
## [v0.3.4] - 2017-07-19
### Changed
- Align the end of .rodata to a 4-byte boundary. With this the sections that
will go into Flash memory will be 4 byte aligned at the start and at the
end. Which seems to be required (?) by Cortex-M0 devices.
- .bss and .data are now padded so their sizes are multiple of 4 bytes. This
improves the output of `objdump`; before, the output showed "Address
0x20000004 is out of bounds".
- Linking now aborts if any of the input files contains a .got section. Dynamic
relocations are not supported and Rust code is not relocatable by default.
This error only occurs if C code that was compiled with the -fPIC flag is
linked in. The error message will tell the user how to compile their C code
without -fPIC.
## [v0.3.3] - 2017-07-14
### Changed
- Updated the documentation: it's no longer necessary to use the
compiler-builtins repository since that crate landed in rust-lang/rust and
it's now available in the `rust-src` component.
## [v0.3.2] - 2017-07-07
### Changed
- Tweaked documentation
## [v0.3.1] - 2017-07-07
### Fixed
- A warning when compiling for x86_64 and the "abort-on-panic" feature is
enabled.
## [v0.3.0] - 2017-07-07
### Added
- A `default_handler!` macro to override the default exception handler.
- An `exception!` macro to override the handler for a particular exception.
### Changed
- The FPU will now be enabled before `main` if the target has FPU support.
- [breaking-change] the features "panic-over-itm" and "panic-over-semihosting"
has been removed. the `panic_fmt` language item is now *not* included by
default. An opt-in feature named "abort-on-panic" can be enabled to make this
crate provide a `panic_fmt` implementation that simply aborts.
- [breaking-change] The sections `.rodata.{exceptions,interrupts}` have been
renamed to `.vector_table.{exceptions,interrupts}`. This break the old
mechanism for registering exceptions (`static EXCEPTIONS`); use the new ones:
`default_handler!` and `exception!`.
- The `_stack_start` is now optional in the `memory.x` file. If unspecified its
value will be set to `ORIGIN(RAM) + LENGTH(RAM)`.
## [v0.2.4] - 2017-06-03
### Added
- A non-allocatable `.stlog` section to support the [`stlog`] logging framework.
[`stlog`]: https://crates.io/crates/stlog
## [v0.2.3] - 2017-05-30
### Added
- A `_stext` symbol which can be specified in the linker script to customize the
location of the `.text` section. If not specified the `.text` section will be
placed right after the `.vector_table` section.
## [v0.2.2] - 2017-05-27
### Added
- A `_sheap` symbol where the heap can be located.
### Changed
- The linker sections have renamed / reorder to make `arm-none-eabi-size -A`
more useful. You'll now see something like this:
```
$ arm-none-eabi-size -A hello
hello :
section size addr
.vector_table 1024 134217728
.text 288 134218752
.rodata 14 134219040
```
- `cortex-m-rt::reset_handler` is now the entry point of all programs that link
to `cortex-m-rt`. This makes GDB's `load` command work correctly. It will now
set the Program Counter to `reset_handler` after flashing the program so
there's no need to reset the microcontroller after flashing.
- Renamed `__exceptions` and `__interrupts` symbols, which are only used
internally, to `_eexceptions` and `_einterrupts` respectively for consistency.
### Fixed
- Include input `.text` and `.rodata` sections (note: no suffix as in
`.text.foo`) in the output file. (C) Code compiled without the equivalent
`-ffunction-sections` / `-fdata-sections` may place stuff in those unsuffixed
sections.
## [v0.2.1] - 2017-05-07
### Fixed
- Do not load the `.debug_gdb_script` section in flash. It's only needed for
debugging.
## [v0.2.0] - 2017-04-27
### Changed
- [breaking-change] the `_stack_start` symbol is now required and must be
provided in the `memory.x` file when using the "linker-script" feature. This
symbol indicates where in memory the call stack will be allocated.
## [v0.1.3] - 2017-04-25
### Fixed
- A `rustdoc` warning
## [v0.1.2] - 2017-04-22
### Changed
- Unclutter the `reset_handler` function for a better debugging experience.
## [v0.1.1] - 2017-04-15
### Changed
- Improved linker error messages
## v0.1.0 - 2017-04-12
Initial release
[Unreleased]: https://github.com/rust-embedded/cortex-m/compare/c-m-rt-v0.7.5...HEAD
[v0.7.4]: https://github.com/rust-embedded/cortex-m/compare/c-m-rt-v0.7.4...c-m-rt-v0.7.5
[v0.7.4]: https://github.com/rust-embedded/cortex-m/compare/c-m-rt-v0.7.3...c-m-rt-v0.7.4
[v0.7.3]: https://github.com/rust-embedded/cortex-m/compare/c-m-rt-v0.7.2...c-m-rt-v0.7.3
[v0.7.2]: https://github.com/rust-embedded/cortex-m/compare/c-m-rt-v0.7.1...c-m-rt-v0.7.2
[v0.7.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.7.0...v0.7.1
[v0.7.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.11...v0.7.0
[v0.6.15]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.14...v0.6.15
[v0.6.14]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.13...v0.6.14
[v0.6.13]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.12...v0.6.13
[v0.6.12]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.11...v0.6.12
[v0.6.11]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.10...v0.6.11
[v0.6.10]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.9...v0.6.10
[v0.6.9]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.8...v0.6.9
[v0.6.8]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.7...v0.6.8
[v0.6.7]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.6...v0.6.7
[v0.6.6]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.5...v0.6.6
[v0.6.5]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.4...v0.6.5
[v0.6.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.3...v0.6.4
[v0.6.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.2...v0.6.3
[v0.6.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.3...v0.6.0
[v0.5.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.2...v0.5.3
[v0.5.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.1...v0.5.2
[v0.5.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.5.0...v0.5.1
[v0.5.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.4.0...v0.5.0
[v0.4.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.15...v0.4.0
[v0.3.15]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.14...v0.3.15
[v0.3.14]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.13...v0.3.14
[v0.3.13]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.12...v0.3.13
[v0.3.12]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.11...v0.3.12
[v0.3.11]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.10...v0.3.11
[v0.3.10]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.9...v0.3.10
[v0.3.9]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.8...v0.3.9
[v0.3.8]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.7...v0.3.8
[v0.3.7]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.6...v0.3.7
[v0.3.6]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.5...v0.3.6
[v0.3.5]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.4...v0.3.5
[v0.3.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.3...v0.3.4
[v0.3.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.2...v0.3.3
[v0.3.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.1...v0.3.2
[v0.3.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.3.0...v0.3.1
[v0.3.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.4...v0.3.0
[v0.2.4]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.3...v0.2.4
[v0.2.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.2...v0.2.3
[v0.2.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.1...v0.2.2
[v0.2.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.2.0...v0.2.1
[v0.2.0]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.3...v0.2.0
[v0.1.3]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.2...v0.1.3
[v0.1.2]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.1...v0.1.2
[v0.1.1]: https://github.com/rust-embedded/cortex-m-rt/compare/v0.1.0...v0.1.1
+677
View File
@@ -0,0 +1,677 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
dependencies = [
"memchr",
]
[[package]]
name = "bare-metal"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
dependencies = [
"rustc_version",
]
[[package]]
name = "bitfield"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "compiletest_rs"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b0f4b0a27f9efcea6a012305682f0f7c5691df7097b9eaf6abb50b75c89a8af"
dependencies = [
"diff",
"filetime",
"getopts",
"lazy_static",
"libc",
"log",
"miow",
"regex",
"rustfix",
"serde",
"serde_derive",
"serde_json",
"tester",
"winapi",
]
[[package]]
name = "cortex-m"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
dependencies = [
"bare-metal",
"bitfield",
"embedded-hal",
"volatile-register",
]
[[package]]
name = "cortex-m-rt"
version = "0.7.5"
dependencies = [
"compiletest_rs",
"cortex-m",
"cortex-m-rt-macros",
"panic-halt",
]
[[package]]
name = "cortex-m-rt-macros"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "dirs-next"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
dependencies = [
"cfg-if",
"dirs-sys-next",
]
[[package]]
name = "dirs-sys-next"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "embedded-hal"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
dependencies = [
"nb 0.1.3",
"void",
]
[[package]]
name = "filetime"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.3.5",
"windows-sys 0.48.0",
]
[[package]]
name = "getopts"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
dependencies = [
"unicode-width",
]
[[package]]
name = "getrandom"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "hermit-abi"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
[[package]]
name = "itoa"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "miow"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123"
dependencies = [
"windows-sys 0.42.0",
]
[[package]]
name = "nb"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
dependencies = [
"nb 1.1.0",
]
[[package]]
name = "nb"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "panic-halt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
[[package]]
name = "pin-project-lite"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]]
name = "proc-macro2"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_users"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom",
"redox_syscall 0.2.16",
"thiserror",
]
[[package]]
name = "regex"
version = "1.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver",
]
[[package]]
name = "rustfix"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cef0c817217c330b3ef879e06455d726c1cffc800eaf7734d3b4ac63213636b"
dependencies = [
"serde",
"serde_json",
"thiserror",
"tracing",
]
[[package]]
name = "rustversion"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.207"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.207"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.124"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "syn"
version = "2.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "term"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
dependencies = [
"dirs-next",
"rustversion",
"winapi",
]
[[package]]
name = "tester"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89e8bf7e0eb2dd7b4228cc1b6821fc5114cd6841ae59f652a85488c016091e5f"
dependencies = [
"cfg-if",
"getopts",
"libc",
"num_cpus",
"term",
]
[[package]]
name = "thiserror"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing-core"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "vcell"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "volatile-register"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc"
dependencies = [
"vcell",
]
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+155
View File
@@ -0,0 +1,155 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.61"
name = "cortex-m-rt"
version = "0.7.5"
authors = [
"The Cortex-M Team <cortex-m@teams.rust-embedded.org>",
"Jorge Aparicio <jorge@japaric.io>",
"Hideki Sekine <sekineh@me.com>",
]
build = "build.rs"
links = "cortex-m-rt"
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Minimal runtime / startup for Cortex-M microcontrollers"
documentation = "https://docs.rs/cortex-m-rt/"
readme = "README.md"
keywords = [
"arm",
"cortex-m",
"runtime",
"startup",
]
categories = [
"embedded",
"no-std",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-embedded/cortex-m"
[package.metadata.docs.rs]
features = ["device"]
[lib]
name = "cortex_m_rt"
path = "src/lib.rs"
[[example]]
name = "alignment"
path = "examples/alignment.rs"
[[example]]
name = "cfg-static"
path = "examples/cfg-static.rs"
[[example]]
name = "data_overflow"
path = "examples/data_overflow.rs"
[[example]]
name = "device"
path = "examples/device.rs"
required-features = ["device"]
[[example]]
name = "divergent-default-handler"
path = "examples/divergent-default-handler.rs"
[[example]]
name = "divergent-exception"
path = "examples/divergent-exception.rs"
[[example]]
name = "entry-static"
path = "examples/entry-static.rs"
[[example]]
name = "hard-fault-trampoline"
path = "examples/hard-fault-trampoline.rs"
[[example]]
name = "main"
path = "examples/main.rs"
[[example]]
name = "minimal"
path = "examples/minimal.rs"
[[example]]
name = "override-exception"
path = "examples/override-exception.rs"
[[example]]
name = "pre_init"
path = "examples/pre_init.rs"
[[example]]
name = "qemu"
path = "examples/qemu.rs"
[[example]]
name = "state"
path = "examples/state.rs"
[[example]]
name = "unsafe-default-handler"
path = "examples/unsafe-default-handler.rs"
[[example]]
name = "unsafe-entry"
path = "examples/unsafe-entry.rs"
[[example]]
name = "unsafe-exception"
path = "examples/unsafe-exception.rs"
[[example]]
name = "unsafe-hard-fault"
path = "examples/unsafe-hard-fault.rs"
[[example]]
name = "unsafety"
path = "examples/unsafety.rs"
[[example]]
name = "warnings"
path = "examples/warnings.rs"
required-features = ["device"]
[[test]]
name = "compiletest"
path = "tests/compiletest.rs"
required-features = ["device"]
[dependencies.cortex-m-rt-macros]
version = "=0.7.5"
[dev-dependencies.cortex-m]
version = "0.7.4"
[dev-dependencies.panic-halt]
version = "0.2.0"
[features]
device = []
paint-stack = []
set-sp = []
set-vtor = []
zero-init-ram = []
[target.'cfg(not(target_os = "none"))'.dev-dependencies.compiletest_rs]
version = "0.11"
+41
View File
@@ -0,0 +1,41 @@
[![crates.io](https://img.shields.io/crates/v/cortex-m-rt.svg)](https://crates.io/crates/cortex-m-rt)
[![crates.io](https://img.shields.io/crates/d/cortex-m-rt.svg)](https://crates.io/crates/cortex-m-rt)
# `cortex-m-rt`
> Startup code and minimal runtime for Cortex-M microcontrollers
This project is developed and maintained by the [Cortex-M team][team].
# [Documentation](https://docs.rs/cortex-m-rt)
# Minimum Supported Rust Version (MSRV)
This crate is guaranteed to compile on stable Rust 1.61.0 and up. It *might*
compile with older versions but that may change in any new patch release.
# License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
## 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 [Cortex-M team][team], promises
to intervene to uphold that code of conduct.
[CoC]: ../CODE_OF_CONDUCT.md
[team]: https://github.com/rust-embedded/wg#the-cortex-m-team
+91
View File
@@ -0,0 +1,91 @@
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::{env, ffi::OsStr};
fn main() {
let mut target = env::var("TARGET").unwrap();
// When using a custom target JSON, `$TARGET` contains the path to that JSON file. By
// convention, these files are named after the actual target triple, eg.
// `thumbv7m-customos-elf.json`, so we extract the file stem here to allow custom target specs.
let path = Path::new(&target);
if path.extension() == Some(OsStr::new("json")) {
target = path
.file_stem()
.map_or(target.clone(), |stem| stem.to_str().unwrap().to_string());
}
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
let link_x = include_bytes!("link.x.in");
let mut f = if env::var_os("CARGO_FEATURE_DEVICE").is_some() {
let mut f = File::create(out.join("link.x")).unwrap();
f.write_all(link_x).unwrap();
// *IMPORTANT*: The weak aliases (i.e. `PROVIDED`) must come *after* `EXTERN(__INTERRUPTS)`.
// Otherwise the linker will ignore user defined interrupts and always populate the table
// with the weak aliases.
writeln!(
f,
r#"
/* Provides weak aliases (cf. PROVIDED) for device specific interrupt handlers */
/* This will usually be provided by a device crate generated using svd2rust (see `device.x`) */
INCLUDE device.x"#
)
.unwrap();
f
} else {
let mut f = File::create(out.join("link.x")).unwrap();
f.write_all(link_x).unwrap();
f
};
println!("cargo:rustc-check-cfg=cfg(armv6m)");
println!("cargo:rustc-check-cfg=cfg(armv7m)");
println!("cargo:rustc-check-cfg=cfg(armv8m)");
println!("cargo:rustc-check-cfg=cfg(cortex_m)");
println!("cargo:rustc-check-cfg=cfg(has_fpu)");
let max_int_handlers = if target.starts_with("thumbv6m-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv6m");
32
} else if target.starts_with("thumbv7m-") || target.starts_with("thumbv7em-") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv7m");
240
} else if target.starts_with("thumbv8m") {
println!("cargo:rustc-cfg=cortex_m");
println!("cargo:rustc-cfg=armv8m");
496
} else {
// Non ARM target. We assume you're just testing the syntax.
// This value seems as good as any.
240
};
if target.ends_with("-eabihf") {
println!("cargo:rustc-cfg=has_fpu");
}
// checking the size of the interrupts portion of the vector table is sub-architecture dependent
writeln!(
f,
r#"
ASSERT(SIZEOF(.vector_table) <= 0x{:x}, "
There can't be more than {1} interrupt handlers. This may be a bug in
your device crate, or you may have registered more than {1} interrupt
handlers.");
"#,
max_int_handlers * 4 + 0x40,
max_int_handlers
)
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=link.x.in");
}
+87
View File
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
set -euxo pipefail
main() {
cargo check --target "$TARGET"
cargo check --target "$TARGET" --features device
# A `critical_section` implementation is always needed.
needed_features=cortex-m/critical-section-single-core
if [ "$TARGET" = x86_64-unknown-linux-gnu ] && [ "$TRAVIS_RUST_VERSION" = stable ]; then
( cd macros && cargo check && cargo test )
cargo test --features "device,${needed_features}" --test compiletest
fi
local examples=(
alignment
divergent-default-handler
divergent-exception
entry-static
hard-fault-trampoline
main
minimal
override-exception
pre_init
qemu
state
unsafe-default-handler
unsafe-entry
unsafe-exception
unsafe-hard-fault
)
local fail_examples=(
data_overflow
)
local linkers=(
# Link with arm-none-eabi-ld
"-C linker=arm-none-eabi-ld"
# Link with arm-none-eabi-gcc, requires -nostartfiles
"-C linker=arm-none-eabi-gcc -C link-arg=-nostartfiles"
# Link with rust-lld (default)
""
)
if [ "$TARGET" != x86_64-unknown-linux-gnu ]; then
# Only test on stable and nightly, not MSRV.
if [ "$TRAVIS_RUST_VERSION" = stable ] || [ "$TRAVIS_RUST_VERSION" = nightly ]; then
RUSTDOCFLAGS="-Cpanic=abort" cargo test --features "${needed_features}" --doc
fi
for linker in "${linkers[@]}"; do
for ex in "${examples[@]}"; do
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker
done
for ex in "${fail_examples[@]}"; do
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" -- $linker && exit 1
cargo rustc --target "$TARGET" --example "$ex" --features "${needed_features}" --release -- $linker && exit 1
done
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example device --features "device,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-sp,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "zero-init-ram,${needed_features}" --release -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" -- $linker
cargo rustc --target "$TARGET" --example minimal --features "set-vtor,${needed_features}" --release -- $linker
done
fi
case $TARGET in
thumbv6m-none-eabi|thumbv7m-none-eabi)
for linker in "${linkers[@]}"; do
env RUSTFLAGS="$linker -C link-arg=-Tlink.x" cargo run \
--target "$TARGET" --features "${needed_features}" --example qemu | grep "x = 42"
env RUSTFLAGS="$linker -C link-arg=-Tlink.x" cargo run \
--target "$TARGET" --features "${needed_features}" --example qemu --release | grep "x = 42"
done
;;
esac
}
main
+33
View File
@@ -0,0 +1,33 @@
//! This is not an example; this is a link-pass test
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use core::ptr;
use rt::entry;
static mut BSS1: u16 = 0;
static mut BSS2: u8 = 0;
static mut DATA1: u8 = 1;
static mut DATA2: u16 = 1;
static RODATA1: &[u8; 3] = b"012";
static RODATA2: &[u8; 2] = b"34";
#[entry]
fn main() -> ! {
unsafe {
let _bss1 = ptr::read_volatile(ptr::addr_of!(BSS1));
let _bss2 = ptr::read_volatile(ptr::addr_of!(BSS2));
let _data1 = ptr::read_volatile(ptr::addr_of!(DATA1));
let _data2 = ptr::read_volatile(ptr::addr_of!(DATA2));
let _rodata1 = ptr::read_volatile(ptr::addr_of!(RODATA1));
let _rodata2 = ptr::read_volatile(ptr::addr_of!(RODATA2));
}
loop {}
}
+27
View File
@@ -0,0 +1,27 @@
//! using `#[cfg]` on `static` shouldn't cause compile errors
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
// This example uses an undefined cfg, `cfg(never)`
#![allow(unexpected_cfgs)]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::{entry, exception};
#[entry]
fn main() -> ! {
#[cfg(never)]
static mut COUNT: u32 = 0;
loop {}
}
#[exception]
fn SysTick() {
#[cfg(never)]
static mut FOO: u32 = 0;
}
+31
View File
@@ -0,0 +1,31 @@
//! This is not an example; this is a linker overflow detection test
//! which should fail to link due to .data overflowing FLASH.
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use core::ptr;
use rt::entry;
// This large static array uses most of .rodata
const RODATA_SIZE: usize = 250 * 1024;
static RODATA: [u8; RODATA_SIZE] = [1u8; RODATA_SIZE];
// This large mutable array causes .data to use the rest of FLASH
// without also overflowing RAM.
const DATA_SIZE: usize = 8 * 1024;
static mut DATA: [u8; DATA_SIZE] = [1u8; DATA_SIZE];
#[entry]
fn main() -> ! {
unsafe {
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(RODATA) as *const u8);
let _bigdata: u8 = ptr::read_volatile(ptr::addr_of!(DATA) as *const u8);
}
loop {}
}
+37
View File
@@ -0,0 +1,37 @@
//! Manually create the interrupts portion of the vector table
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::entry;
#[entry]
fn main() -> ! {
loop {}
}
// interrupts portion of the vector table
#[repr(C)]
pub union Vector {
handler: unsafe extern "C" fn(),
reserved: usize,
}
extern "C" {
fn WWDG();
fn PVD();
}
#[allow(unsafe_code)]
#[link_section = ".vector_table.interrupts"]
#[no_mangle]
pub static __INTERRUPTS: [Vector; 3] = [
Vector { handler: WWDG },
Vector { reserved: 0 },
Vector { handler: PVD },
];
@@ -0,0 +1,18 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) -> ! {
loop {}
}
+18
View File
@@ -0,0 +1,18 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SysTick() -> ! {
loop {}
}
+20
View File
@@ -0,0 +1,20 @@
//! `static mut` variables local to the entry point are safe to use
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::entry;
#[entry]
fn main() -> ! {
static mut COUNT: u32 = 0;
loop {
*COUNT += 1;
}
}
+31
View File
@@ -0,0 +1,31 @@
//! This is not an example; this is a linker test that ensures
//! that the jump from HardFault to _HardFault doesn't exceed
//! the 2kB limit of the branch instruction.
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use core::arch::asm;
use cortex_m_rt::{entry, exception, ExceptionFrame};
// This defines both `HardFault` and `_HardFault`. Both should have
// link_section attributes placing them at the end of the .text section,
// close to each other. If one of them is missing that attribute, they
// will end up separated by `foo`, which will make the linker fail.
#[exception(trampoline = true)]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
#[entry]
fn foo() -> ! {
unsafe {
// 2kB of NOP instructions to make the function artificially larger
asm!(".fill 1024,2,0xbf00",);
}
loop {}
}
+13
View File
@@ -0,0 +1,13 @@
//! Directly plug a `main` symbol instead of using `#[entry]`
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
#[no_mangle]
pub unsafe extern "C" fn main() -> ! {
loop {}
}
+17
View File
@@ -0,0 +1,17 @@
//! Minimal `cortex-m-rt` based program
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::entry;
// the program entry point
#[entry]
fn main() -> ! {
loop {}
}
+29
View File
@@ -0,0 +1,29 @@
//! How to override the hard fault exception handler and the default exception handler
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m;
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use cortex_m::asm;
use rt::{entry, exception, ExceptionFrame};
#[entry]
fn main() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) {
asm::bkpt();
}
#[exception]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
asm::bkpt();
loop {}
}
+20
View File
@@ -0,0 +1,20 @@
//! `cortex-m-rt` based program with a function run before RAM is initialized.
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::{entry, pre_init};
#[pre_init]
unsafe fn disable_watchdog() {
// Do what you need to disable the watchdog.
}
#[entry]
fn main() -> ! {
loop {}
}
+34
View File
@@ -0,0 +1,34 @@
#![no_main]
#![no_std]
use core::{
fmt::Write,
sync::atomic::{AtomicU32, Ordering},
};
static DATA_VAL: AtomicU32 = AtomicU32::new(1234);
static BSS_VAL: AtomicU32 = AtomicU32::new(0);
#[cortex_m_rt::entry]
fn main() -> ! {
let x = 42;
loop {
let mut hstdout = cortex_m_semihosting::hio::hstdout().unwrap();
// check that .data and .bss were initialised OK
if DATA_VAL.load(Ordering::Relaxed) == 1234 && BSS_VAL.load(Ordering::Relaxed) == 0 {
_ = writeln!(hstdout, "x = {}", x);
}
cortex_m_semihosting::debug::exit(cortex_m_semihosting::debug::EXIT_SUCCESS);
}
}
// Define a panic handler that uses semihosting to exit immediately,
// so that any panics cause qemu to quit instead of hang.
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {
cortex_m_semihosting::debug::exit(cortex_m_semihosting::debug::EXIT_FAILURE);
}
}
+24
View File
@@ -0,0 +1,24 @@
//! Preserving state across executions of an exception handler
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt as rt;
extern crate panic_halt;
use rt::{entry, exception};
#[entry]
fn main() -> ! {
loop {}
}
// exception handler with state
#[exception]
fn SysTick() {
static mut STATE: u32 = 0;
*STATE += 1;
}
+16
View File
@@ -0,0 +1,16 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) {}
+13
View File
@@ -0,0 +1,13 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry]
unsafe fn foo() -> ! {
loop {}
}
+16
View File
@@ -0,0 +1,16 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn SysTick() {}
+18
View File
@@ -0,0 +1,18 @@
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
+36
View File
@@ -0,0 +1,36 @@
//! Checks that the declared unsafety is respected by the attributes
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
unsafe fn main() -> ! {
foo();
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) {
foo();
}
#[exception]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
foo();
loop {}
}
#[exception]
unsafe fn SysTick() {
foo();
}
unsafe fn foo() {}
+51
View File
@@ -0,0 +1,51 @@
//! Tests that a crate can still build with all warnings enabled.
//!
//! The code generated by the `cortex-m-rt` macros might need to manually
//! `#[allow]` some of them (even though Rust does that by default for a few
//! warnings too).
#![no_std]
#![no_main]
#![deny(warnings, missing_docs, rust_2018_idioms)]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt, pre_init, ExceptionFrame};
#[allow(non_camel_case_types)]
enum interrupt {
INT,
}
extern "C" {
fn INT();
}
#[repr(C)]
union Vector {
#[allow(dead_code)]
handler: unsafe extern "C" fn(),
}
#[link_section = ".vector_table.interrupts"]
#[no_mangle]
#[used]
static __INTERRUPTS: [Vector; 1] = [Vector { handler: INT }];
/// Dummy interrupt.
#[interrupt]
fn INT() {}
#[exception]
fn HardFault(_eh: &ExceptionFrame) -> ! {
loop {}
}
#[entry]
fn main() -> ! {
loop {}
}
#[pre_init]
unsafe fn pre_init() {}
+279
View File
@@ -0,0 +1,279 @@
/* # Developer notes
- Symbols that start with a double underscore (__) are considered "private"
- Symbols that start with a single underscore (_) are considered "semi-public"; they can be
overridden in a user linker script, but should not be referred from user code (e.g. `extern "C" {
static mut __sbss }`).
- `EXTERN` forces the linker to keep a symbol in the final binary. We use this to make sure a
symbol is not dropped if it appears in or near the front of the linker arguments and "it's not
needed" by any of the preceding objects (linker arguments)
- `PROVIDE` is used to provide default values that can be overridden by a user linker script
- On alignment: it's important for correctness that the VMA boundaries of both .bss and .data *and*
the LMA of .data are all 4-byte aligned. These alignments are assumed by the RAM initialization
routine. There's also a second benefit: 4-byte aligned boundaries means that you won't see
"Address (..) is out of bounds" in the disassembly produced by `objdump`.
*/
/* Provides information about the memory layout of the device */
/* This will be provided by the user (see `memory.x`) or by a Board Support Crate */
INCLUDE memory.x
/* # Entry point = reset vector */
EXTERN(__RESET_VECTOR);
EXTERN(Reset);
ENTRY(Reset);
/* # Exception vectors */
/* This is effectively weak aliasing at the linker level */
/* The user can override any of these aliases by defining the corresponding symbol themselves (cf.
the `exception!` macro) */
EXTERN(__EXCEPTIONS); /* depends on all the these PROVIDED symbols */
EXTERN(DefaultHandler);
PROVIDE(NonMaskableInt = DefaultHandler);
EXTERN(HardFaultTrampoline);
PROVIDE(MemoryManagement = DefaultHandler);
PROVIDE(BusFault = DefaultHandler);
PROVIDE(UsageFault = DefaultHandler);
PROVIDE(SecureFault = DefaultHandler);
PROVIDE(SVCall = DefaultHandler);
PROVIDE(DebugMonitor = DefaultHandler);
PROVIDE(PendSV = DefaultHandler);
PROVIDE(SysTick = DefaultHandler);
PROVIDE(DefaultHandler = DefaultHandler_);
PROVIDE(HardFault = HardFault_);
/* # Interrupt vectors */
EXTERN(__INTERRUPTS); /* `static` variable similar to `__EXCEPTIONS` */
/* # Pre-initialization function */
/* If the user overrides this using the `pre_init!` macro or by creating a `__pre_init` function,
then the function this points to will be called before the RAM is initialized. */
PROVIDE(__pre_init = DefaultPreInit);
/* # Sections */
SECTIONS
{
PROVIDE(_ram_start = ORIGIN(RAM));
PROVIDE(_ram_end = ORIGIN(RAM) + LENGTH(RAM));
PROVIDE(_stack_start = _ram_end);
/* ## Sections in FLASH */
/* ### Vector table */
.vector_table ORIGIN(FLASH) :
{
__vector_table = .;
/* Initial Stack Pointer (SP) value.
* We mask the bottom three bits to force 8-byte alignment.
* Despite having an assert for this later, it's possible that a separate
* linker script could override _stack_start after the assert is checked.
*/
LONG(_stack_start & 0xFFFFFFF8);
/* Reset vector */
KEEP(*(.vector_table.reset_vector)); /* this is the `__RESET_VECTOR` symbol */
/* Exceptions */
__exceptions = .; /* start of exceptions */
KEEP(*(.vector_table.exceptions)); /* this is the `__EXCEPTIONS` symbol */
__eexceptions = .; /* end of exceptions */
/* Device specific interrupts */
KEEP(*(.vector_table.interrupts)); /* this is the `__INTERRUPTS` symbol */
} > FLASH
PROVIDE(_stext = ADDR(.vector_table) + SIZEOF(.vector_table));
/* ### .text */
.text _stext :
{
__stext = .;
*(.Reset);
*(.text .text.*);
/* The HardFaultTrampoline uses the `b` instruction to enter `HardFault`,
so must be placed close to it. */
*(.HardFaultTrampoline);
*(.HardFault.*);
. = ALIGN(4); /* Pad .text to the alignment to workaround overlapping load section bug in old lld */
__etext = .;
} > FLASH
/* ### .rodata */
.rodata : ALIGN(4)
{
. = ALIGN(4);
__srodata = .;
*(.rodata .rodata.*);
/* 4-byte align the end (VMA) of this section.
This is required by LLD to ensure the LMA of the following .data
section will have the correct alignment. */
. = ALIGN(4);
__erodata = .;
} > FLASH
/* ## Sections in RAM */
/* ### .data */
.data : ALIGN(4)
{
. = ALIGN(4);
__sdata = .;
*(.data .data.*);
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
} > RAM AT>FLASH
/* Allow sections from user `memory.x` injected using `INSERT AFTER .data` to
* use the .data loading mechanism by pushing __edata. Note: do not change
* output region or load region in those user sections! */
. = ALIGN(4);
__edata = .;
/* LMA of .data */
__sidata = LOADADDR(.data);
/* ### .gnu.sgstubs
This section contains the TrustZone-M veneers put there by the Arm GNU linker. */
/* Security Attribution Unit blocks must be 32 bytes aligned. */
/* Note that this pads the FLASH usage to 32 byte alignment. */
.gnu.sgstubs : ALIGN(32)
{
. = ALIGN(32);
__veneer_base = .;
*(.gnu.sgstubs*)
. = ALIGN(32);
} > FLASH
/* Place `__veneer_limit` outside the `.gnu.sgstubs` section because veneers are
* always inserted last in the section, which would otherwise be _after_ the `__veneer_limit` symbol.
*/
. = ALIGN(32);
__veneer_limit = .;
/* ### .bss */
.bss (NOLOAD) : ALIGN(4)
{
. = ALIGN(4);
__sbss = .;
*(.bss .bss.*);
*(COMMON); /* Uninitialized C statics */
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
} > RAM
/* Allow sections from user `memory.x` injected using `INSERT AFTER .bss` to
* use the .bss zeroing mechanism by pushing __ebss. Note: do not change
* output region or load region in those user sections! */
. = ALIGN(4);
__ebss = .;
/* ### .uninit */
.uninit (NOLOAD) : ALIGN(4)
{
. = ALIGN(4);
__suninit = .;
*(.uninit .uninit.*);
. = ALIGN(4);
__euninit = .;
} > RAM
/* Place the heap right after `.uninit` in RAM */
PROVIDE(__sheap = __euninit);
/* Place stack end at the end of allocated RAM */
PROVIDE(_stack_end = __euninit);
/* ## .got */
/* Dynamic relocations are unsupported. This section is only used to detect relocatable code in
the input files and raise an error if relocatable code is found */
.got (NOLOAD) :
{
KEEP(*(.got .got.*));
}
/* ## Discarded sections */
/DISCARD/ :
{
/* Unused exception related info that only wastes space */
*(.ARM.exidx);
*(.ARM.exidx.*);
*(.ARM.extab.*);
}
}
/* Do not exceed this mark in the error messages below | */
/* # Alignment checks */
ASSERT(ORIGIN(FLASH) % 4 == 0, "
ERROR(cortex-m-rt): the start of the FLASH region must be 4-byte aligned");
ASSERT(ORIGIN(RAM) % 4 == 0, "
ERROR(cortex-m-rt): the start of the RAM region must be 4-byte aligned");
ASSERT(__sdata % 4 == 0 && __edata % 4 == 0, "
BUG(cortex-m-rt): .data is not 4-byte aligned");
ASSERT(__sidata % 4 == 0, "
BUG(cortex-m-rt): the LMA of .data is not 4-byte aligned");
ASSERT(__sbss % 4 == 0 && __ebss % 4 == 0, "
BUG(cortex-m-rt): .bss is not 4-byte aligned");
ASSERT(__sheap % 4 == 0, "
BUG(cortex-m-rt): start of .heap is not 4-byte aligned");
ASSERT(_stack_start % 8 == 0, "
ERROR(cortex-m-rt): stack start address is not 8-byte aligned.
If you have set _stack_start, check it's set to an address which is a multiple of 8 bytes.
If you haven't, stack starts at the end of RAM by default. Check that both RAM
origin and length are set to multiples of 8 in the `memory.x` file.");
ASSERT(_stack_end % 4 == 0, "
ERROR(cortex-m-rt): end of stack is not 4-byte aligned");
ASSERT(_stack_start >= _stack_end, "
ERROR(cortex-m-rt): stack end address is not below stack start.");
/* # Position checks */
/* ## .vector_table
*
* If the *start* of exception vectors is not 8 bytes past the start of the
* vector table, then we somehow did not place the reset vector, which should
* live 4 bytes past the start of the vector table.
*/
ASSERT(__exceptions == ADDR(.vector_table) + 0x8, "
BUG(cortex-m-rt): the reset vector is missing");
ASSERT(__eexceptions == ADDR(.vector_table) + 0x40, "
BUG(cortex-m-rt): the exception vectors are missing");
ASSERT(SIZEOF(.vector_table) > 0x40, "
ERROR(cortex-m-rt): The interrupt vectors are missing.
Possible solutions, from most likely to less likely:
- Link to a svd2rust generated device crate
- Check that you actually use the device/hal/bsp crate in your code
- Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency
may be enabling it)
- Supply the interrupt handlers yourself. Check the documentation for details.");
/* ## .text */
ASSERT(ADDR(.vector_table) + SIZEOF(.vector_table) <= _stext, "
ERROR(cortex-m-rt): The .text section can't be placed inside the .vector_table section
Set _stext to an address greater than the end of .vector_table (See output of `nm`)");
ASSERT(_stext > ORIGIN(FLASH) && _stext < ORIGIN(FLASH) + LENGTH(FLASH), "
ERROR(cortex-m-rt): The .text section must be placed inside the FLASH memory.
Set _stext to an address within the FLASH region.");
/* # Other checks */
ASSERT(SIZEOF(.got) == 0, "
ERROR(cortex-m-rt): .got section detected in the input object files
Dynamic relocations are not supported. If you are linking to C code compiled using
the 'cc' crate then modify your build script to compile the C code _without_
the -fPIC flag. See the documentation of the `cc::Build.pic` method for details.");
/* Do not exceed this mark in the error messages above | */
+1282
View File
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
# How to run
To run the compile tests, use the following command on the root of the project:
```
cargo test --package cortex-m-rt --test compiletest --features device
```
@@ -0,0 +1,16 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16, undef: u32) {}
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(i16) [-> !]`
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) -> u32 {
//~^ ERROR `DefaultHandler` must have signature `unsafe fn(i16) [-> !]`
0
}
@@ -0,0 +1,22 @@
// ignore-test :sadface: it's not possible to prevent this user error at compile time
// see rust-lang/rust#53975 for details
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
mod hidden {
use cortex_m_rt::exception;
#[exception]
unsafe fn DefaultHandler(_irqn: i16) {}
}
@@ -0,0 +1,22 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn DefaultHandler(_irqn: i16) {}
pub mod reachable {
use cortex_m_rt::exception;
#[exception] //~ ERROR symbol `DefaultHandler` is already defined
unsafe fn DefaultHandler(_irqn: i16) {}
}
@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[allow(non_camel_case_types)]
enum interrupt {
UART0,
}
#[entry]
fn foo() -> ! {
static mut X: u32 = 0;
static mut X: i32 = 0; //~ ERROR the name `X` is defined multiple times
loop {}
}
#[exception]
fn SVCall() {
static mut X: u32 = 0;
static mut X: i32 = 0; //~ ERROR the name `X` is defined multiple times
}
#[interrupt]
fn UART0() {
static mut X: u32 = 0;
static mut X: i32 = 0; //~ ERROR the name `X` is defined multiple times
}
+12
View File
@@ -0,0 +1,12 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry(foo)] //~ ERROR This attribute accepts no arguments
fn foo() -> ! {
loop {}
}
@@ -0,0 +1,11 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry]
fn foo() {}
//~^ ERROR `#[entry]` function must have signature `[unsafe] fn() -> !`
@@ -0,0 +1,11 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry]
fn foo(undef: i32) -> ! {}
//~^ ERROR `#[entry]` function must have signature `[unsafe] fn() -> !`
@@ -0,0 +1,13 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry]
extern "C" fn foo() -> ! {
//~^ ERROR `#[entry]` function must have signature `[unsafe] fn() -> !`
loop {}
}
+19
View File
@@ -0,0 +1,19 @@
// ignore-test :sadface: it's not possible to prevent this user error at compile time
// see rust-lang/rust#53975 for details
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
mod hidden {
use cortex_m_rt::entry;
// this function needs to be "reachable" (all modules between it and the crate root must be
// `pub`) or linking will fail
#[entry]
fn foo() -> ! { //~ ERROR function is never used
loop {}
}
}
@@ -0,0 +1,26 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
static mut COUNT: u64 = 0;
loop {
if *COUNT % 2 == 0 {
*COUNT += 1;
} else {
*COUNT *= 2;
}
}
}
#[exception]
fn SysTick() {
// If this was allowed it would lead to a data race as `SysTick` can preempt `foo`
foo(); //~ ERROR cannot find function `foo` in this scope
}
+17
View File
@@ -0,0 +1,17 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::entry;
#[entry]
fn foo() -> ! {
loop {}
}
#[entry] //~ ERROR symbol `main` is already defined
fn bar() -> ! {
loop {}
}
+15
View File
@@ -0,0 +1,15 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception(SysTick)] //~ ERROR This attribute accepts no arguments
fn SysTick() {}
@@ -0,0 +1,16 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SysTick(undef: u32) {}
//~^ ERROR `#[exception]` handlers other than `DefaultHandler` and `HardFault` must have signature `[unsafe] fn() [-> !]`
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SysTick() -> u32 {
//~^ ERROR `#[exception]` handlers other than `DefaultHandler` and `HardFault` must have signature `[unsafe] fn() [-> !]`
0
}
@@ -0,0 +1,22 @@
// ignore-test :sadface: it's not possible to prevent this user error at compile time
// see rust-lang/rust#53975 for details
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
mod hidden {
use cortex_m_rt::exception;
#[exception]
fn SysTick() {}
}
@@ -0,0 +1,24 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn DefaultHandler(_irq: i16) {}
//~^ ERROR defining a `DefaultHandler` is unsafe and requires an `unsafe fn`
#[exception]
fn HardFault() {}
//~^ ERROR defining a `HardFault` handler is unsafe and requires an `unsafe fn`
#[exception]
fn NonMaskableInt() {}
//~^ ERROR defining a `NonMaskableInt` handler is unsafe and requires an `unsafe fn`
@@ -0,0 +1,29 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SysTick() {
static mut COUNT: u64 = 0;
if *COUNT % 2 == 0 {
*COUNT += 1;
} else {
*COUNT *= 2;
}
}
#[exception]
fn SVCall() {
// If this was allowed it would lead to a data race as `SVCall` could preempt `SysTick`
SysTick(); //~ ERROR cannot find function, tuple struct or tuple variant `SysTick` in this scope [E0425]
}
@@ -0,0 +1,22 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SysTick() {}
pub mod reachable {
use cortex_m_rt::exception;
#[exception] //~ ERROR symbol `SysTick` is already defined
fn SysTick() {}
}
@@ -0,0 +1,16 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
fn SecureFault() {}
//~^ ERROR no variant or associated item named `SecureFault`
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn HardFault(_ef: &ExceptionFrame, undef: u32) -> ! {
//~^ ERROR `HardFault` handler must have signature `unsafe fn(&ExceptionFrame) -> !`
loop {}
}
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception(trampoline = true)]
unsafe fn HardFault() -> ! {
//~^ ERROR `HardFault` handler must have signature `unsafe fn(&ExceptionFrame) -> !`
loop {}
}
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception(trampoline = false)]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
//~^ ERROR `HardFault` handler must have signature `unsafe fn() -> !`
loop {}
}
@@ -0,0 +1,24 @@
// ignore-test :sadface: it's not possible to prevent this user error at compile time
// see rust-lang/rust#53975 for details
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
mod hidden {
use cortex_m_rt::{exception, ExceptionFrame};
#[exception]
fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
}
@@ -0,0 +1,26 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception(trampoline = false)]
unsafe fn HardFault() -> ! {
loop {}
}
pub mod reachable {
use cortex_m_rt::{exception, ExceptionFrame};
#[exception] //~ ERROR symbol `_HardFault` is already defined
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
}
@@ -0,0 +1,26 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, ExceptionFrame};
#[entry]
fn foo() -> ! {
loop {}
}
#[exception]
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
pub mod reachable {
use cortex_m_rt::{exception, ExceptionFrame};
#[exception] //~ ERROR symbol `_HardFault` is already defined
unsafe fn HardFault(_ef: &ExceptionFrame) -> ! {
loop {}
}
}
+20
View File
@@ -0,0 +1,20 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
}
#[interrupt(true)] //~ ERROR This attribute accepts no arguments
fn USART1() {}
@@ -0,0 +1,21 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
}
#[interrupt]
fn USART1(undef: i32) {}
//~^ ERROR `#[interrupt]` handlers must have signature `[unsafe] fn() [-> !]`
@@ -0,0 +1,23 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
}
#[interrupt]
fn USART1() -> i32 {
//~^ ERROR `#[interrupt]` handlers must have signature `[unsafe] fn() [-> !]`
0
}
@@ -0,0 +1,22 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn entry() -> ! {
loop {}
}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
}
// NOTE this looks a bit better when using a device crate:
// "no variant named `foo` found for type `stm32f30x::Interrupt` in the current scope"
#[interrupt]
fn foo() {} //~ ERROR no variant or associated item named `foo` found for enum `interrupt` in the current scope [E0599]
@@ -0,0 +1,15 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
#[interrupt] //~ ERROR failed to resolve: use of undeclared crate or module `interrupt`
fn USART1() {}
@@ -0,0 +1,34 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
USART2,
}
#[interrupt]
fn USART1() {
static mut COUNT: u64 = 0;
if *COUNT % 2 == 0 {
*COUNT += 1;
} else {
*COUNT *= 2;
}
}
#[interrupt]
fn USART2() {
USART1(); //~ ERROR cannot find function, tuple struct or tuple variant `USART1` in this scope [E0425]
}
@@ -0,0 +1,31 @@
#![allow(non_camel_case_types)]
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, interrupt};
#[entry]
fn foo() -> ! {
loop {}
}
enum interrupt {
USART1,
}
#[interrupt]
fn USART1() {}
pub mod reachable {
use cortex_m_rt::interrupt;
enum interrupt {
USART1,
}
#[interrupt] //~ ERROR symbol `USART1` is already defined
fn USART1() {}
}
@@ -0,0 +1,44 @@
//! Tests that no `&'static mut` to static mutable resources can be obtained, which would be
//! unsound.
//!
//! Regression test for https://github.com/rust-embedded/cortex-m-rt/issues/212
#![no_std]
#![no_main]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt, ExceptionFrame};
#[allow(non_camel_case_types)]
enum interrupt {
UART0,
}
#[exception]
fn SVCall() {
static mut STAT: u8 = 0;
let _stat: &'static mut u8 = STAT;
//~^ ERROR lifetime may not live long enough
}
#[interrupt]
fn UART0() {
static mut STAT: u8 = 0;
let _stat: &'static mut u8 = STAT;
//~^ ERROR lifetime may not live long enough
}
#[entry]
fn you_died_of_dis_entry() -> ! {
static mut STAT: u8 = 0;
// Allowed. This is sound for the entry point since it is only ever called once, and it makes
// resources far more useful.
let _stat: &'static mut u8 = STAT;
loop {}
}
+15
View File
@@ -0,0 +1,15 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
#[pre_init(foo)] //~ ERROR This attribute accepts no arguments
unsafe fn foo() {}
#[entry]
fn baz() -> ! {
loop {}
}
@@ -0,0 +1,16 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
#[pre_init]
fn foo() {}
//~^ ERROR `#[pre_init]` function must have signature `unsafe fn()`
#[entry]
fn bar() -> ! {
loop {}
}
@@ -0,0 +1,16 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
#[pre_init]
unsafe fn foo(undef: i32) {}
//~^ ERROR `#[pre_init]` function must have signature `unsafe fn()`
#[entry]
fn bar() -> ! {
loop {}
}
@@ -0,0 +1,23 @@
// ignore-test :sadface: it's not possible to prevent this user error at compile time
// see rust-lang/rust#53975 for details
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
mod hidden {
use cortex_m_rt::pre_init;
// this function needs to be "reachable" (all modules between it and the crate root must be
// `pub`) or the function will be ignored
#[entry]
unsafe fn pre_init() {} //~ ERROR function is never used
}
#[entry]
fn foo() -> ! {
//~ ERROR function is never used
loop {}
}
+18
View File
@@ -0,0 +1,18 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, pre_init};
#[pre_init]
unsafe fn foo() {}
#[pre_init] //~ ERROR symbol `__pre_init` is already defined
unsafe fn bar() {}
#[entry]
fn baz() -> ! {
loop {}
}
@@ -0,0 +1,45 @@
//! Makes sure that the expansion of the attributes doesn't put the resource initializer in an
//! implicit `unsafe` block.
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[allow(non_camel_case_types)]
enum interrupt {
UART0,
}
const unsafe fn init() -> u32 { 0 }
#[entry]
fn foo() -> ! {
static mut X: u32 = init(); //~ ERROR requires unsafe
loop {}
}
#[exception]
fn SVCall() {
static mut X: u32 = init(); //~ ERROR requires unsafe
}
#[exception]
unsafe fn DefaultHandler(_irq: i16) {
static mut X: u32 = init(); //~ ERROR requires unsafe
}
#[exception]
unsafe fn HardFault(_frame: &cortex_m_rt::ExceptionFrame) -> ! {
static mut X: u32 = init(); //~ ERROR requires unsafe
loop {}
}
#[interrupt]
fn UART0() {
static mut X: u32 = init(); //~ ERROR requires unsafe
}
+32
View File
@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[inline] //~ ERROR this attribute is not allowed on a cortex-m-rt entry point
#[entry]
fn foo() -> ! {
loop {}
}
#[inline] //~ ERROR this attribute is not allowed on an exception handler controlled by cortex-m-rt
#[exception]
fn SysTick() {}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
USART2,
}
#[inline] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART1() {}
#[cfg(feature = "device")]
#[cfg_attr(feature = "device", inline)] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART2() {}
+32
View File
@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[export_name = "not_allowed"] //~ ERROR this attribute is not allowed on a cortex-m-rt entry point
#[entry]
fn foo() -> ! {
loop {}
}
#[export_name = "not_allowed"] //~ ERROR this attribute is not allowed on an exception handler controlled by cortex-m-rt
#[exception]
fn SysTick() {}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
USART2,
}
#[export_name = "not_allowed"] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART1() {}
#[cfg(feature = "device")]
#[cfg_attr(feature = "device", export_name = "not_allowed")] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART2() {}
+32
View File
@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[no_mangle] //~ ERROR this attribute is not allowed on a cortex-m-rt entry point
#[entry]
fn foo() -> ! {
loop {}
}
#[no_mangle] //~ ERROR this attribute is not allowed on an exception handler controlled by cortex-m-rt
#[exception]
fn SysTick() {}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
USART2,
}
#[no_mangle] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART1() {}
#[cfg(feature = "device")]
#[cfg_attr(feature = "device", no_mangle)] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART2() {}
+32
View File
@@ -0,0 +1,32 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception, interrupt};
#[must_use] //~ ERROR this attribute is not allowed on a cortex-m-rt entry point
#[entry]
fn foo() -> ! {
loop {}
}
#[must_use] //~ ERROR this attribute is not allowed on an exception handler controlled by cortex-m-rt
#[exception]
fn SysTick() {}
#[allow(non_camel_case_types)]
enum interrupt {
USART1,
USART2,
}
#[must_use] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART1() {}
#[cfg(feature = "device")]
#[cfg_attr(feature = "device", must_use)] //~ ERROR this attribute is not allowed on an interrupt handler controlled by cortex-m-rt
#[interrupt]
fn USART2() {}
@@ -0,0 +1,13 @@
#![no_main]
#![no_std]
extern crate cortex_m_rt;
extern crate panic_halt;
use cortex_m_rt::{entry, exception};
#[exception]
#[entry] //~ ERROR this attribute is not allowed on an exception handler
fn SVCall() -> ! {
loop {}
}
+22
View File
@@ -0,0 +1,22 @@
extern crate compiletest_rs as compiletest;
use std::path::PathBuf;
fn run_mode(mode: &'static str) {
let mut config = compiletest::Config::default();
config.mode = mode.parse().expect("Invalid mode");
config.src_base = PathBuf::from(format!("tests/{}", mode));
config.target_rustcflags = Some(
"-L ../target/debug -L ../target/debug/deps -C panic=abort --cfg feature=\"device\""
.to_owned(),
);
config.clean_rmeta(); // If your tests import the parent crate, this helps with E0464
compiletest::run_tests(&config);
}
#[test]
fn compile_test() {
run_mode("compile-fail");
}