aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-01-06update changelog for panic-itm tooGravatar Tyler Holmes 1-0/+5
2022-01-06remove the ptr() function in favor of the PTR constantGravatar Tyler Holmes 12-144/+57
Per #370/#235, the const fn ptr() was supposed to be deprecated and subsequently removed. This PR removes it for the master branch tracking the 0.8 release
2022-01-06Merge #381Gravatar bors[bot] 2-5/+7
381: TPIU: swo_supports: make struct fields public, improve documentation r=thejpster a=tmplt A few small changes that I missed the first time around when the TPIU API was expanded. Co-authored-by: Viktor Sonesten <v@tmplt.dev>
2022-01-06TPIU: improve SWOSupports documentationGravatar Viktor Sonesten 1-1/+2
2022-01-06CHANGELOG: document TPIU::swo_supportsGravatar Viktor Sonesten 1-0/+1
2022-01-05tpiu: make SWOSupports fields publicGravatar Viktor Sonesten 1-4/+4
2022-01-04Merge #380Gravatar bors[bot] 2-10/+26
380: Improve singleton!() macro r=adamgreig a=Rahix This PR addresses two shortcomings of the `cortex_m::singleton!()` macro, which I raised in #364. For review, I think it is best to look at the two commits implementing these changes individually. I think this changeset should also be backported to `0.7.x` where it applies cleanly and which is also the place where I tested it. ### 1. Fix `singleton!()` sometimes ending up in `.data` The static is always initialized to a "zero" value with `Option::None` which means it should end up in `.bss`. However, if the enclosed type has a niche, `Option::None` can become a non-zero bitpattern which moves the whole singleton from `.bss` to `.data`. This is especially problematic when storing large buffers in the `singleton!()` as this starts eating lots of flash space unnecessarily. To prevent this, I switched to using an explicit boolean flag instead. This is not quite as nice but at least there is no chance for the `singleton!()` to end up in `.data`... For reference and as an example, the faulty behavior can be triggered with ```rust cortex_m::singleton!(: Option<u32> = None) ``` (the inner option has a non-zero niche which the outer option will occupy) ### 2. Allow naming the `static` Due to the static always being named `VAR` right now, all `singleton!()` instances end up having non-descriptive symbol names like `__cortex_m_rt_main::{{closure}}::VAR` which makes them hard to tell apart in a debugger or when looking at an objdump. I added the ability to set an explicit name which end up becoming part of the symbol name. This does not affect Rust code at all - the new name is not visible anywhere. It works like this: ```rust let value = singleton!(FOO_BUFFER: [u8; 1024] = [0u8; 1024]); ``` Of course the old syntax also still works and keeps the old behavior of calling the static `VAR`. Fixes #364. Co-authored-by: Rahix <rahix@rahix.de>
2022-01-04Update CHANGELOGGravatar Rahix 1-0/+4
2022-01-04macros: Don't use Option in singleton!()Gravatar Rahix 1-8/+9
As detailed in rust-embedded/cortex-m#364, niche optimization of the `Option` used in the `singleton!()` macro can lead to the initial value of the static to contain non-zero bits. This in turn leads to the whole static being moved from `.bss` to `.data` which means it eats up flash space for no reason. Especially if the singleton stores a particularly large type, this can be quite problematic. Prevent this by using an explicit boolean flag instead of the `Option` type. This is not quite as nice but at least there is no chance for the `singleton!()` to end up in `.data`...
2022-01-03macros: Allow setting a name for singleton!() staticsGravatar Rahix 1-6/+17
Right now, the `singleton!()` macro always creates a static named `VAR`. This is annoying when digging through objdump output or digging into memory with a debugger because it is hard to see what singleton you're looking at when they are all called `<...>::{{closure}}::VAR`. To make it a bit nicer, allow setting the name of the generated static to some meaningful identifier which can then be cross-referenced in debugger output, for example with singleton!(FOO_BUFFER: [u8; 1024] = [0u8; 1024]); There is no other side-effects to this change - the identifier is never visible to other code because it is still contained in the closure of the macro.
2022-01-03Merge #379Gravatar bors[bot] 2-10/+26
379: Backport 0.7.4's changelog updates and version number to master r=thejpster a=adamgreig Co-authored-by: Adam Greig <adam@adamgreig.com>
2022-01-02Backport 0.7.4's changelog updates and version number to masterGravatar Adam Greig 2-10/+26
2022-01-02Merge #378Gravatar bors[bot] 1-1/+4
378: CHANGELOG: add missing items r=adamgreig a=tmplt Co-authored-by: Viktor Vilhelm Sonesten <v@tmplt.dev>
2022-01-02CHANGELOG: add missing itemsGravatar Viktor Vilhelm Sonesten 1-1/+4
2021-12-31Merge #373Gravatar bors[bot] 2-7/+12
373: `SCB.ICSR.VECTACTIVE` is 9 bits, not 8 r=adamgreig a=TDHolmes Closes #332 Co-authored-by: Tyler Holmes <tyler@holmesengineering.com>
2021-12-31clippy cleanupGravatar Tyler Holmes 1-1/+1
2021-12-31changelog entryGravatar Tyler Holmes 1-0/+4
2021-12-31`SCB.ICSR.VECTACTIVE` is 9 bits, not 8Gravatar Tyler Holmes 1-7/+8
Closes #332
2021-12-31Merge #366Gravatar bors[bot] 5-5/+44
366: itm: derive serde for `LocalTimestampOptions`, impl gated `TryFrom<u8>` r=adamgreig a=tmplt This PR is an upstream push of more std-features required by `cargo-rtic-scope`. If required, the `TryFrom<u8>` impl can be kept downstream. Co-authored-by: Viktor Sonesten <v@tmplt.dev>
2021-12-31Merge #350Gravatar bors[bot] 2-11/+2
350: Update bare-metal dependency r=adamgreig a=hellow554 Bare-metal has released its 1.0 version. Let's use it! Co-authored-by: Marcel Hellwig <github@cookiesoft.de> Co-authored-by: Marcel Hellwig <git@cookiesoft.de> Co-authored-by: Adam Greig <adam@adamgreig.com>
2021-12-31Merge branch 'master' into patch-1Gravatar Adam Greig 39-114/+854
2021-12-29Merge #374Gravatar bors[bot] 2-8/+16
374: Construct a SysTick delay with a clock source r=adamgreig a=mciantyre Helpful for users who prefer an external clock source for their system timer. Proposing this as a 0.7 backwards-compatible change. Co-authored-by: Ian McIntyre <ianpmcintyre@gmail.com>
2021-12-29Merge #367Gravatar bors[bot] 2-23/+111
367: add methods needed for cycle count comparisons r=adamgreig a=TDHolmes Extends the existing DWT comparator code to include cycle count comparisons which fire a `DebugMonitor` exception, if enabled with `enable_debug_monitor`. See working example [here](https://github.com/TDHolmes/embedded-profiling/blob/58d8b106921977816e2b5a05bcb43e976197edaf/ep-dwt/src/lib.rs#L57) Co-authored-by: Tyler Holmes <tyler@holmesengineering.com>
2021-12-29Merge #369Gravatar bors[bot] 4-12/+17
369: Switch "native" check from being x86_64 only to checking `HOST` r=adamgreig a=TDHolmes If `HOST==TARGET`, we know we're compiling natively. Set a new `rustc` cfg for this and use it where we previously checked for `x86_64`. I was trying to run tests on my M1 MacBook Pro and couldn't since it isn't `x86_64`. Also, the currently configured nightly compiler for asm doesn't have M1 support, so I updated that. I'm fine reverting that change though, I can just do that locally, but I'm sure others will hit the same issue and it's a bit old... Co-authored-by: Tyler Holmes <tyler@holmesengineering.com>
2021-12-29Construct a SysTick delay with a clock sourceGravatar Ian McIntyre 2-8/+16
Helpful for users who prefer an external clock source for their system timer. Proposing this as a 0.7 backwards-compatible change. The constructor name tries to follow the "general constructors" recommendation in the Rust API naming guidelines. https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case
2021-12-19re-enable has_fpuGravatar Tyler Holmes 1-3/+5
2021-12-19Switch "native" check from being x86_64 only to checking `HOST`Gravatar Tyler Holmes 4-14/+17
If `HOST==TARGET`, we know we're compiling natively. Set a new `rustc` cfg for this and use it where we previously checked for `x86_64`.
2021-12-19make intra-doc linkGravatar Tyler Holmes 1-1/+1
2021-12-19remove unused errorGravatar Tyler Holmes 1-2/+0
2021-12-19change has_cycle_counter to a recommended end user callGravatar Tyler Holmes 1-7/+4
2021-12-19fix fields, SBZ as needed for address compareGravatar Tyler Holmes 1-3/+7
2021-12-19enable has_cycle_counter for all arches. armv6m always returns falseGravatar Tyler Holmes 1-2/+5
2021-12-19SBZ fields as needed, check if block supports cycle count compareGravatar Tyler Holmes 1-4/+21
2021-12-19tidy up doc commentsGravatar Tyler Holmes 1-5/+4
2021-12-19further comments - factor out function selection and more documentationGravatar Tyler Holmes 1-8/+30
2021-12-19review suggestionsGravatar Tyler Holmes 1-41/+36
2021-12-19more correct commentGravatar Tyler Holmes 1-1/+1
2021-12-19inlineGravatar Tyler Holmes 1-0/+2
2021-12-19add methods needed for cycle count comparisonsGravatar Tyler Holmes 2-15/+66
2021-12-19Merge #372Gravatar bors[bot] 18-44/+86
372: asm/inline: explicitly use asm macro r=adamgreig a=jordens `asm!()` removed from prelude in current nightly https://github.com/rust-lang/rust/pull/91728 close #371 This is also a good candidate for the cortex-m v0.7 series. Co-authored-by: Robert Jördens <rj@quartiq.de> Co-authored-by: Adam Greig <adam@adamgreig.com>
2021-12-17Add nomem, nostack and preserves_flags options to appropriate asm calls.Gravatar Adam Greig 15-43/+71
2021-12-17bkpt: nostackGravatar Robert Jördens 1-1/+1
2021-12-17asm: allow stable asmGravatar Robert Jördens 1-0/+2
2021-12-17bump asm-toolchainGravatar Robert Jördens 1-1/+1
2021-12-16asm: silence warning about asm being stableGravatar Robert Jördens 1-0/+2
2021-12-16asm/inline: also use asm macro in modsGravatar Robert Jördens 1-0/+9
2021-12-16fmt [nfc]Gravatar Robert Jördens 1-1/+1
2021-12-16asm/inline: explicitly use asm macroGravatar Robert Jördens 1-0/+1
removed from prelude in current nightly https://github.com/rust-lang/rust/pull/91728 close #371 Signed-off-by: Robert Jördens <rj@quartiq.de>
2021-12-07feature gates: std-map -> stdGravatar Viktor Sonesten 4-5/+5
The alternative is to create another std-* gate for each std-related functionality. I do not think this will scale well, and makes the crate difficult to use. If the end-user wants to use host-side functionality they will only need to specify "std".
2021-12-07itm: derive serde for LocalTimestampOptions, impl gated TryFrom<u8>Gravatar Viktor Sonesten 2-1/+40