Skip to content

Commit 77cff29

Browse files
authored
Split Grapefruit into Ruby vs standalone images (#2021)
- Splits Grapefruit into `app-dev.toml` (dev boards only) and `app-ruby.toml` (attached to Ruby) - Switch `app-dev` to using UART8, which is brought out on a connector This lets us test IPCC on a desktop, connecting to Grapefruit with a USB-to-serial cable.
1 parent 4f70a0d commit 77cff29

File tree

6 files changed

+46
-9
lines changed

6 files changed

+46
-9
lines changed

.github/workflows/build-boards.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,13 @@ jobs:
239239
app_name: donglet-g031
240240
app_toml: app/donglet/app-g031.toml
241241
image: default
242-
- build: grapefruit
243-
app_name: grapefruit
244-
app_toml: app/grapefruit/app.toml
242+
- build: grapefruit-ruby
243+
app_name: grapefruit-ruby
244+
app_toml: app/grapefruit/app-ruby.toml
245+
image: default
246+
- build: grapefruit-standalone
247+
app_name: grapefruit-standalone
248+
app_toml: app/grapefruit/app-dev.toml
245249
image: default
246250
uses: ./.github/workflows/build-one.yml
247251
with:

app/grapefruit/app-dev.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = "grapefruit-standalone"
2+
inherit = "base.toml"
3+
4+
# Host SP comms goes over a UART to J10, using USART8
5+
[tasks.host_sp_comms]
6+
features = ["uart8"]
7+
uses = ["uart8"]
8+
interrupts = {"uart8.irq" = "usart-irq"}

app/grapefruit/app-ruby.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name = "grapefruit-ruby"
2+
inherit = "base.toml"
3+
4+
# Host SP comms goes over a UART to the FPGA, which translates to eSPI messages
5+
# to the Ruby dev board.
6+
[tasks.host_sp_comms]
7+
features = ["usart6", "hardware_flow_control"]
8+
uses = ["usart6"]
9+
interrupts = {"usart6.irq" = "usart-irq"}

app/grapefruit/app.toml renamed to app/grapefruit/base.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
name = "grapefruit"
21
board = "grapefruit"
32
target = "thumbv7em-none-eabihf"
43
chip = "../../chips/stm32h7"
@@ -223,11 +222,12 @@ max-sizes = {flash = 16384, ram = 8192 }
223222
stacksize = 1024
224223
start = true
225224

225+
# Note that host_sp_comms does not specify a UART! It must be fully specified
226+
# with features + uses + interrupts by manifests inheriting from this file.
226227
[tasks.host_sp_comms]
227228
name = "task-host-sp-comms"
228-
features = ["stm32h753", "usart6", "baud_rate_3M", "hardware_flow_control", "vlan", "grapefruit"]
229-
uses = ["usart6", "dbgmcu"]
230-
interrupts = {"usart6.irq" = "usart-irq"}
229+
features = ["stm32h753", "baud_rate_3M", "vlan", "grapefruit"]
230+
uses = ["dbgmcu"]
231231
priority = 8
232232
max-sizes = {flash = 65536, ram = 65536}
233233
stacksize = 5080

task/host-sp-comms/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ stm32h743 = ["drv-stm32h7-usart/h743", "drv-stm32xx-sys-api/h743", "drv-stm32h7-
5757
stm32h753 = ["drv-stm32h7-usart/h753", "drv-stm32xx-sys-api/h753", "drv-stm32h7-dbgmcu/h753"]
5858
usart6 = []
5959
uart7 = []
60+
uart8 = []
6061
baud_rate_3M = []
6162
hardware_flow_control = []
6263
vlan = ["task-net-api/vlan"]

task/host-sp-comms/src/main.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,7 @@ fn configure_uart_device(sys: &sys_api::Sys) -> Usart {
15471547
#[cfg(feature = "baud_rate_3M")]
15481548
const BAUD_RATE: u32 = 3_000_000;
15491549

1550-
#[cfg(feature = "hardware_flow_control")]
1551-
let hardware_flow_control = true;
1550+
let hardware_flow_control = cfg!(feature = "hardware_flow_control");
15521551

15531552
cfg_if::cfg_if! {
15541553
if #[cfg(feature = "uart7")] {
@@ -1583,6 +1582,22 @@ fn configure_uart_device(sys: &sys_api::Sys) -> Usart {
15831582
let usart = unsafe { &*device::USART6::ptr() };
15841583
let peripheral = Peripheral::Usart6;
15851584
let pins = PINS;
1585+
} else if #[cfg(feature = "uart8")] {
1586+
const PINS: &[(PinSet, Alternate)] = {
1587+
cfg_if::cfg_if! {
1588+
if #[cfg(feature = "hardware_flow_control")] {
1589+
compile_error!("hardware_flow_control should be disabled");
1590+
} else {
1591+
&[(
1592+
Port::J.pin(8).and_pin(9),
1593+
Alternate::AF8
1594+
)]
1595+
}
1596+
}
1597+
};
1598+
let usart = unsafe { &*device::UART8::ptr() };
1599+
let peripheral = Peripheral::Uart8;
1600+
let pins = PINS;
15861601
} else {
15871602
compile_error!("no usartX/uartX feature specified");
15881603
}

0 commit comments

Comments
 (0)