Initial Commit
This commit is contained in:
commit
954dccd29c
7 changed files with 1549 additions and 0 deletions
14
.cargo/config.toml
Normal file
14
.cargo/config.toml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# Cargo Configuration for the https://github.com/rp-rs/rp-hal.git repository.
|
||||||
|
#
|
||||||
|
# You might want to make a similar file in your own repository if you are
|
||||||
|
# writing programs for Raspberry Silicon microcontrollers.
|
||||||
|
#
|
||||||
|
|
||||||
|
[build]
|
||||||
|
# Set the default target to match the Cortex-M33 in the RP2350
|
||||||
|
target = "thumbv8m.main-none-eabihf"
|
||||||
|
|
||||||
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
|
# runner = "elf2uf2-rs --deploy --serial --verbose"
|
||||||
|
runner = "picotool load -u -v -x -t elf"
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
1391
Cargo.lock
generated
Normal file
1391
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
15
Cargo.toml
Normal file
15
Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[package]
|
||||||
|
name = "poketch_2350"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cortex-m = "0.7.7"
|
||||||
|
cortex-m-rt = "0.7.5"
|
||||||
|
defmt = "1.0.1"
|
||||||
|
defmt-rtt = "1.0.0"
|
||||||
|
embassy-executor = {version = "0.7.0", features = ["arch-cortex-m", "executor-thread", "defmt", ]}
|
||||||
|
embassy-rp = { version = "0.4.0", features = ["rp235xa", "defmt", "time-driver", "critical-section-impl", "binary-info"] }
|
||||||
|
embassy-time = "0.4.0"
|
||||||
|
panic-probe = "1.0.0"
|
||||||
|
rand = {version = "0.8.5", default-features = false }
|
35
build.rs
Normal file
35
build.rs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//! 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() {
|
||||||
|
// 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=-Tlink.x");
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
|
}
|
75
memory.x
Normal file
75
memory.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.
|
||||||
|
*/
|
||||||
|
SRAM4 : ORIGIN = 0x20080000, LENGTH = 4K
|
||||||
|
SRAM5 : 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);
|
18
src/main.rs
Normal file
18
src/main.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//! This example shows TRNG usage
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
use defmt::*;
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_rp::bind_interrupts;
|
||||||
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
|
|
||||||
|
loop {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue