Skip to content

Commit adaa20d

Browse files
committed
BEHOLD THE EREPORTULATOR
1 parent db5d6d6 commit adaa20d

File tree

6 files changed

+110
-1
lines changed

6 files changed

+110
-1
lines changed

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ leb128 = { version = "0.2.5", default-features = false }
9292
lpc55-pac = { version = "0.4", default-features = false }
9393
memchr = { version = "2.4", default-features = false }
9494
memoffset = { version = "0.6.5", default-features = false }
95+
minicbor = { version = "0.26.4", default-features = false }
9596
multimap = { version = "0.8.3", default-features = false }
9697
nb = { version = "1", default-features = false }
9798
num = { version = "0.4", default-features = false }

app/gimletlet/app-ereportlet.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name = "gimletlet-ereportlet"
2+
inherit = "app.toml"
3+
4+
[tasks.jefe.config.allowed-callers]
5+
request_reset = ["hiffy"]
6+
7+
[tasks.hiffy]
8+
features = ["h753", "stm32h7", "i2c", "gpio", "spi"]
9+
task-slots = ["sys", "i2c_driver", "user_leds"]
10+
11+
[tasks.ereportulator]
12+
name = "task-ereportulator"
13+
priority = 8
14+
# start paused so that we can be triggered by humility
15+
start = false
16+
task-slots = ["packrat"]
17+
notifications = []

task/ereportulator/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "task-ereportulator"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
userlib = { path = "../../sys/userlib" }
8+
idol-runtime.workspace = true
9+
zerocopy.workspace = true
10+
zerocopy-derive.workspace = true
11+
task-packrat-api = { path = "../packrat-api" }
12+
minicbor.workspace = true
13+
14+
[[bin]]
15+
name = "task-ereportulator"
16+
test = false
17+
doctest = false
18+
bench = false
19+
20+
[lints]
21+
workspace = true

task/ereportulator/src/main.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
//!
6+
//! # BEHOLD THE EREPORTULATOR!
7+
//!
8+
//! stupid ereport demo task
9+
//!
10+
#![no_std]
11+
#![no_main]
12+
13+
use task_packrat_api::Packrat;
14+
task_slot!(PACKRAT, packrat);
15+
16+
use minicbor::Encoder;
17+
use userlib::{sys_recv_notification, task_slot, UnwrapLite};
18+
19+
#[export_name = "main"]
20+
fn main() -> ! {
21+
let packrat = Packrat::from(PACKRAT.get_task_id());
22+
23+
let mut buf = [0u8; 256];
24+
25+
let encoded_len = {
26+
let c = minicbor::encode::write::Cursor::new(&mut buf[..]);
27+
let mut encoder = Encoder::new(c);
28+
encoder
29+
.begin_map()
30+
.unwrap_lite()
31+
.str("k")
32+
.unwrap_lite()
33+
.str("TEST EREPORT PLS IGNORE")
34+
.unwrap_lite()
35+
.str("badness")
36+
.unwrap_lite()
37+
.u32(10000)
38+
.unwrap_lite()
39+
.str("msg")
40+
.unwrap_lite()
41+
.str("im dead")
42+
.unwrap_lite()
43+
.end()
44+
.unwrap_lite();
45+
46+
encoder.into_writer().position()
47+
};
48+
49+
packrat.deliver_ereport(&buf[..encoded_len]);
50+
51+
loop {
52+
// now die!
53+
sys_recv_notification(0);
54+
// TODO(eliza): eventually it might be a lil nicer if we had an IPC
55+
// interface for sending an ereport, so we could trigger this multiple
56+
// times from humility...
57+
}
58+
}

task/packrat/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static-cell = { path = "../../lib/static-cell" }
2222
task-packrat-api = { path = "../packrat-api" }
2323
userlib = { path = "../../sys/userlib", features = ["panic-messages"] }
2424
snitch-core = { version = "0.1.0", path = "../../lib/snitch-core", optional = true }
25-
minicbor = { version = "0.26.4", optional = true }
25+
minicbor = { workspace = true, optional = true }
2626

2727
[build-dependencies]
2828
anyhow.workspace = true

0 commit comments

Comments
 (0)