Compare commits
No commits in common. "22dbd2fc00e0d6975115ee58c3c9d564b1e45310" and "84f2bfb7a18554461af8b9419b387ed72169fd28" have entirely different histories.
22dbd2fc00
...
84f2bfb7a1
10 changed files with 36 additions and 185 deletions
|
@ -1,7 +1,16 @@
|
||||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
runner = "picotool load -u -v -x -t elf"
|
# Choose a default "cargo run" tool:
|
||||||
# runner = "elf2uf2-rs -d" # rp2040
|
# - probe-run provides flashing and defmt via a hardware debugger
|
||||||
|
# - cargo embed offers flashing, rtt, defmt and a gdb server via a hardware debugger
|
||||||
|
# it is configured via the Embed.toml in the root of this project
|
||||||
|
# - elf2uf2-rs loads firmware over USB when the rp2040 is in boot mode
|
||||||
|
# runner = "probe-run --chip RP2040"
|
||||||
|
# runner = "cargo embed"
|
||||||
|
runner = "elf2uf2-rs -d"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
target = "thumbv8m.main-none-eabihf"
|
# Cortex-M0 and Cortex-M0+
|
||||||
# target = "thumbv6m-none-eabi" # rp2040
|
target = "thumbv6m-none-eabi"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
# DEFMT_LOG = "debug"
|
16
.gitea/workflows/pull_request.yaml
Normal file
16
.gitea/workflows/pull_request.yaml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
name: Merge Build
|
||||||
|
run_name: Test successful build on merge request
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, edited, review_requested, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Build:
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/checkout@main
|
||||||
|
|
||||||
|
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build
|
|
@ -1,30 +0,0 @@
|
||||||
name: Build on master branch
|
|
||||||
run_name: Test successful build on push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Build:
|
|
||||||
steps:
|
|
||||||
- uses: https://github.com/actions/checkout@main
|
|
||||||
|
|
||||||
- uses: https://github.com/SebRollen/toml-action@v1.2.0
|
|
||||||
id: read_rust_toolchain
|
|
||||||
with:
|
|
||||||
file: rust-toolchain
|
|
||||||
field: toolchain.targets
|
|
||||||
id: read_rust_components
|
|
||||||
with:
|
|
||||||
file: rust-toolchain
|
|
||||||
field: toolchain.components
|
|
||||||
|
|
||||||
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
toolchain: ${{ steps.read_rust_toolchain.outputs.value }}
|
|
||||||
components: ${{ steps.read_rust_components.outputs.value }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build
|
|
|
@ -1,30 +0,0 @@
|
||||||
name: Build on feature branch
|
|
||||||
run_name: Test successful build on push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Build:
|
|
||||||
steps:
|
|
||||||
- uses: https://github.com/actions/checkout@main
|
|
||||||
|
|
||||||
- uses: https://github.com/SebRollen/toml-action@v1.2.0
|
|
||||||
id: read_rust_toolchain
|
|
||||||
with:
|
|
||||||
file: rust-toolchain
|
|
||||||
field: toolchain.targets
|
|
||||||
id: read_rust_components
|
|
||||||
with:
|
|
||||||
file: rust-toolchain
|
|
||||||
field: toolchain.components
|
|
||||||
|
|
||||||
- uses: https://github.com/dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
toolchain: ${{ steps.read_rust_toolchain.outputs.value }}
|
|
||||||
components: ${{ steps.read_rust_components.outputs.value }}
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build
|
|
23
Cargo.toml
23
Cargo.toml
|
@ -6,25 +6,8 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-executor = { version = "0.7.0", features = [
|
embassy-executor = { version = "0.5.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "integrated-timers"] }
|
||||||
"task-arena-size-32768",
|
embassy-rp = { version = "0.1.0", features = ["unstable-pac", "time-driver", "critical-section-impl"] }
|
||||||
"arch-cortex-m",
|
|
||||||
"executor-thread",
|
|
||||||
"executor-interrupt",
|
|
||||||
] }
|
|
||||||
embassy-rp = { version = "0.3.1", features = [
|
|
||||||
"unstable-pac",
|
|
||||||
"time-driver",
|
|
||||||
"critical-section-impl",
|
|
||||||
"rp235xa",
|
|
||||||
] }
|
|
||||||
embassy-futures = { version = "0.1.1" }
|
embassy-futures = { version = "0.1.1" }
|
||||||
|
|
||||||
cortex-m-rt = "0.7.5"
|
cortex-m-rt = "0.7.4"
|
||||||
cortex-m = { version = "0.7.7", features = ["inline-asm"] }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
rp2350 = ["embassy-rp/rp235xa"]
|
|
||||||
rp2040 = ["embassy-rp/rp2040"]
|
|
||||||
|
|
||||||
default = ["rp2350"]
|
|
||||||
|
|
14
build.rs
14
build.rs
|
@ -17,19 +17,10 @@ fn main() {
|
||||||
// Put `memory.x` in our output directory and ensure it's
|
// Put `memory.x` in our output directory and ensure it's
|
||||||
// on the linker search path.
|
// on the linker search path.
|
||||||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
|
|
||||||
#[cfg(feature = "rp2040")]
|
|
||||||
File::create(out.join("memory.x"))
|
File::create(out.join("memory.x"))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.write_all(include_bytes!("rp_2040_memory.x"))
|
.write_all(include_bytes!("memory.x"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
#[cfg(feature = "rp2350")]
|
|
||||||
File::create(out.join("memory.x"))
|
|
||||||
.unwrap()
|
|
||||||
.write_all(include_bytes!("rp_2350_memory.x"))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
println!("cargo:rustc-link-search={}", out.display());
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
|
||||||
// By default, Cargo will re-run a build script whenever
|
// By default, Cargo will re-run a build script whenever
|
||||||
|
@ -40,7 +31,6 @@ fn main() {
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
#[cfg(feature = "rp2040")]
|
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink-rp.x");
|
||||||
|
// println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
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);
|
|
|
@ -1,4 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
components = [ "rust-src", "rustfmt", "llvm-tools" ]
|
components = [ "rust-src", "rustfmt", "llvm-tools" ]
|
||||||
targets = ["thumbv8m.main-none-eabihf"]
|
targets = ["thumbv6m-none-eabi"]
|
||||||
# targets = ["thumbv6m-none-eabi"]
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,12 +1,6 @@
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
#[cfg(not(all(
|
|
||||||
not(all(feature = "rp2040", feature = "rp2350")),
|
|
||||||
any(feature = "rp2040", feature = "rp2350")
|
|
||||||
)))]
|
|
||||||
compile_error!("Enable either feature rp2040 (pico 1) or feature rp2350 (pico 2)");
|
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
|
@ -17,11 +11,6 @@ fn panic(_info: &PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "rp2350")]
|
|
||||||
#[link_section = ".start_block"]
|
|
||||||
#[used]
|
|
||||||
pub static IMAGE_DEF: embassy_rp::block::ImageDef = embassy_rp::block::ImageDef::secure_exe();
|
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = embassy_rp::init(Default::default());
|
let p = embassy_rp::init(Default::default());
|
||||||
|
|
Loading…
Reference in a new issue