Skip to content

Commit

Permalink
Added support for SAME70 (new PACs and HAL adjustments)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalfita committed Jun 3, 2020
1 parent ab021f8 commit c07076e
Show file tree
Hide file tree
Showing 7,441 changed files with 1,659,950 additions and 7 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]


## [v0.0.2] 2020-06-03

* same70*: added foundations for ATSAME70 series support
* Commitment to 0BSD license following practice from other PAC/HAL crates

## [v0.0.1] 2019-07-31
Expand All @@ -10,5 +14,6 @@
* hal: Just very simple stuff added
* automation script in Python

[Unreleased]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.0.1...HEAD
[Unreleased]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.0.2...HEAD
[v0.0.2]: https://github.com/stm32-rs/stm32h7xx-hal/compare/v0.0.1...v0.0.2
[v0.0.1]: https://github.com/michalfita/atsams70-rust/tree/v0.0.1
99 changes: 99 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ atsams70q20 = { version = "0.0.2", path = "../pac/atsams70q20", optional = true
atsams70q20b = { version = "0.0.2", path = "../pac/atsams70q20b", optional = true }
atsams70q21 = { version = "0.0.2", path = "../pac/atsams70q21", optional = true }
atsams70q21b = { version = "0.0.2", path = "../pac/atsams70q21b", optional = true }
atsame70j19b = { version = "0.0.2", path = "../pac/atsame70j19b", optional = true }
atsame70j20b = { version = "0.0.2", path = "../pac/atsame70j20b", optional = true }
atsame70j21b = { version = "0.0.2", path = "../pac/atsame70j21b", optional = true }
atsame70n19b = { version = "0.0.2", path = "../pac/atsame70n19b", optional = true }
atsame70n20b = { version = "0.0.2", path = "../pac/atsame70n20b", optional = true }
atsame70n21b = { version = "0.0.2", path = "../pac/atsame70n21b", optional = true }
atsame70q19b = { version = "0.0.2", path = "../pac/atsame70q19b", optional = true }
atsame70q20b = { version = "0.0.2", path = "../pac/atsame70q20b", optional = true }
atsame70q21b = { version = "0.0.2", path = "../pac/atsame70q21b", optional = true }

[features]
device-selected = []
Expand All @@ -63,3 +72,13 @@ sams70q20 = ["atsams70q20", "device-selected"]
sams70q20b = ["atsams70q20b", "device-selected"]
sams70q21 = ["atsams70q21", "device-selected"]
sams70q21b = ["atsams70q21b", "device-selected"]
same70j19b = ["atsame70j19b", "device-selected"]
same70j20b = ["atsame70j20b", "device-selected"]
same70j21b = ["atsame70j21b", "device-selected"]
same70n19b = ["atsame70n19b", "device-selected"]
same70n20b = ["atsame70n20b", "device-selected"]
same70n21b = ["atsame70n21b", "device-selected"]
same70q19b = ["atsame70q19b", "device-selected"]
same70q20b = ["atsame70q20b", "device-selected"]
same70q21b = ["atsame70q21b", "device-selected"]

7 changes: 6 additions & 1 deletion hal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ This is crate with implementation of HAL traits from [embedded-hal](https://crat
* [ATSAMV7x](https://www.microchip.com/ParamChartSearch/Chart.aspx?branchID=2117) (_to be done_)
* [ATSAME70](https://www.microchip.com/ParamChartSearch/Chart.aspx?branchID=2113) (_in progress_)

## MCU Revisions

At the moment this HAL crate supports only revision **B** of SVD files and future removal of PAC crates for _pre-B_ revisions are now considered. Discrepancies between both type in terms of register structue support is too significant to maintain completely different code for them.

## License

[BSD Zero Clause License](https://choosealicense.com/licenses/0bsd/)
[BSD Zero Clause License](https://choosealicense.com/licenses/0bsd/)

9 changes: 9 additions & 0 deletions hal/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
highlight=$(tput setaf 214)
stopcolor=$(tput sgr0)

for mcutype in `ls ../pac/ | grep '.*b$'` ; do
echo -e "\n--==[ ${highlight}${mcutype}${stopcolor} ] ]==--"
cargo build --features ${mcutype:2}
done

11 changes: 10 additions & 1 deletion hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,14 @@ extern crate nb;
#[cfg(any(feature = "sams70q20b"))] pub use atsams70q20b as target_device;
#[cfg(any(feature = "sams70q21"))] pub use atsams70q21 as target_device;
#[cfg(any(feature = "sams70q21b"))] pub use atsams70q21b as target_device;
#[cfg(any(feature = "same70j19b"))] pub use atsame70j19b as target_device;
#[cfg(any(feature = "same70j20b"))] pub use atsame70j20b as target_device;
#[cfg(any(feature = "same70j21b"))] pub use atsame70j21b as target_device;
#[cfg(any(feature = "same70n19b"))] pub use atsame70n19b as target_device;
#[cfg(any(feature = "same70n20b"))] pub use atsame70n20b as target_device;
#[cfg(any(feature = "same70n21b"))] pub use atsame70n21b as target_device;
#[cfg(any(feature = "same70q19b"))] pub use atsame70q19b as target_device;
#[cfg(any(feature = "same70q20b"))] pub use atsame70q20b as target_device;
#[cfg(any(feature = "same70q21b"))] pub use atsame70q21b as target_device;

pub mod serial;
pub mod serial;
43 changes: 39 additions & 4 deletions hal/src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ use crate::target_device::{ UART0, UART1, UART2, USART0, USART1 };
feature = "sams70q19b",
feature = "sams70q20b",
feature = "sams70q21b",
feature = "same70n19b",
feature = "same70n20b",
feature = "same70n21b",
feature = "same70q19b",
feature = "same70q20b",
feature = "same70q21b",
))] use crate::target_device::{ UART3, USART2 };

#[cfg(any(
Expand All @@ -16,6 +22,12 @@ use crate::target_device::{ UART0, UART1, UART2, USART0, USART1 };
feature = "sams70q19b",
feature = "sams70q20b",
feature = "sams70q21b",
feature = "same70n19b",
feature = "same70n20b",
feature = "same70n21b",
feature = "same70q19b",
feature = "same70q20b",
feature = "same70q21b",
))] use crate::target_device::{ UART4 /*, USART3 */ };

