aboutsummaryrefslogtreecommitdiff
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-04-26make singleton! work on stableGravatar Jorge Aparicio 2-17/+4
2018-04-26make compilable on stableGravatar Jorge Aparicio 17-98/+347
2018-04-12Add SEV assembly instructionGravatar Wim Looman 1-0/+11
2018-01-25don't trip the unsafe_code lintGravatar Jorge Aparicio 1-4/+41
2018-01-23singleton!: check that calls to unsafe functions require an unsafe blockGravatar Jorge Aparicio 1-5/+9
2018-01-23initialize singletons at runtimeGravatar Jorge Aparicio 2-2/+5
2018-01-17impl Send for all the peripheralsGravatar Jorge Aparicio 1-3/+29
2018-01-16reexport Peripherals at the root for convenienceGravatar Jorge Aparicio 1-0/+2
2018-01-15v0.4.0Gravatar Jorge Aparicio 1-5/+15
2018-01-15fixes and make sure the whole documentation is visible on docs.rsGravatar Jorge Aparicio 9-60/+83
2018-01-15hide ARMv7-M only peripherals on thumbv6m-none-eabiGravatar Jorge Aparicio 2-6/+25
2018-01-15better document the SYST APIGravatar Jorge Aparicio 1-2/+14
closes #59
2018-01-15Auto merge of #70 - japaric:safe-static-mut, r=japaricGravatar homunkulus 1-0/+44
safe `&'static mut` references through a runtime checked macro runtime checked implementation of japaric/cortex-m-rtfm#59 that doesn't depend on RTFM macros TODO - [ ] bikeshed macro syntax
2018-01-15address review commentsGravatar Jorge Aparicio 1-5/+8
2018-01-11Auto merge of #69 - japaric:revise-api, r=japaricGravatar homunkulus 9-165/+282
revise peripheral API This PR changes the signature of many of the high level methods available on peripherals like `NVIC::get_priority`. Additionally some instance methods have been turned into static methods. The following guidelines have been used to apply the changes: - If the method body contains a single, atomic read operation with *no* side effects (e.g. the read operation clears one of the bits of the register): the signature changed to make the method static, i.e. `&self` was removed from the signature. - If the method involves writing to or a RMW operation on a register: the signature changed to take the singleton by `&mut self` reference. - If the method involves only read operations where at least one of them modifies the value of a register: the signature changed to take the singleton by `&mut self` reference. The rationale for this last guideline is that using `&self`, instead of `&mut self`, lets the user (unintentionally) break abstractions in the presence of generators. Example below: ``` rust let peripherals = Peripherals::take().unwrap(); let syst = &peripherals.SYST; // tasks let mut a = || { loop { // yielding "busy wait" while !a.has_wrapped() { yield; } // do stuff } }; let mut b = || { // .. // *NOTE* the problem is in the line below: this `is_counter_enabled` method reads the CSR // register and that read operation clears the COUNTFLAG bit of the register (if set), which is // the bit the `has_wrapped` method checks for. if syst.is_counter_enabled() { // .. } // .. }; ``` One more guideline was considered but the required conditions didn't apply to any of the existing methods: - If the method involves only non side effectful, non necessarily atomic read operations: the signature of the method should remain as `&self`. The rationale for this guideline is that a static method (no `self` argument) wouldn't be appropriate because that can result in a torn read if the read operation can be preempted by some context that modifies the register. In any case, this last guideline doesn't seem to apply well to the peripherals structs exposed by this crate because they *deref* to a `RegisterBlock` that allows mutation through a `&self` reference. When these two properties (the guideline and `Deref<Target=RegisterBlock>`) are mixed the user can potentially break abstractions using generators (as shown in the `syst` example). cc @hannobraun closes #67
2018-01-11fix thumbv6m buildGravatar Jorge Aparicio 1-1/+1
2018-01-11address review commentsGravatar Jorge Aparicio 2-10/+22
2018-01-11Auto merge of #72 - japaric:cm7-r0p1, r=japaricGravatar homunkulus 2-4/+26
add a Cargo feature, cm7-r0p1, to fix a Cortex-M7 BASEPRI erratum see japaric/cortex-m-rtfm#53 for background information
2018-01-11make `Stim::write_*` methods take `&mut self` instead of `&self`Gravatar Jorge Aparicio 3-12/+18
this prevents people from overlapping non-atomic write operations on the same stimulus port when working with generators (cooperative tasks). For example, with this change the following code won't compile ``` rust let stim = &mut ITM.stim[0]; let a = || { loop { // .. for byte in b"Hello, world!".iter() { while !stim.is_fifo_ready() { yield } stim.write_u8(*byte); } // .. } }; let b = || { loop { // .. for byte in b"The quick brown fox jumps over the lazy dog".iter() { while !stim.is_fifo_ready() { yield } stim.write_u8(*byte); } // .. } }; ``` A possible fix for the above code is to use different stimulus ports in each task (generator).
2017-12-23add a Cargo feature, cm7-r0p1, to fix a Cortex-M7 BASEPRI erratumGravatar Jorge Aparicio 2-4/+26
2017-12-23revise peripheral APIGravatar Jorge Aparicio 9-165/+270
closes #67
2017-12-23inline(always) -> inlineGravatar Jorge Aparicio 2-11/+11
2017-12-23map asm! ops to unimplemented! on non ARM targetsGravatar Jorge Aparicio 12-191/+183
2017-12-23safe `&'static mut` references through a runtime checked macroGravatar Jorge Aparicio 1-0/+41
2017-12-21document `set_fpu_access_mode` footgunGravatar Jorge Aparicio 1-0/+5
closes #44
2017-12-18Fix `IPR` representation on ARMv6-MGravatar Hanno Braun 1-5/+68
On ARMv6-M, anything but world-aligned access to the IPR registers will lead to unpredictable results. Fixes #61.
2017-12-18Make all available NVIC registers accessibleGravatar Hanno Braun 2-17/+11
According to the ARMv7-M Technical Reference Manual[1], there are 124 IPR registers available on ARMv7-M, and 16 of all others. I don't know where the original numbers came from, since on ARMv6-M, there are only 8 IPR registers available, and 1 of each of the others.[2] This commit removes some test cases that were checking the address of the last register. Since the last register has changed, those are no longer applicable. I decided to remove instead of update them, since they only really test the length of each register type, which is obvious enough from the code. [1]: https://silver.arm.com/download/ARM_and_AMBA_Architecture/AR580-DA-70000-r0p0-05rel0/DDI0403E_B_armv7m_arm.pdf [2]: https://silver.arm.com/download/ARM_and_AMBA_Architecture/AR585-DA-70000-r0p0-00rel0/DDI0419C_arm_architecture_v6m_reference_manual.pdf
2017-12-09docs: unhide `Peripherals::steal` methodGravatar Jorge Aparicio 1-1/+1
2017-12-09fix testsGravatar Jorge Aparicio 2-11/+12
2017-12-09s/all/take/g s/_all/steal/gGravatar Jorge Aparicio 1-3/+5
2017-11-21turn peripherals into scoped singletonsGravatar Jorge Aparicio 15-981/+1356
2017-08-05add Formatter and Flush Control Register to struct TPIUGravatar Jan Niehusmann 2-2/+6
2017-07-20v0.3.1v0.3.1Gravatar Jorge Aparicio 2-2/+2
2017-07-07v0.3.0v0.3.0Gravatar Jorge Aparicio 1-1/+0
2017-07-06mcu -> bare-metalGravatar Jorge Aparicio 3-3/+3
2017-07-04move non Cortex-M specific bits into a crateGravatar Jorge Aparicio 3-77/+5
closes #50
2017-07-04remove re-export of cortex-m-semihostingGravatar Jorge Aparicio 2-49/+0
the functionality is not fundamental and can be easily added to a program by directly depending on cortex-m-semihosting
2017-06-30update CHANGELOGGravatar Jorge Aparicio 1-6/+6
2017-06-30StackFrame -> ExceptionFrameGravatar Jorge Aparicio 1-1/+1
2017-06-30drop unused feature gates, rename StackedRegisters to StackFrameGravatar Jorge Aparicio 2-19/+14
2017-06-30turn interrupt::{enable,disable} into compiler barriersGravatar Jorge Aparicio 1-8/+2
2017-06-30add compiler barriers to interrupt::freeGravatar Jorge Aparicio 1-0/+6
2017-06-30move default_handler! and exception! macros to cortex-m-rtGravatar Jorge Aparicio 1-121/+29
2017-06-30revamp the exception registration mechanismGravatar Jorge Aparicio 3-343/+130
[breaking-change]
2017-06-30expose an opaque FPU register block on targets without an FPUGravatar Jorge Aparicio 1-2/+4
this is mainly to avoid adding custom cfg logic to svd2rust generated crates where all the core peripherals are re-exported. (I'd rather not have to teach svd2rust how to generate a build script)
2017-06-30unbreak testGravatar Jorge Aparicio 1-2/+2
2017-06-30make the FPU API available only to targets that have a FPUGravatar Jorge Aparicio 1-3/+13
closes #49
2017-06-30Auto merge of #53 - japaric:gh46, r=japaricGravatar homunkulus 1-0/+4
don't expose registers clidr, ctr, ccsidr, csselr to ARMv6-M targets as these are only available on ARMv7-M devices
2017-06-30unbreak testGravatar Jorge Aparicio 1-4/+4
2017-06-30more renamesGravatar Jorge Aparicio 1-8/+8