Skip to content

Commit

Permalink
Add board rev for fixed LPC55 chips
Browse files Browse the repository at this point in the history
We (finally) got access to LPC55 chips that match what we expect to use
in production. Add a carrier board revision for working with those
chips.
  • Loading branch information
labbott committed Sep 6, 2022
1 parent 811aa2b commit b6431e7
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 5 deletions.
164 changes: 164 additions & 0 deletions app/rot-carrier/app-fixed-rom.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name = "rot-carrier"
target = "thumbv8m.main-none-eabihf"
board = "rot-carrier-2"
chip = "../../chips/lpc55"
stacksize = 1024
secure-separation = true
image-names = ["a", "b"]

[kernel]
name = "rot-carrier"
requires = {flash = 21504, ram = 4096}
features = ["itm"]

[tasks.jefe]
name = "task-jefe"
priority = 0
max-sizes = {flash = 8192, ram = 2048}
start = true
features = ["itm"]
stacksize = 1536

[tasks.idle]
name = "task-idle"
priority = 7
max-sizes = {flash = 128, ram = 256}
stacksize = 256
start = true

[tasks.syscon_driver]
name = "drv-lpc55-syscon"
priority = 2
max-sizes = {flash = 8192, ram = 2048}
uses = ["syscon", "anactrl", "pmc"]
start = true
task-slots = ["jefe"]

[tasks.gpio_driver]
name = "drv-lpc55-gpio"
priority = 3
max-sizes = {flash = 8192, ram = 2048}
uses = ["gpio", "iocon"]
start = true
task-slots = ["syscon_driver"]

[tasks.user_leds]
name = "drv-user-leds"
features = ["lpc55"]
priority = 4
max-sizes = {flash = 8192, ram = 1024}
start = true
task-slots = ["gpio_driver"]

[tasks.usart_driver]
name = "drv-lpc55-usart"
priority = 4
max-sizes = {flash = 8192, ram = 2048}
uses = ["flexcomm0"]
start = true
interrupts = {"flexcomm0.irq" = 1}
task-slots = ["gpio_driver", "syscon_driver"]

[tasks.usart_driver.config]
pins = [
{ pin = { port = 0, pin = 29}, alt = 1},
{ pin = { port = 0, pin = 30}, alt = 1}
]

[tasks.rng_driver]
name = "drv-lpc55-rng"
priority = 3
max-sizes = {flash = 16384, ram = 4096}
uses = ["rng", "pmc"]
start = true
stacksize = 2200
task-slots = ["syscon_driver"]

[tasks.spi0_driver]
name = "drv-lpc55-spi-server"
priority = 4
max-sizes = {flash = 16384, ram = 2048}
features = ["spi0"]
uses = ["flexcomm3", "flexcomm8"]
start = true
interrupts = {"flexcomm8.hs_spi" = 1}
stacksize = 1000
task-slots = ["gpio_driver", "syscon_driver"]

[tasks.spi0_driver.config]
pins = [
# HS_SPI_MOSI = P0_26 = FUN9
{ pin = { port = 0, pin = 26}, alt = 9},
# HS_SPI_MISO = P1_3 = FUN6
{ pin = { port = 1, pin = 3}, alt = 6},
# HS_SPI_SCK = P1_2 = FUN6
{ pin = { port = 1, pin = 2}, alt = 6},
# HS_SSEL1 = P1_1 = FUN5
{ pin = { port = 1, pin = 1}, alt = 5},
]

[tasks.swd]
name = "drv-lpc55-swd"
priority = 4
max-sizes = {flash = 16384, ram = 4096}
uses = ["flexcomm3", "iocon"]
start = true
stacksize = 1000
task-slots = ["gpio_driver", "syscon_driver"]
interrupts = {"flexcomm3.irq" = 1}

[tasks.swd.config]
# MOSI = PIO0_3
# MISO = PIO0_2

# Out = MOSI on, MISO off
out_cfg = [
{ pin = { port = 0, pin = 3 }, alt = 1 },
{ pin = { port = 0, pin = 2 }, alt = 0, mode = "PullDown" },
]
# In = MISO on, MOSI off
in_cfg = [
{ pin = { port = 0, pin = 2 }, alt = 1 },
{ pin = { port = 0, pin = 3 }, alt = 0, mode = "PullDown" },
]
pins = [
# SCK
{ pin = { port = 0, pin = 6 }, alt = 1 },
# CS, not strictly necessary but handy for debugging
{ pin = {port = 0, pin = 20}, alt = 1},
]
spi_num = 3

