aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-02-24Remove references to unsupported Rust versions in cortex-m-rtGravatar Adam Greig 1-40/+9
2022-02-24Add set-sp and set-vtor features to cortex-m-rt.Gravatar Adam Greig 1-0/+30
2022-02-24Remove prebuilt cortex-m-rt binaries, replace with global_asmGravatar Adam Greig 1-1/+122
2022-01-23Bump MSRV from 1.40 to 1.42, fix clippy::match_like_matches_macroGravatar Alex Martens 1-1/+1
2022-01-12Bump cortex-m-rt MSRV 1.39->1.40 to support non_exhaustive in cortex-mGravatar Adam Greig 1-1/+1
2021-04-02Minor documentation fix.Gravatar Jakub Duchniewicz 1-0/+1
2021-01-27Only emit link_section for cortex-m.Gravatar Adam Greig 1-8/+4
Previously we always emitted link_section, even though it only had an effect when our linker script was being used (and only made sense on cortex-m targets). This breaks building the code for a MacOS target, which is occasionally useful for running `cargo check` etc. In the macros crate we don't have the target information available, so instead we continue to emit link_section except specifically on MacOS.
2021-01-25fix #74Gravatar Anatol Ulrich 1-4/+8
2021-01-21Update Reset-in-asm.Gravatar Adam Greig 1-49/+14
* Use arm-none-eabi-gcc to assemble, allowing use of preprocessor to conditionally enable the FPU for eabihf targets. * Remove has_fpu configuration from build.rs. * Remove FpuTrampoline as no longer required. * Remove the Rust Reset method entirely, since the asm Reset can now enable FPU and jump to user main.
2020-11-25Initialize RAM in assemblyGravatar Jonas Schievink 1-31/+0
2020-09-02[ARMv6-M] initialize the LR registerGravatar Jorge Aparicio 1-0/+11
the ARMv6-M Architecture Reference Manual (ARM DDI 0419D) indicates in section B1.5.5 "Reset behavior" that the LR (Link Register) starts in an unknown state when the Reset handler is taken and that its "Value must be initialised by software" So this PR does that: it initializes the LR register to 0xFFFF_FFFF (-1) first thing in the Reset handler (only for v6). The manual doesn't say which value to use so I decided to use the value used by the ARMv7-M (v7 sets LR to 0xFFFF_FFFF before invoking the Reset handler; see its Architecture Manual for details). The values of LR (these are pushed onto the stack in function preludes) are used to unwind the stack (e.g. GDB's `backtrace` or a future `cortex_m_panic_unwind` handler). Having the initial stack frame use a known value on all Cortex-M variants makes it easier to implement `panic_unwind` and avoids virtual unwinders like GDB `backtrace` trying to unwind beyond the `Reset` handler Note that this implementation uses a trampoline that runs before `Reset` to set LR on v6. This is required because the prelude of the `Reset` routine will push LR onto the stack; we want that LR value to be -1. Calling `register::lr::write` from `Reset` would perform the write after LR has been pushed onto the stack and that's too late
2020-08-30Avoid depending on `cortex-m`Gravatar Jonas Schievink 1-26/+10
2020-08-29Merge #280Gravatar bors[bot] 1-1/+1
280: Make Vector public in interrupt example r=adamgreig a=Tiwalun If the `Vector`union is not public, the example code leads to a compilation error because `pub static __INTERRUPTS` leaks the private type `Vector`. Co-authored-by: Dominik Boehi <dominik.boehi@gmail.com>
2020-08-23Remove broken doctest/exampleGravatar Jonas Schievink 1-17/+1
This is unsound unless you control the panic handler implementation.
2020-08-23Document NMI handler unsafetyGravatar Jonas Schievink 1-6/+24
2020-08-23Revert "Changed Hardfault's and DefaultHander's default implementations to ↵Gravatar Jonas Schievink 1-9/+13
panic" This reverts commit ffffb7b3aaef1d9bb4e4b81347ed8f1d50e50ea4.
2020-07-30more specific ref to link_section attributesGravatar Todd Stellanova 1-1/+3
2020-07-30remove unintended editGravatar Todd Stellanova 1-1/+0
2020-07-30Doc adding memory sections in memory.xGravatar Todd Stellanova 1-0/+34
2020-07-22Make Vector public in interrupt exampleGravatar Dominik Boehi 1-1/+1
If the `Vector`union is not public, the example code leads to a compilation error because `pub static __INTERRUPTS` leaks the private type `Vector`.
2020-07-12Add barriers after FPU enablingGravatar Thales Fragoso 1-1/+4
2020-07-09Merge #276Gravatar bors[bot] 1-0/+4
276: Replace __ONCE__ with Cargo links key r=jonas-schievink a=adamgreig This would fix #275. We use the links key in cortex-m already [here](https://github.com/rust-embedded/cortex-m/blob/master/Cargo.toml#L16). See also https://github.com/rust-embedded/wg/issues/467. Co-authored-by: Adam Greig <adam@adamgreig.com>
2020-07-09Keep __ONCE__ for backcompatGravatar Adam Greig 1-0/+8
2020-07-05Mark main() with a C ABIGravatar Ian McIntyre 1-3/+2
The documentation says that main() should have a C ABI. Additionally, the #[entry] macro will create a main() function that has a C ABI. Marking main() as 'extern "Rust"' is inconsistent with its calling convention.
2020-07-03Replace __ONCE__ with Cargo links keyGravatar Adam Greig 1-4/+0
2020-05-19Get rid of #[deny(warnings)]Gravatar Daniel Egger 1-1/+0
This is considered harmful as the warnings may change with any compiler release. Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2020-04-20Merge #257Gravatar bors[bot] 1-13/+9
257: Changed Hardfault's and DefaultHander's default implementations to panic r=adamgreig a=korken89 From the discussions in #253 I started a PR with the proposed change. Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
2020-04-05Update MSRV to 1.39.0, fix doc test that fails <1.41.0.Gravatar Adam Greig 1-1/+2
2020-04-04Add statement of MSRV to docsGravatar Adam Greig 1-0/+4
2020-03-31New compile-fail string for interrupt-invalidGravatar Emil Fresk 1-2/+2
2020-03-30Changed Hardfault's and DefaultHander's default implementations to panicGravatar Emil Fresk 1-13/+9
2020-02-17Merge #249Gravatar bors[bot] 1-1/+1
249: Ignore a doctest again r=adamgreig a=jonas-schievink I accidentally typoed `no_run`, but compiling the test fails since the `device.x` path is wrong. I don't think this can be fixed, so ignore the test instead. The effect is the same as before but now the block gets highlighted again. Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-02-17Ignore a doctest againGravatar Jonas Schievink 1-1/+1
I accidentally typoed `no_run`, but compiling the test fails since the `device.x` path is wrong. I don't think this can be fixed, so ignore the test instead.
2020-02-17Expand #[pre_init] safety docs, discourage its useGravatar Jonas Schievink 1-1/+12
2020-02-06Fix doctests and run them in CIGravatar Jonas Schievink 1-21/+286
2020-01-14Make `ExceptionFrame` methods `#[inline(always)]`Gravatar Jonas Schievink 1-0/+16
2020-01-12Add safety docsGravatar Jonas Schievink 1-0/+40
2020-01-11Fix typoGravatar Jonas Schievink 1-1/+1
2020-01-11Add unsafe settersGravatar Jonas Schievink 1-0/+40
Otherwise this would be a regression in functionality
2020-01-11Make `ExceptionFrame`s fields privateGravatar Jonas Schievink 1-17/+44
2019-12-10Remove 'extern crate cortex_m_rt' from macrosGravatar Ian McIntyre 1-0/+2
See justification on 519d46a. Using 'extern crate cortex_m_rt' inside of the macros limits our ability to use the macros crate in other contexts. As long as another crate publicly exports an enumeration of `interrupt` and an enumeration of `exception`, the macros crate may be used in other cortex-m-rt-like systems.
2019-11-26Inline attr. macro docs and fix linksGravatar Jonas Schievink 1-16/+23
2019-06-19add a .uninit sectionGravatar Jorge Aparicio 1-6/+24
that contains static variables that will not be initialized by the runtime this implements only the linker section described in RFC #116 so that downstream libraries / framework can leverage it without (a) forking this crate or (b) requiring the end user to pass additional linker scripts to the linker when building their crate. This commit doesn't add the user interface described in RFC #116; instead it documents how to use this linker section in the advanced section of the crate level documentation
2019-03-01Update lib.rs comment describing __INTERRUPTS variable to say __INTERRUPTS ↵Gravatar Raz Aloni 1-1/+1
instead of __EXCEPTIONS
2019-01-24doc: Remove obsolete references to entry!Gravatar chrysn 1-20/+7
2018-11-14rename UserHardFault to HardFaultGravatar Jorge Aparicio 1-9/+9
so it matches the exception name (`#[exception] fn HardFault(..`)
2018-11-11remove duplicated lineGravatar Jorge Aparicio 1-1/+0
2018-11-11change attribute doc linksGravatar Jorge Aparicio 1-7/+6
to point to the "Reexports" section. The older links don't work correctly on docs.rs. The "Reexports" section always has valid links to the documentation of each attribute.
2018-11-01Mention interrupt attribute in main crate docsGravatar Georg Brandl 1-0/+4
Fixes #137
2018-10-26`b UserHardFault`Gravatar Jorge Aparicio 1-0/+1
this commit replaces the `bl UserHardFault` instruction in HardFault with `b UserHardFault`. This lets us drop the prologue (`push {r0,lr}`) while preserving the ability to unwind the stack using GDB. To prevent linker errors about relocations when UserHardFault and HardFault end up far away from each other and the target is ARMv6-M (where the `b` instruction only supports offsets of +/- 2KB) we use two *input* sections: .HardFault and .UserHardFault. HardFault is placed in the .HardFault section and UserHardFault is placed in the .UserHardFault section. The .HardFault input section is placed in the output .text section after all the input .text sections, and the .UserHardFault input section is placed after the .HardFault section. This causes the two symbols to always appear next to each other in the output binary, furthermore UserHardFault *always* appears after HardFault so the branch offset of `b UserHardFault` is always a few bytes. It should be noted that neither .HardFault or .UserHardFault will appear in the output of the `size -A` command as they are input sections that get merged into the output .text section. IOW, the sizes of HardFault and UserHardFault will continue to be reported under the .text section.