Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAC for SAMC21J, built on demand #665

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions boards/atsamc21_xpro/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# samd21 is a Cortex-M0 and thus thumbv6m

[build]
target = "thumbv6m-none-eabi"
rustflags = [
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
"-C", "link-arg=--nmagic",
"-C", "link-arg=-Tlink.x",
]

[target.thumbv6m-none-eabi]
runner = 'arm-none-eabi-gdb'
#runner = 'probe-run --chip ATSAMC21J18A'
7 changes: 7 additions & 0 deletions boards/atsamc21_xpro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Unreleased

- Initial version

---

Changelog tracking started at v0.0.0
46 changes: 46 additions & 0 deletions boards/atsamc21_xpro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[package]
name = "atsamc21_xpro"
version = "0.0.0"
authors = [
"Jeremy Boynes <[email protected]>"
]
description = "Board Support crate for the SAM C21 Xplained Pro Evaluation Kit"
keywords = ["no-std", "arm", "cortex-m", "embedded-hal"]
categories = ["embedded", "hardware-support", "no-std"]
license = "MIT OR Apache-2.0"
edition = "2021"
repository = "https://github.com/atsamd-rs/atsamd"
readme = "README.md"

# for cargo flash
[package.metadata]
chip = "ATSAMC21J18A"

[dependencies]
cortex-m = "0.7.6"
cortex-m-rt = { version = "0.7", optional = true }

[dependencies.atsamc21j]
path = "../../pac/atsamc21j"

[dev-dependencies]
cortex-m = "0.7.6"
panic-halt = "0.2"
panic-semihosting = "0.6"

[features]
default = ["rt"]
rt = ["cortex-m-rt", "atsamc21j/rt"]

[profile.dev]
incremental = false
codegen-units = 1
debug = true
lto = true

[profile.release]
lto = true
opt-level = "s"

[[example]]
name = "blinky_pac"
30 changes: 30 additions & 0 deletions boards/atsamc21_xpro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SAM C21 Xplained Pro Evaluation Kit Board Support Crate

This crate provides a type-safe Rust API for working with the
[SAM C21 Xplained Pro Evaluation Kit](https://www.microchip.com/developmenttools/productdetails/atsamc21_xpro).

## Board Features

- Microchip [ATSAMC21J18A] Cortex-M0 microcontroller @ 48 MHz (32-bit, 3.3V or 5V logic and power)
- 256kB Flash
- 32kB SRAM
- CAN and LIN interfaces

## Prerequisites
* Install the cross compile toolchain `rustup target add thumbv6m-none-eabi`

## Uploading an example
Check out the repository for examples:

https://github.com/atsamd-rs/atsamd/tree/master/boards/atsamc21_xpro/examples

* Be in this directory `cd boards/atsamc21_xpro`
* Build and upload in one step
```
$ cargo flash --example blinky_pac --chip-description-path SAMC21.yaml --chip ATSAMC21J18A
Finished dev [unoptimized + debuginfo] target(s) in 7.56s
Flashing .../boards/atsamc21_xpro/target/thumbv6m-none-eabi/debug/examples/blinky_pac
Erasing sectors ✔ [00:00:00] [#######################] 16.00 KiB/16.00 KiB @ 91.94 KiB/s (eta 0s )
Programming pages ✔ [00:00:00] [##########################] 2.00 KiB/2.00 KiB @ 5.79 KiB/s (eta 0s ) Finished in 0.593s
$
```
Loading