[tasks.ping]
name = "task-ping"
features = ["uart"]
priority = 6
max-sizes = {flash = 8192, ram = 2048}
start = true
task-slots = [{peer = "pong"}, "usart_driver"]

[tasks.pong]
name = "task-pong"
priority = 5
max-sizes = {flash = 8192, ram = 1024}
start = true
task-slots = ["user_leds"]

[tasks.hiffy]
name = "task-hiffy"
priority = 5
features = ["lpc55", "gpio", "spi", "spctrl"]
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 2048
start = true
task-slots = ["gpio_driver", "swd"]

[tasks.sp_measure]
name = "task-sp-measure"
priority = 3
max-sizes = {flash = 131072, ram = 8192}
task-slots = ["swd"]
stacksize = 2048

[tasks.sp_measure.config]
binary_path = "../../target/gemini-bu/dist/final.bin"
28 changes: 28 additions & 0 deletions app/rot-carrier/stage0-fixed-rom.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name = "rot-carrier"
target = "thumbv8m.main-none-eabihf"
board = "rot-carrier-2"
chip = "../../chips/lpc55"
stacksize = 1024
secure-separation = true
image-names = ["stage0"]
external-images = ["a", "b"]

[kernel]
name = "stage0"
requires = {flash = 0x4000, ram = 4096}
features = ["tz_support"]

[tasks.idle]
name = "task-idle"
priority = 0
max-sizes = {flash = 256, ram = 256}
stacksize = 256
start = true

[signing]
priv-key = "../../support/fake_certs/fake_private_key.pem"
root-cert = "../../support/fake_certs/fake_certificate.der.crt"
enable-dice = true
dice-inc-nxp-cfg = false
dice-cust-cfg = false
dice-inc-sec-epoch = false
10 changes: 6 additions & 4 deletions build/xtask/src/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,10 @@ pub fn config(
chip_dir: &Path,
) -> anyhow::Result<Option<FlashConfig>> {
match board {
"lpcxpresso55s69" | "rot-carrier-1" | "gimlet-rot-1" => {
let chip = if board == "lpcxpresso55s69" {
"lpcxpresso55s69" | "rot-carrier-1" | "rot-carrier-2"
| "gimlet-rot-1" => {
let chip = if board == "lpcxpresso55s69" || board == "rot-carrier-2"
{
"lpc55s69"
} else {
"lpc55s28"
Expand Down Expand Up @@ -188,8 +190,8 @@ pub fn config(

pub fn chip_name(board: &str) -> anyhow::Result<&'static str> {
let b = match board {
"lpcxpresso55s69" => "LPC55S69JBD100",
"rot-carrier-1" | "gimlet-rot-1" => "LPC55S69JBD100",
"lpcxpresso55s69" | "rot-carrier-2" => "LPC55S69JBD100",
"rot-carrier-1" | "gimlet-rot-1" => "LPC55S28JBD100",
"stm32f3-discovery" => "STM32F303VCTx",
"stm32f4-discovery" => "STM32F407VGTx",
"nucleo-h743zi2" => "STM32H743ZITx",
Expand Down
2 changes: 1 addition & 1 deletion drv/user-leds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ cfg_if::cfg_if! {
// xpressoboard is active low LEDS
const LED_OFF_VAL: drv_lpc55_gpio_api::Value = drv_lpc55_gpio_api::Value::One;
const LED_ON_VAL: drv_lpc55_gpio_api::Value = drv_lpc55_gpio_api::Value::Zero;
} else if #[cfg(target_board = "rot-carrier-1")] {
} else if #[cfg(any(target_board = "rot-carrier-1", target_board = "rot-carrier-2"))] {
const LED_ZERO_PIN: drv_lpc55_gpio_api::Pin = drv_lpc55_gpio_api::Pin::PIO0_15;
const LED_ONE_PIN: drv_lpc55_gpio_api::Pin = drv_lpc55_gpio_api::Pin::PIO0_31;

Expand Down

0 comments on commit b6431e7

Please sign in to comment.