From a64c2ffff31cce1b13a7f39099f0641df71e99a8 Mon Sep 17 00:00:00 2001 From: Egor Mihnevich Date: Mon, 12 Aug 2024 20:49:06 +0200 Subject: [PATCH 1/3] cortex-m: fix typos Fix a small typo in the external symbols comment. --- cortex-m-rt/link.x.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in index 4a9e5fc3..265e2505 100644 --- a/cortex-m-rt/link.x.in +++ b/cortex-m-rt/link.x.in @@ -7,7 +7,7 @@ static mut __sbss }`). - `EXTERN` forces the linker to keep a symbol in the final binary. We use this to make sure a - symbol if not dropped if it appears in or near the front of the linker arguments and "it's not + 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 From f4d1570ab6eff87d25d449716b2be31f1939f819 Mon Sep 17 00:00:00 2001 From: Egor Mikhnevich Date: Mon, 12 Aug 2024 21:11:50 +0200 Subject: [PATCH 2/3] make clippy happy --- cortex-m-rt/src/lib.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index 4329119c..7bb0bdb5 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -8,7 +8,7 @@ //! This crates takes care of: //! //! - The memory layout of the program. In particular, it populates the vector table so the device -//! can boot correctly, and properly dispatch exceptions and interrupts. +//! can boot correctly, and properly dispatch exceptions and interrupts. //! //! - Initializing `static` variables before the program entry point. //! @@ -221,42 +221,42 @@ //! One will always find the following (unmangled) symbols in `cortex-m-rt` applications: //! //! - `Reset`. This is the reset handler. The microcontroller will execute this function upon -//! booting. This function will call the user program entry point (cf. [`#[entry]`][attr-entry]) -//! using the `main` symbol so you will also find that symbol in your program. +//! booting. This function will call the user program entry point (cf. [`#[entry]`][attr-entry]) +//! using the `main` symbol so you will also find that symbol in your program. //! //! - `DefaultHandler`. This is the default handler. If not overridden using `#[exception] fn //! DefaultHandler(..` this will be an infinite loop. //! //! - `HardFault` and `_HardFault`. These function handle the hard fault handling and what they -//! do depends on whether the hard fault is overridden and whether the trampoline is enabled (which it is by default). +//! do depends on whether the hard fault is overridden and whether the trampoline is enabled (which it is by default). //! - No override: Both are the same function. The function is an infinite loop defined in the cortex-m-rt crate. //! - Trampoline enabled: `HardFault` is the real hard fault handler defined in assembly. This function is simply a -//! trampoline that jumps into the rust defined `_HardFault` function. This second function jumps to the user-defined -//! handler with the exception frame as parameter. This second jump is usually optimised away with inlining. +//! trampoline that jumps into the rust defined `_HardFault` function. This second function jumps to the user-defined +//! handler with the exception frame as parameter. This second jump is usually optimised away with inlining. //! - Trampoline disabled: `HardFault` is the user defined function. This means the user function is called directly -//! from the vector table. `_HardFault` still exists, but is an empty function that is purely there for compiler -//! diagnostics. +//! from the vector table. `_HardFault` still exists, but is an empty function that is purely there for compiler +//! diagnostics. //! //! - `__STACK_START`. This is the first entry in the `.vector_table` section. This symbol contains -//! the initial value of the stack pointer; this is where the stack will be located -- the stack -//! grows downwards towards smaller addresses. +//! the initial value of the stack pointer; this is where the stack will be located -- the stack +//! grows downwards towards smaller addresses. //! //! - `__RESET_VECTOR`. This is the reset vector, a pointer to the `Reset` function. This vector -//! is located in the `.vector_table` section after `__STACK_START`. +//! is located in the `.vector_table` section after `__STACK_START`. //! //! - `__EXCEPTIONS`. This is the core exceptions portion of the vector table; it's an array of 14 -//! exception vectors, which includes exceptions like `HardFault` and `SysTick`. This array is -//! located after `__RESET_VECTOR` in the `.vector_table` section. +//! exception vectors, which includes exceptions like `HardFault` and `SysTick`. This array is +//! located after `__RESET_VECTOR` in the `.vector_table` section. //! //! - `__INTERRUPTS`. This is the device specific interrupt portion of the vector table; its exact -//! size depends on the target device but if the `"device"` feature has not been enabled it will -//! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after -//! `__EXCEPTIONS` in the `.vector_table` section. +//! size depends on the target device but if the `"device"` feature has not been enabled it will +//! have a size of 32 vectors (on ARMv6-M) or 240 vectors (on ARMv7-M). This array is located after +//! `__EXCEPTIONS` in the `.vector_table` section. //! //! - `__pre_init`. This is a function to be run before RAM is initialized. It defaults to an empty -//! function. As this runs before RAM is initialised, it is not sound to use a Rust function for -//! `pre_init`, and instead it should typically be written in assembly using `global_asm` or an -//! external assembly file. +//! function. As this runs before RAM is initialised, it is not sound to use a Rust function for +//! `pre_init`, and instead it should typically be written in assembly using `global_asm` or an +//! external assembly file. //! //! If you override any exception handler you'll find it as an unmangled symbol, e.g. `SysTick` or //! `SVCall`, in the output of `objdump`, From 27cd6520012aa69fd53dc8641b24d2d56a430a25 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Tue, 13 Aug 2024 02:04:57 +0100 Subject: [PATCH 3/3] add expected cfgs to testsuite --- testsuite/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testsuite/build.rs b/testsuite/build.rs index c0662b9d..ea0d13d3 100644 --- a/testsuite/build.rs +++ b/testsuite/build.rs @@ -1,6 +1,13 @@ fn main() { let target = std::env::var("TARGET").unwrap(); + println!("cargo:rustc-check-cfg=cfg(armv6m)"); + println!("cargo:rustc-check-cfg=cfg(armv7m)"); + println!("cargo:rustc-check-cfg=cfg(armv7em)"); + println!("cargo:rustc-check-cfg=cfg(armv8m)"); + println!("cargo:rustc-check-cfg=cfg(armv8m_base)"); + println!("cargo:rustc-check-cfg=cfg(armv8m_main)"); + if target.starts_with("thumbv6m-") { println!("cargo:rustc-cfg=armv6m"); } else if target.starts_with("thumbv7m-") {