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

WIP: allow SPI transfers in excess of 65525 bytes #1704

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
656b8a8
stm32h7-spi: don't reject xfers > u16::max
hawkw Mar 29, 2024
7bd5c3d
wip
hawkw Mar 30, 2024
67e2320
WIP TSER
hawkw Apr 2, 2024
2bcbcf1
wip2
hawkw Apr 2, 2024
4332977
build: re-enable task packing.
cbiffle Mar 29, 2024
3fd9d21
power: add comments to gimlet rail sag trace facility
cbiffle Mar 28, 2024
3cf06d7
nucleo-user-button: fix backwards comment
hawkw Mar 30, 2024
4cbc197
stm32xx-sys: add more complete EXTI docs
hawkw Apr 1, 2024
409c9a5
stm32xx-sys: configure GPIO IRQ edge with an enum (#1706)
hawkw Apr 2, 2024
852fb9e
stm32xx: generate counters for EXTI IRQs (#1698)
hawkw Apr 2, 2024
e676e41
sensor: remove noop 1 Hz timer
cbiffle Apr 1, 2024
ab78c7e
userlib: add no-panic feature
cbiffle Apr 2, 2024
02bfc32
userlib: fail if no-panic and panic-messages are both set
cbiffle Apr 3, 2024
b690556
kern: improve comments in RECV impl
cbiffle Apr 1, 2024
aa2fadb
Introduce and use sys_recv_notification.
cbiffle Apr 1, 2024
58614c0
Fix whitespace inconsistency in Idol files (#1705)
mkeeter Apr 3, 2024
4a780d0
stm32xx-sys: fix typo in EXTI pin configuration
cbiffle Apr 3, 2024
274b51f
Bump idol to get size improvements.
cbiffle Apr 2, 2024
c464bb3
stm32xx-sys: add interrupt acking to `gpio_irq_control` (#1712)
hawkw Apr 3, 2024
e66e327
stm32xx-sys: statically ensure absence of panics
cbiffle Apr 2, 2024
e4316f0
Bump the toolchain to latest nightly.
cbiffle Apr 1, 2024
14f4170
Temporarily* disable clippy
cbiffle Apr 4, 2024
366f425
thermal: remove use of f32::clamp for now
cbiffle Apr 4, 2024
a326ff5
build/i2c: generate range matches
cbiffle Apr 4, 2024
d195bce
control-plane-agent: finish ComponentUpdater
cbiffle Apr 4, 2024
c60adc1
transceivers-server: remove illusory loop
cbiffle Apr 5, 2024
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
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[alias]
xtask = "run --package xtask --"

[build]
# The purpose of this flag is to block crates using version_detect from "detecting"
# features that are no longer supported by the toolchain, because despite its name,
# version_detect is basically "if nightly { return true; }". This setting gets
# overridden within xtask for Hubris programs, so this only affects host tools like
# xtask.
rustflags = ["-Zallow-features=proc_macro_diagnostic,asm_const,naked_functions,used_with_arg"]
12 changes: 8 additions & 4 deletions .github/workflows/build-one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ jobs:
target/release/humility -a target/${{ inputs.app_name }}/dist/build-${{ inputs.app_name }}-image-$image.zip manifest; \
done

- name: Clippy
if: inputs.os == 'ubuntu-latest'
run: |
cargo xtask clippy ${{ inputs.app_toml}} -- --deny warnings
# TODO: Clippy temporarily disabled 2024-04 while people clean up
# the new Clippy warnings resulting from the last toolchain
# upgrade. If you're reading this, try turning it back on and see
# if we're good yet.
#- name: Clippy
# if: inputs.os == 'ubuntu-latest'
# run: |
# cargo xtask clippy ${{ inputs.app_toml}} -- --deny warnings

# upload the output of our build
- name: Upload build archive
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["resolver", "named-profiles"]

[workspace]
members = [
"build/*",
Expand Down
2 changes: 1 addition & 1 deletion app/demo-stm32g0-nucleo/app-g070.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ stacksize = 944

[kernel]
name = "demo-stm32g0-nucleo"
requires = {flash = 19040, ram = 1632}
requires = {flash = 19264, ram = 1632}
features = ["g070"]
stacksize = 640

Expand Down
6 changes: 3 additions & 3 deletions app/demo-stm32h7-nucleo/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stacksize = 896

[kernel]
name = "demo-stm32h7-nucleo"
requires = {flash = 24000, ram = 5120}
requires = {flash = 24736, ram = 5120}
features = ["h743", "dump"]

[tasks.jefe]
Expand All @@ -25,7 +25,7 @@ request_reset = ["hiffy"]

[tasks.sys]
name = "drv-stm32xx-sys"
features = ["h743", "exti"]
features = ["h743", "exti", "no-panic"]
priority = 1
uses = ["rcc", "gpios", "system_flash", "syscfg", "exti"]
start = true
Expand Down Expand Up @@ -107,7 +107,7 @@ priority = 3
start = true
task-slots = ["sys", "user_leds"]
notifications = ["button"]
config = { led = 1, rising = false, falling = true }
config = { led = 1, edge = "Edge::Rising" }

[tasks.udpecho]
name = "task-udpecho"
Expand Down
6 changes: 3 additions & 3 deletions app/demo-stm32h7-nucleo/app-h753.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stacksize = 896

[kernel]
name = "demo-stm32h7-nucleo"
requires = {flash = 24544, ram = 5120}
requires = {flash = 24736, ram = 5120}
features = ["h753", "dump"]

[tasks.jefe]
Expand All @@ -25,7 +25,7 @@ request_reset = ["hiffy"]

[tasks.sys]
name = "drv-stm32xx-sys"
features = ["h753", "exti"]
features = ["h753", "exti", "no-panic"]
priority = 1
uses = ["rcc", "gpios", "system_flash", "syscfg", "exti"]
start = true
Expand Down Expand Up @@ -116,7 +116,7 @@ priority = 3
start = true
task-slots = ["sys", "user_leds"]
notifications = ["button"]
config = { led = 1, rising = false, falling = true }
config = { led = 1, edge = "Edge::Rising" }

[tasks.udpecho]
name = "task-udpecho"
Expand Down
2 changes: 1 addition & 1 deletion app/donglet/app-g031-i2c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ board = "donglet-g031"

[kernel]
name = "app-donglet"
requires = {flash = 18752, ram = 1616}
requires = {flash = 18944, ram = 1616}
features = ["g031"]
stacksize = 936

Expand Down
2 changes: 1 addition & 1 deletion app/donglet/app-g031.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ board = "donglet-g031"

[kernel]
name = "app-donglet"
requires = {flash = 18944, ram = 1820}
requires = {flash = 19168, ram = 1820}
features = ["g031"]
stacksize = 936

Expand Down
3 changes: 1 addition & 2 deletions app/gimlet/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ notifications = ["eth-irq", "mdio-timer-irq", "wake-timer", "jefe-state-change"]

[tasks.sys]
name = "drv-stm32xx-sys"
features = ["h753", "exti"]
features = ["h753", "exti", "no-panic"]
priority = 1
uses = ["rcc", "gpios", "system_flash", "syscfg", "exti"]
start = true
Expand Down Expand Up @@ -214,7 +214,6 @@ priority = 4
max-sizes = {flash = 16384, ram = 8192 }
stacksize = 1024
start = true
notifications = ["timer"]

[tasks.host_sp_comms]
name = "task-host-sp-comms"
Expand Down
1 change: 0 additions & 1 deletion app/gimletlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ priority = 5
max-sizes = {flash = 16384, ram = 2048 }
stacksize = 1024
start = true
notifications = ["timer"]

[tasks.dump_agent]
name = "task-dump-agent"
Expand Down
1 change: 0 additions & 1 deletion app/oxide-rot-1/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ task-slots = ["syscon_driver"]
[tasks.sprot]
name = "drv-lpc55-sprot-server"
priority = 6
max-sizes = {flash = 48608, ram = 32768}
uses = ["flexcomm8", "bootrom"]
features = ["spi0"]
start = true
Expand Down
3 changes: 1 addition & 2 deletions app/psc/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ request_reset = ["hiffy", "control_plane_agent"]

[tasks.sys]
name = "drv-stm32xx-sys"
features = ["h753"]
features = ["h753", "no-panic"]
priority = 1
max-sizes = {flash = 2048, ram = 2048}
uses = ["rcc", "gpios", "system_flash"]
Expand Down Expand Up @@ -219,7 +219,6 @@ priority = 3
max-sizes = {flash = 16384, ram = 8192 }
stacksize = 1024
start = true
notifications = ["timer"]

[tasks.sensor_polling]
name = "task-sensor-polling"
Expand Down
5 changes: 2 additions & 3 deletions app/sidecar/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fwid = true

[kernel]
name = "sidecar"
requires = {flash = 25792, ram = 6256}
requires = {flash = 25984, ram = 6256}
features = ["dump"]

[caboose]
Expand All @@ -31,7 +31,7 @@ request_reset = ["hiffy", "control_plane_agent"]

[tasks.sys]
name = "drv-stm32xx-sys"
features = ["h753"]
features = ["h753", "no-panic"]
priority = 1
max-sizes = {flash = 2048, ram = 2048}
uses = ["rcc", "gpios", "system_flash"]
Expand Down Expand Up @@ -184,7 +184,6 @@ priority = 4
max-sizes = {flash = 16384, ram = 8192 }
stacksize = 1024
start = true
notifications = ["timer"]

[tasks.ecp5_mainboard]
name = "drv-fpga-server"
Expand Down
1 change: 1 addition & 0 deletions build/i2c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ convert_case = { workspace = true }
indexmap = { workspace = true }
multimap = { workspace = true }
serde = { workspace = true }
rangemap.workspace = true

[features]
h743 = []
Expand Down
84 changes: 38 additions & 46 deletions build/i2c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use anyhow::{bail, Context, Result};
use convert_case::{Case, Casing};
use indexmap::IndexMap;
use multimap::MultiMap;
use rangemap::RangeSet;
use serde::Deserialize;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::fmt::Write;
Expand Down Expand Up @@ -269,21 +270,6 @@ struct DeviceRefdesKey {
kind: Sensor,
}

#[derive(Debug, PartialEq, Eq, Hash)]
struct DeviceBusKey {
device: String,
bus: String,
kind: Sensor,
}

#[derive(Debug, PartialEq, Eq, Hash)]
struct DeviceBusNameKey {
device: String,
bus: String,
name: String,
kind: Sensor,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeviceSensor {
pub name: Option<String>,
Expand Down Expand Up @@ -573,7 +559,7 @@ impl ConfigGenerator {
d.device, d.address
);
}
(_, Some(bus)) if buses.get(bus).is_none() => {
(_, Some(bus)) if !buses.contains_key(bus) => {
panic!(
"device {} at address {:#x} specifies \
unknown bus \"{}\"",
Expand Down Expand Up @@ -1016,20 +1002,9 @@ impl ConfigGenerator {
let mut all: Vec<_> = by_controller.iter_all().collect();
all.sort();

for (controller, indices) in all {
let mut s: Vec<String> =
indices.iter().map(|f| format!("{}", f)).collect::<_>();

s.sort();

write!(
&mut self.output,
r##"
{} => Some(Controller::I2C{}),"##,
s.join("\n | "),
controller,
)?;
}
match_arms(&mut self.output, all, |c| {
format!("Some(Controller::I2C{c})")
})?;

write!(
&mut self.output,
Expand All @@ -1052,20 +1027,7 @@ impl ConfigGenerator {
let mut all: Vec<_> = by_port.iter_all().collect();
all.sort();

for (port, indices) in all {
let mut s: Vec<String> =
indices.iter().map(|f| format!("{}", f)).collect::<_>();

s.sort();

write!(
&mut self.output,
r##"
{} => Some(PortIndex({})),"##,
s.join("\n | "),
port,
)?;
}
match_arms(&mut self.output, all, |p| format!("Some(PortIndex({p}))"))?;

write!(
&mut self.output,
Expand Down Expand Up @@ -1254,7 +1216,7 @@ impl ConfigGenerator {
// returned by `device_descriptions()` below: if we change the ordering
// here, it must be updated there as well.
for (index, device) in self.devices.iter().enumerate() {
if drivers.get(&device.device).is_some() {
if drivers.contains(&device.device) {
let driver = device.device.to_case(Case::UpperCamel);
let out = self.generate_device(device, 24);

Expand Down Expand Up @@ -1471,7 +1433,7 @@ impl ConfigGenerator {
{
writeln!(
&mut self.output,
"\n #[allow(non_camel_case_types)]
"\n #[allow(non_camel_case_types, dead_code)]
pub struct Sensors_{struct_name} {{",
)?;
let mut f = |name, count| match count {
Expand Down Expand Up @@ -1770,3 +1732,33 @@ pub fn device_descriptions() -> impl Iterator<Item = I2cDeviceDescription> {
},
)
}

fn match_arms<'a, C>(
mut out: impl Write,
source: impl IntoIterator<Item = (&'a C, &'a Vec<usize>)>,
fmt: impl Fn(&C) -> String,
) -> Result<()>
where
C: 'a,
{
for (controller, indices) in source {
let indices = indices
.iter()
.map(|&i| i..i + 1)
.collect::<RangeSet<usize>>();
let s = indices
.iter()
.map(|range| format!("{}..={}", range.start, range.end - 1))
.collect::<Vec<_>>()
.join("\n | ");

let result = fmt(controller);

write!(
&mut out,
r##"
{s} => {result},"##,
)?;
}
Ok(())
}
Loading