diff --git a/Cargo.toml b/Cargo.toml index 5989df1..fcf4d83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ name = "rp-test" version = "0.1.0" [dependencies] -cortex-m = "0.6.0" +cortex-m = { version = "0.7.0", features = ["inline-asm"] } cortex-m-rt = "0.6.10" cortex-m-semihosting = "0.3.3" @@ -14,7 +14,14 @@ defmt = "0.1.3" defmt-rtt = "0.1.0" panic-probe = "0.1.0" -rp2040-pac = { path = "../rp2040-pac" } +rp2040-pac = { git = "https://github.com/rp-rs/rp2040-pac", branch="main" } +rp2040-boot2 = { git = "https://github.com/rp-rs/rp2040-boot2-rs" } +#rp2040-pac = { path = "../rp2040-pac" } +#rp2040-boot2 = { path = "../rp2040-boot2-rs" } + +[patch.crates-io] +cortex-m = { git = "https://github.com/rust-embedded/cortex-m" } + [features] default = [ "defmt-default", diff --git a/memory.x b/memory.x index 1857065..cab41fb 100644 --- a/memory.x +++ b/memory.x @@ -1,6 +1,13 @@ -MEMORY -{ - /* We set "flash" to half the RAM */ - FLASH : ORIGIN = 0x20000000, LENGTH = 128K - RAM : ORIGIN = 0x20020000, LENGTH = 128K +MEMORY { + BOOT_LOADER : ORIGIN = 0x10000000, LENGTH = 0x100 + FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100 + RAM : ORIGIN = 0x20000000, LENGTH = 256K } + +SECTIONS { + /* ### Boot loader */ + .boot_loader ORIGIN(BOOT_LOADER) : + { + KEEP(*(.boot_loader)); + } > BOOT_LOADER +} INSERT BEFORE .text; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index ff8853a..5e715dd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,10 @@ use cortex_m_rt::entry; use defmt::*; use defmt_rtt as _; // global logger use panic_probe as _; + +// this adds boot2 to the .boot_loader section +// linker script then places that at start of flash. +use rp2040_boot2 as _; use rp2040_pac as pac; #[defmt::timestamp]