Skip to content

Commit 70ad87a

Browse files
bors[bot]huntcjonas-schievink
authored
Merge #338
338: Tidies up the configuration to better support VS Code r=jonas-schievink a=huntc This configuration update reflects the strategy taken with Embassy where a `Cargo.example.toml` is provided. This example is expected to be updated by the developer and customised for the target they are interested in. Without these changes, working with `nrf-hal` is quite unpleasant in Visual Studio Code. A `Cargo.ci.toml` is provided and used by CI. This file is the original `Cargo.toml`. Thanks to @Dirbaio for the recommendations. Co-authored-by: huntc <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
2 parents 04579df + 73a5aa5 commit 70ad87a

File tree

7 files changed

+56
-4
lines changed

7 files changed

+56
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
thumbv7em-none-eabihf
3434
thumbv8m.main-none-eabi
3535
- name: Build Crates
36-
run: cargo test -p xtask
36+
run: mv Cargo.ci.toml Cargo.toml && cargo test -p xtask
3737
env:
3838
RUSTFLAGS: ${{ matrix.rustflags }}
3939

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
[._]*.sw[a-p]
44
**/*.rs.bk
55
Cargo.lock
6+
Cargo.toml
7+
Cargo.my.toml
68

79
# Created by https://www.gitignore.io/api/intellij+all
810

.vscode/settings.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"rust-analyzer.cargo.features": [
3-
"52840"
4-
]
2+
"rust-analyzer.cargo.target": "thumbv7em-none-eabi",
3+
"rust-analyzer.checkOnSave.allTargets": false,
54
}

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ even if not breaking changes by themselves, will only be included in the next ma
2323

2424
## Release process
2525

26+
The release process requires the workspace to be setup as per when performing Continuous Integration.
27+
Please follow these steps before you begin (shown for Unix):
28+
29+
1. Keep a copy of your existing `Cargo.toml` - `mv Cargo.toml Cargo.my.toml`. Note that `Cargo.my.toml`
30+
is ignored for the repository so it cannot be accidentally committed.
31+
2. Activate the CI workspace - `cp Cargo.ci.toml Cargo.toml`.
32+
33+
When finished releasing, copy or move your `Cargo.my.toml` back.
34+
2635
In order to release a new version of the HALs, the following steps need to be performed:
2736

2837
* **Changelog**: Update [the changelog](./CHANGELOG.md) to list all notable changes under the `Unreleased`
File renamed without changes.

Cargo.example.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This file is a template for a Cargo workspace for developer convenience.
2+
#
3+
# Since Cargo resolves all features for all crates in the workspace together,
4+
# it is not possible to have a workspace with all the crates together, since they
5+
# enable incompatible features.
6+
#
7+
# Instead, we provide this template so you can enable only the crates you're going to
8+
# work on. This makes eg rust-analyzer check-on-save and autocomplete work, but only
9+
# in these crates, without any feature conflict.
10+
#
11+
# Copy this file to `Cargo.toml` and uncomment one group of crates below.
12+
#
13+
# `/Cargo.toml` is already in .gitignore, so you don't commit it accidentally.
14+
15+
[workspace]
16+
members = [
17+
# Uncomment ONLY ONE of the hals below, depending on your target
18+
# "nrf52810-hal",
19+
# "nrf52811-hal",
20+
# "nrf52832-hal",
21+
# "nrf52833-hal",
22+
"nrf52840-hal",
23+
"nrf52840-hal-tests",
24+
# "nrf9160-hal",
25+
]
26+
27+
[profile.dev]
28+
incremental = false
29+
codegen-units = 1
30+
debug = true
31+
lto = false
32+
33+
[profile.release]
34+
debug = true
35+
lto = true
36+
opt-level = "s"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ Every nRF chip has its own crate, listed below:
3737

3838
\* These devices do not have a separate development kit and share the [NRF52 DK](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK)
3939

40+
## Development
41+
42+
Be sure to copy and edit the `Cargo.example.toml` file to `Cargo.toml`. The file will require editing dependent on the target you wish to work with and contains some further
43+
instructions. Similarly, check out the `.vscode/settings.json` file when used in the context of Visual Studio Code. By default, all of these files are configured to work
44+
with the nRF52840 target.
45+
4046
## License
4147

4248
Licensed under either of

0 commit comments

Comments
 (0)