use crate::target_device::{
Expand All @@ -37,7 +49,13 @@ pub type Serial2 = Serial<UART2>;
feature = "sams70n21b",
feature = "sams70q19b",
feature = "sams70q20b",
feature = "sams70q21b"
feature = "sams70q21b",
feature = "same70n19b",
feature = "same70n20b",
feature = "same70n21b",
feature = "same70q19b",
feature = "same70q20b",
feature = "same70q21b",
))]
pub type Serial3 = Serial<UART3>;

Expand All @@ -47,7 +65,13 @@ pub type Serial3 = Serial<UART3>;
feature = "sams70n21b",
feature = "sams70q19b",
feature = "sams70q20b",
feature = "sams70q21b"
feature = "sams70q21b",
feature = "same70n19b",
feature = "same70n20b",
feature = "same70n21b",
feature = "same70q19b",
feature = "same70q20b",
feature = "same70q21b",
))]
pub type Serial4 = Serial<UART4>;

Expand All @@ -61,6 +85,12 @@ pub type Serial6 = Serial<USART1>;
feature = "sams70q19b",
feature = "sams70q20b",
feature = "sams70q21b",
feature = "same70n19b",
feature = "same70n20b",
feature = "same70n21b",
feature = "same70q19b",
feature = "same70q20b",
feature = "same70q21b",
))]
pub type Serial7 = Serial<USART2>;

Expand Down Expand Up @@ -99,7 +129,12 @@ impl hal::serial::Write<u8> for Serial<USART1> {
}
}

#[cfg(any(feature = "sams70q20b", feature = "sams70q21b"))]
#[cfg(any(
feature = "sams70q20b",
feature = "sams70q21b",
feature = "same70q20b",
feature = "same70q21b",
))]
impl hal::serial::Write<u8> for Serial<UART3> {
type Error = Error;

Expand Down Expand Up @@ -146,4 +181,4 @@ fn flush_usart(regs: &USARTRegisterBlock) -> nb::Result<(), Error> {
} else {
Ok(())
}
}
}
26 changes: 26 additions & 0 deletions pac/atsame70j19b/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "atsame70j19b"
description = "Peripheral access API for ATSAME70J19B microcontrollers from Atmel/Microchip (generated using svd2rust)"
version = "0.0.2"
authors = ["Michal Fita <[email protected]>"]
categories = ["no-std", "embedded", "hardware-support"]
keywords = ["no-std", "arm", "cortex-m", "atsam", "pac"]
license = "0BSD"
repository = "https://github.com/michalfita/atsams70-rust"
readme = "README.md"

[dependencies]
bare-metal = "~0.2"
cortex-m = "~0.6"
vcell = "~0.1"

[dependencies.cortex-m-rt]
optional = true
version = "~0.6"

[features]
rt = ["cortex-m-rt/device"]

[lib]
name = "atsame70j19b"
path = "src/lib.rs"
7 changes: 7 additions & 0 deletions pac/atsame70j19b/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Peripheral Access Crate atsame70j19b for ATSAME70J19B 32-bit MCU from Atmel/Microchip

This crate contains autogenerated code to access peripherals of ATSAME70J19B generated from official SVD files from Microchip website using [svd2rust](https://github.com/rust-embedded/svd2rust/) tool.

## License

[BSD Zero Clause License](https://choosealicense.com/licenses/0bsd/)
16 changes: 16 additions & 0 deletions pac/atsame70j19b/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("device.x"))
.unwrap()
.write_all(include_bytes!("device.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=device.x");
}
println!("cargo:rerun-if-changed=build.rs");
}
Loading

0 comments on commit c07076e

Please sign in to comment.