Skip to content

Commit e6ba297

Browse files
committed
BEHOLD THE EREPORTULATOR
1 parent db5d6d6 commit e6ba297

File tree

6 files changed

+107
-1
lines changed

6 files changed

+107
-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: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 c = minicbor::encode::write::Cursor::new(&mut buf[..]);
26+
let mut encoder = Encoder::new(c);
27+
let c = encoder
28+
.begin_map()
29+
.unwrap_lite()
30+
.str("k")
31+
.unwrap_lite()
32+
.str("TEST EREPORT PLS IGNORE")
33+
.unwrap_lite()
34+
.str("badness")
35+
.unwrap_lite()
36+
.u32(10000)
37+
.unwrap_lite()
38+
.str("msg")
39+
.unwrap_lite()
40+
.str("im dead")
41+
.unwrap_lite()
42+
.end()
43+
.unwrap_lite()
44+
.into_writer();
45+
46+
packrat.deliver_ereport(&buf[..c.position()]);
47+
48+
loop {
49+
// now die!
50+
sys_recv_notification(0);
51+
// TODO(eliza): eventually it might be a lil nicer if we had an IPC
52+
// interface for sending an ereport, so we could trigger this multiple
53+
// times from humility...
54+
}
55+
}

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)