remove memory.x files for other stm32 examples
This commit is contained in:
		@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
# Change stm32f767zi to your chip name, if necessary.
 | 
					# Change stm32f767zi to your chip name, if necessary.
 | 
				
			||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f767zi", "unstable-pac", "time-driver-any", "exti"]  }
 | 
					embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32f767zi", "memory-x", "unstable-pac", "time-driver-any", "exti"]  }
 | 
				
			||||||
embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
					embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
				
			||||||
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
					embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
				
			||||||
embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
 | 
					embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,43 +1,5 @@
 | 
				
			|||||||
//! adapted from https://github.com/stm32-rs/stm32f7xx-hal/blob/master/build.rs
 | 
					fn main() {
 | 
				
			||||||
use std::fs::File;
 | 
					 | 
				
			||||||
use std::io::prelude::*;
 | 
					 | 
				
			||||||
use std::path::PathBuf;
 | 
					 | 
				
			||||||
use std::{env, io};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[derive(Debug)]
 | 
					 | 
				
			||||||
enum Error {
 | 
					 | 
				
			||||||
    Env(env::VarError),
 | 
					 | 
				
			||||||
    Io(io::Error),
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl From<env::VarError> for Error {
 | 
					 | 
				
			||||||
    fn from(error: env::VarError) -> Self {
 | 
					 | 
				
			||||||
        Self::Env(error)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl From<io::Error> for Error {
 | 
					 | 
				
			||||||
    fn from(error: io::Error) -> Self {
 | 
					 | 
				
			||||||
        Self::Io(error)
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn main() -> Result<(), Error> {
 | 
					 | 
				
			||||||
    println!("cargo:rerun-if-changed=build.rs");
 | 
					 | 
				
			||||||
    println!("cargo:rerun-if-changed=memory.x");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let out_dir = env::var("OUT_DIR")?;
 | 
					 | 
				
			||||||
    let out_dir = PathBuf::from(out_dir);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let memory_x = include_bytes!("memory.x").as_ref();
 | 
					 | 
				
			||||||
    File::create(out_dir.join("memory.x"))?.write_all(memory_x)?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Tell Cargo where to find the file.
 | 
					 | 
				
			||||||
    println!("cargo:rustc-link-search={}", out_dir.display());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=--nmagic");
 | 
					    println!("cargo:rustc-link-arg-bins=--nmagic");
 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=-Tlink.x");
 | 
					    println!("cargo:rustc-link-arg-bins=-Tlink.x");
 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
 | 
					    println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    Ok(())
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +0,0 @@
 | 
				
			|||||||
/* For STM32F765,767,768,769,777,778,779 devices */
 | 
					 | 
				
			||||||
MEMORY
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  /* NOTE K = KiBi = 1024 bytes */
 | 
					 | 
				
			||||||
  FLASH : ORIGIN = 0x08000000, LENGTH = 2M
 | 
					 | 
				
			||||||
  RAM : ORIGIN = 0x20000000, LENGTH = 368K + 16K
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* This is where the call stack will be allocated. */
 | 
					 | 
				
			||||||
/* The stack is of the full descending type. */
 | 
					 | 
				
			||||||
/* NOTE Do NOT modify `_stack_start` unless you know what you are doing */
 | 
					 | 
				
			||||||
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
 | 
					 | 
				
			||||||
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
# Change stm32h563zi to your chip name, if necessary.
 | 
					# Change stm32h563zi to your chip name, if necessary.
 | 
				
			||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h563zi", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
 | 
					embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32h563zi", "memory-x", "time-driver-any", "exti", "unstable-pac", "unstable-traits"] }
 | 
				
			||||||
embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
					embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
				
			||||||
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
					embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
				
			||||||
embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
 | 
					embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "unstable-traits", "tick-hz-32_768"] }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
MEMORY
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    FLASH : ORIGIN = 0x08000000, LENGTH = 0x200000
 | 
					 | 
				
			||||||
    RAM   : ORIGIN = 0x20000000, LENGTH =  0x50000
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
[target.thumbv7em-none-eabihf]
 | 
					[target.thumbv7em-none-eabihf]
 | 
				
			||||||
runner = 'probe-rs run --chip STM32H743ZITx'
 | 
					runner = 'probe-rs run --chip STM32H7A3ZITxQ'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[build]
 | 
					[build]
 | 
				
			||||||
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
 | 
					target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
# Change stm32l4s5vi to your chip name, if necessary.
 | 
					# Change stm32l4s5vi to your chip name, if necessary.
 | 
				
			||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l4s5vi", "time-driver-any", "exti", "unstable-traits", "chrono"]  }
 | 
					embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "stm32l4s5vi", "memory-x", "time-driver-any", "exti", "unstable-traits", "chrono"]  }
 | 
				
			||||||
embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
					embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
 | 
				
			||||||
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
					embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
 | 
				
			||||||
embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
 | 
					embassy-time = { version = "0.1.2", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,34 +1,4 @@
 | 
				
			|||||||
//! This build script copies the `memory.x` file from the crate root into
 | 
					 | 
				
			||||||
//! a directory where the linker can always find it at build time.
 | 
					 | 
				
			||||||
//! For many projects this is optional, as the linker always searches the
 | 
					 | 
				
			||||||
//! project root directory -- wherever `Cargo.toml` is. However, if you
 | 
					 | 
				
			||||||
//! are using a workspace or have a more complicated build setup, this
 | 
					 | 
				
			||||||
//! build script becomes required. Additionally, by requesting that
 | 
					 | 
				
			||||||
//! Cargo re-run the build script whenever `memory.x` is changed,
 | 
					 | 
				
			||||||
//! updating `memory.x` ensures a rebuild of the application with the
 | 
					 | 
				
			||||||
//! new memory settings.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use std::env;
 | 
					 | 
				
			||||||
use std::fs::File;
 | 
					 | 
				
			||||||
use std::io::Write;
 | 
					 | 
				
			||||||
use std::path::PathBuf;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
    // Put `memory.x` in our output directory and ensure it's
 | 
					 | 
				
			||||||
    // on the linker search path.
 | 
					 | 
				
			||||||
    let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
 | 
					 | 
				
			||||||
    File::create(out.join("memory.x"))
 | 
					 | 
				
			||||||
        .unwrap()
 | 
					 | 
				
			||||||
        .write_all(include_bytes!("memory.x"))
 | 
					 | 
				
			||||||
        .unwrap();
 | 
					 | 
				
			||||||
    println!("cargo:rustc-link-search={}", out.display());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // By default, Cargo will re-run a build script whenever
 | 
					 | 
				
			||||||
    // any file in the project changes. By specifying `memory.x`
 | 
					 | 
				
			||||||
    // here, we ensure the build script is only re-run when
 | 
					 | 
				
			||||||
    // `memory.x` is changed.
 | 
					 | 
				
			||||||
    println!("cargo:rerun-if-changed=memory.x");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=--nmagic");
 | 
					    println!("cargo:rustc-link-arg-bins=--nmagic");
 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=-Tlink.x");
 | 
					    println!("cargo:rustc-link-arg-bins=-Tlink.x");
 | 
				
			||||||
    println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
 | 
					    println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
MEMORY
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  /* NOTE 1 K = 1 KiBi = 1024 bytes */
 | 
					 | 
				
			||||||
  /* These values correspond to the STM32L4S5 */
 | 
					 | 
				
			||||||
  FLASH : ORIGIN = 0x08000000, LENGTH = 1024K
 | 
					 | 
				
			||||||
  RAM : ORIGIN = 0x20000000, LENGTH = 128K
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user