save
This commit is contained in:
parent
197933e0ed
commit
af6bbfef1a
@ -3,7 +3,7 @@
|
||||
runner = "probe-rs run --chip RP2040"
|
||||
|
||||
[build]
|
||||
target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
|
||||
target = ["thumbv6m-none-eabi", "thumbv8m.main-none-eabihf"]
|
||||
|
||||
[env]
|
||||
DEFMT_LOG = "info"
|
||||
|
||||
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -542,6 +542,7 @@ dependencies = [
|
||||
"pio",
|
||||
"rand_core 0.6.4",
|
||||
"rand_core 0.9.3",
|
||||
"rp-binary-info",
|
||||
"rp-pac",
|
||||
"rp2040-boot2",
|
||||
"sha2-const-stable",
|
||||
@ -1405,6 +1406,12 @@ dependencies = [
|
||||
"svgbobdoc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rp-binary-info"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ed2051a0bf2c726df01cfce378ed8a367be2a6e402fc183857f429a346d429"
|
||||
|
||||
[[package]]
|
||||
name = "rp-pac"
|
||||
version = "7.0.0"
|
||||
|
||||
12
Cargo.toml
12
Cargo.toml
@ -27,11 +27,14 @@ embassy-executor = { version = "*", features = [
|
||||
embassy-rp = { version = "*", features = [
|
||||
"unstable-pac",
|
||||
"rp2040",
|
||||
# "rp235xa",
|
||||
"time-driver",
|
||||
"critical-section-impl",
|
||||
"defmt"
|
||||
"defmt",
|
||||
"binary-info",
|
||||
"unstable-pac"
|
||||
] }
|
||||
embassy-time = { version = "*", features = ["defmt"] }
|
||||
embassy-time = { version = "*", features = ["defmt", "defmt-timestamp-uptime"] }
|
||||
# embassy-usb-logger = { version = "*" }
|
||||
embassy-net = { version = "*", features = [
|
||||
"proto-ipv4",
|
||||
@ -42,7 +45,7 @@ embassy-net = { version = "*", features = [
|
||||
] }
|
||||
embassy-sync = { version = "*", features = ["defmt"] }
|
||||
cyw43-pio = { version = "*", features = ["defmt"] }
|
||||
cyw43 = { version = "*", features = ["defmt"] }
|
||||
cyw43 = { version = "*", features = ["defmt", "firmware-logs"] }
|
||||
|
||||
defmt = "1.0.1"
|
||||
defmt-rtt = "1.0.0"
|
||||
@ -72,3 +75,6 @@ base64 = { version = "*", default-features = false }
|
||||
|
||||
anyhow = { version = "*", default-features = false }
|
||||
embedded-alloc = "*"
|
||||
|
||||
# [target.thumbv8m.main-none-eabihf.dependencies]
|
||||
# embassy-rp = { features = "rp235xa" }
|
||||
20
build.rs
20
build.rs
@ -13,13 +13,27 @@ use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
enum Target {
|
||||
Pico,
|
||||
Pico2,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let target = match env::var("TARGET").unwrap().as_str() {
|
||||
"thumbv6m-none-eabi" => Target::Pico,
|
||||
"thumbv8m.main-none-eabihf" => Target::Pico2,
|
||||
t => panic!("Unsupported target : {}", t),
|
||||
};
|
||||
|
||||
// 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"))
|
||||
.write_all(match target {
|
||||
Target::Pico => include_bytes!("memory_rp2040.x"),
|
||||
Target::Pico2 => include_bytes!("memory_rp235x.x"),
|
||||
})
|
||||
.unwrap();
|
||||
println!("cargo:rustc-link-search={}", out.display());
|
||||
|
||||
@ -31,6 +45,8 @@ fn main() {
|
||||
|
||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
||||
if let Target::Pico = target {
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
||||
}
|
||||
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||
}
|
||||
|
||||
75
memory_rp235x.x
Normal file
75
memory_rp235x.x
Normal file
@ -0,0 +1,75 @@
|
||||
MEMORY {
|
||||
/*
|
||||
* The RP2350 has either external or internal flash.
|
||||
*
|
||||
* 2 MiB is a safe default here, although a Pico 2 has 4 MiB.
|
||||
*/
|
||||
FLASH : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||
/*
|
||||
* RAM consists of 8 banks, SRAM0-SRAM7, with a striped mapping.
|
||||
* This is usually good for performance, as it distributes load on
|
||||
* those banks evenly.
|
||||
*/
|
||||
RAM : ORIGIN = 0x20000000, LENGTH = 512K
|
||||
/*
|
||||
* RAM banks 8 and 9 use a direct mapping. They can be used to have
|
||||
* memory areas dedicated for some specific job, improving predictability
|
||||
* of access times.
|
||||
* Example: Separate stacks for core0 and core1.
|
||||
*/
|
||||
SRAM8 : ORIGIN = 0x20080000, LENGTH = 4K
|
||||
SRAM9 : ORIGIN = 0x20081000, LENGTH = 4K
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
/* ### Boot ROM info
|
||||
*
|
||||
* Goes after .vector_table, to keep it in the first 4K of flash
|
||||
* where the Boot ROM (and picotool) can find it
|
||||
*/
|
||||
.start_block : ALIGN(4)
|
||||
{
|
||||
__start_block_addr = .;
|
||||
KEEP(*(.start_block));
|
||||
KEEP(*(.boot_info));
|
||||
} > FLASH
|
||||
|
||||
} INSERT AFTER .vector_table;
|
||||
|
||||
/* move .text to start /after/ the boot info */
|
||||
_stext = ADDR(.start_block) + SIZEOF(.start_block);
|
||||
|
||||
SECTIONS {
|
||||
/* ### Picotool 'Binary Info' Entries
|
||||
*
|
||||
* Picotool looks through this block (as we have pointers to it in our
|
||||
* header) to find interesting information.
|
||||
*/
|
||||
.bi_entries : ALIGN(4)
|
||||
{
|
||||
/* We put this in the header */
|
||||
__bi_entries_start = .;
|
||||
/* Here are the entries */
|
||||
KEEP(*(.bi_entries));
|
||||
/* Keep this block a nice round size */
|
||||
. = ALIGN(4);
|
||||
/* We put this in the header */
|
||||
__bi_entries_end = .;
|
||||
} > FLASH
|
||||
} INSERT AFTER .text;
|
||||
|
||||
SECTIONS {
|
||||
/* ### Boot ROM extra info
|
||||
*
|
||||
* Goes after everything in our program, so it can contain a signature.
|
||||
*/
|
||||
.end_block : ALIGN(4)
|
||||
{
|
||||
__end_block_addr = .;
|
||||
KEEP(*(.end_block));
|
||||
} > FLASH
|
||||
|
||||
} INSERT AFTER .uninit;
|
||||
|
||||
PROVIDE(start_to_end = __end_block_addr - __start_block_addr);
|
||||
PROVIDE(end_to_start = __start_block_addr - __end_block_addr);
|
||||
BIN
pico-website-pico2.uf2
Normal file
BIN
pico-website-pico2.uf2
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user