Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

Commit 298ad59

Browse files
committed
Add WG related files and a simple test for CI
Change CODEOWNERS to cortex-m, cortex-m, cortex-r, msp430, and riscv teams
1 parent f8c893e commit 298ad59

File tree

8 files changed

+107
-6
lines changed

8 files changed

+107
-6
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* rust-embedded/cortex-a rust-embedded/cortex-m rust-embedded/cortex-r rust-embedded/msp430 rust-embedded/riscv

.github/bors.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
block_labels = ["needs-decision"]
2+
delete_merged_branches = true
3+
required_approvals = 1
4+
status = ["continuous-integration/travis-ci/push"]

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: rust
2+
3+
matrix:
4+
allow_failures:
5+
- rust: nightly
6+
include:
7+
- rust: stable
8+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
9+
- rust: nightly
10+
if: (branch = staging OR branch = trying) OR (type = pull_request AND branch = master)
11+
12+
branches:
13+
only:
14+
- master
15+
- staging
16+
- trying

CODE_OF_CONDUCT.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# The Rust Code of Conduct
2+
3+
## Conduct
4+
5+
**Contact**: [Embedded WG][wg]
6+
7+
* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
8+
* On Matrix and IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
9+
* Please be kind and courteous. There's no need to be mean or rude.
10+
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
11+
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
12+
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the [Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
13+
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Embedded WG][wg] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
14+
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
15+
16+
## Moderation
17+
18+
These are the policies for upholding our community's standards of conduct.
19+
20+
1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
21+
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
22+
3. Moderators will first respond to such remarks with a warning.
23+
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
24+
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
25+
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
26+
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
27+
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
28+
29+
In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
30+
31+
And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
32+
33+
The enforcement policies listed above apply to all official embedded WG venues; including the official Matrix room (#rust-embedded:matrix.org) and linked IRC channels (#rust-embedded on Freenode); GitHub repositories under rust-embedded; and all forums under rust-embedded.org (forum.rust-embedded.org).
34+
35+
*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
36+
37+
[wg]: https://github.com/rust-embedded/wg#organization

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ documentation = "https://docs.rs/r0"
55
keywords = ["initialization", "start", "crt0", "c0"]
66
license = "MIT OR Apache-2.0"
77
name = "r0"
8-
repository = "https://github.com/japaric/r0"
8+
repository = "https://github.com/rust-embedded/r0"
99
version = "0.2.2"

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
> Initialization code ("crt0") written in Rust
88
9+
This project is developed and maintained by the [Cortex-A, Cortex-M, Cortex-R,
10+
MSP430, and RISCV teams][teams].
11+
912
## [Documentation](https://docs.rs/r0)
1013

1114
## License
@@ -23,3 +26,13 @@ at your option.
2326
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
2427
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
2528
additional terms or conditions.
29+
30+
## Code of Conduct
31+
32+
Contribution to this crate is organized under the terms of the [Rust Code of
33+
Conduct][CoC], the maintainers of this crate, the [Cortex-A, Cortex-M,
34+
Cortex-R, MSP430, and RISCV teams][teams], promise to intervene to uphold that
35+
code of conduct.
36+
37+
[CoC]: CODE_OF_CONDUCT.md
38+
[teams]: https://github.com/rust-embedded/wg#organization

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! On the linker script side, we must assign names (symbols) to the boundaries
99
//! of the `.bss` and `.data` sections.
1010
//!
11-
//! ``` text
11+
//! ```text
1212
//! .bss : ALIGN(4)
1313
//! {
1414
//! _sbss = .;
@@ -28,7 +28,7 @@
2828
//!
2929
//! On the Rust side, we must bind to those symbols using an `extern` block.
3030
//!
31-
//! ```
31+
//! ```rust,ignore
3232
//! unsafe fn before_main() {
3333
//! // The type, `u32`, indicates that the memory is 4-byte aligned
3434
//! extern "C" {
@@ -55,7 +55,7 @@
5555
//! sections from input object files. Store the start and end address of the
5656
//! merged `.init_array` section.
5757
//!
58-
//! ``` text
58+
//! ```text
5959
//! .text :
6060
//! {
6161
//! /* .. */
@@ -69,7 +69,7 @@
6969
//! On the startup code, invoke the `run_init_array` function *before* you call
7070
//! the user `main`.
7171
//!
72-
//! ```
72+
//! ```rust,ignore
7373
//! unsafe fn start() {
7474
//! extern "C" {
7575
//! static _init_array_start: extern "C" fn();
@@ -89,7 +89,7 @@
8989
//! Then the user application can use this crate `init_array!` macro to run code
9090
//! before `main`.
9191
//!
92-
//! ```
92+
//! ```rust,ignore
9393
//! init_array!(before_main, {
9494
//! println!("Hello");
9595
//! });
@@ -102,6 +102,9 @@
102102
#![deny(warnings)]
103103
#![no_std]
104104

105+
#[cfg(test)]
106+
mod test;
107+
105108
use core::{mem, ptr, slice};
106109

107110
/// Initializes the `.data` section

src/test.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use ::{init_data, zero_bss};
2+
3+
#[test]
4+
fn test_init_data() {
5+
let mut data = [0u32, 1, 2, 3, 4, 5, 6, 7];
6+
let mut mem = [0u32; 8];
7+
let sdata = &mut data[0] as *mut u32;
8+
let sidata = &mut mem[0] as *mut u32;
9+
unsafe {
10+
let edata = sdata.offset(data.len() as isize);
11+
init_data::<u32>(sdata, edata, sidata);
12+
};
13+
14+
assert_eq!(data, mem);
15+
}
16+
17+
#[test]
18+
fn test_zero_bss() {
19+
let mut mem = [0xFFFF_FFFFu32; 8];
20+
let sbss = &mut mem[0] as *mut u32;
21+
unsafe {
22+
let ebss = sbss.offset(mem.len() as isize);
23+
zero_bss::<u32>(sbss, ebss);
24+
};
25+
26+
assert_eq!(mem, [0u32; 8]);
27+
}

0 commit comments

Comments
 (0)