diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-03-29 22:28:36 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-03-29 22:28:36 +0200 |
| commit | d938b95430d543d8a97e611642ef09d803b7bdc1 (patch) | |
| tree | 3805f3153072cf7329b3b2c45b296c84e8847c2d /embassy-rp | |
| parent | 4371302da87f7fad4649c0ef4eade9432dc94529 (diff) | |
rp: add precompiled boot2 to avoid depending on gcc
Diffstat (limited to 'embassy-rp')
| -rw-r--r-- | embassy-rp/build.rs | 17 | ||||
| -rw-r--r-- | embassy-rp/link-rp.x.in | 8 | ||||
| -rw-r--r-- | embassy-rp/src/boot2.bin | bin | 0 -> 256 bytes | |||
| -rw-r--r-- | embassy-rp/src/system.rs | 4 |
4 files changed, 29 insertions, 0 deletions
diff --git a/embassy-rp/build.rs b/embassy-rp/build.rs new file mode 100644 index 000000000..bc59ea23b --- /dev/null +++ b/embassy-rp/build.rs | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | use std::fs::{self, File}; | ||
| 2 | use std::io::Write; | ||
| 3 | use std::path::{Path, PathBuf}; | ||
| 4 | use std::{env, ffi::OsStr}; | ||
| 5 | |||
| 6 | fn main() { | ||
| 7 | // Put the linker script somewhere the linker can find it | ||
| 8 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); | ||
| 9 | let link_x = include_bytes!("link-rp.x.in"); | ||
| 10 | let mut f = File::create(out.join("link-rp.x")).unwrap(); | ||
| 11 | f.write_all(link_x).unwrap(); | ||
| 12 | |||
| 13 | println!("cargo:rustc-link-search={}", out.display()); | ||
| 14 | |||
| 15 | println!("cargo:rerun-if-changed=build.rs"); | ||
| 16 | println!("cargo:rerun-if-changed=link-rp.x.in"); | ||
| 17 | } | ||
diff --git a/embassy-rp/link-rp.x.in b/embassy-rp/link-rp.x.in new file mode 100644 index 000000000..af463f963 --- /dev/null +++ b/embassy-rp/link-rp.x.in | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | |||
| 2 | SECTIONS { | ||
| 3 | /* ### Boot loader */ | ||
| 4 | .boot2 ORIGIN(BOOT2) : | ||
| 5 | { | ||
| 6 | KEEP(*(.boot2)); | ||
| 7 | } > BOOT2 | ||
| 8 | } \ No newline at end of file | ||
diff --git a/embassy-rp/src/boot2.bin b/embassy-rp/src/boot2.bin new file mode 100644 index 000000000..fdc1fc756 --- /dev/null +++ b/embassy-rp/src/boot2.bin | |||
| Binary files differ | |||
diff --git a/embassy-rp/src/system.rs b/embassy-rp/src/system.rs index 200f88d63..ba1396433 100644 --- a/embassy-rp/src/system.rs +++ b/embassy-rp/src/system.rs | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | use crate::{pac, pll, resets}; | 1 | use crate::{pac, pll, resets}; |
| 2 | 2 | ||
| 3 | #[link_section = ".boot2"] | ||
| 4 | #[used] | ||
| 5 | pub static BOOT2: [u8; 256] = *include_bytes!("boot2.bin"); | ||
| 6 | |||
| 3 | #[non_exhaustive] | 7 | #[non_exhaustive] |
| 4 | pub struct Config {} | 8 | pub struct Config {} |
| 5 | 9 | ||
