Skip to content

Commit

Permalink
Merge branch 'release/v0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster committed Aug 13, 2022
2 parents 4011af3 + 483a22d commit 4b3f7d6
Show file tree
Hide file tree
Showing 29 changed files with 1,473 additions and 826 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/build.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on: [push, pull_request]
name: Upload Release

jobs:
build:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true

- name: Add targets
run: |
rustup target add thumbv6m-none-eabi
rustup target add thumbv7em-none-eabihf
- name: Install flip-link
run: cd / && cargo install --debug flip-link

- name: Build neotron-bmc-pico for F030
run: |
cd neotron-bmc-pico
cargo build --release --verbose --target=thumbv6m-none-eabi --features=stm32f030x6
cd target/thumbv6m-none-eabi/release
mv neotron-bmc-pico neotron-bmc-pico-f030
- name: Build neotron-bmc-pico for F031
run: |
cd neotron-bmc-pico
cargo build --release --verbose --target=thumbv6m-none-eabi --features=stm32f031
cd target/thumbv6m-none-eabi/release
mv neotron-bmc-pico neotron-bmc-pico-f031
- name: Build neotron-bmc-nucleo
run: |
cd neotron-bmc-nucleo
cargo build --release --verbose --target=thumbv7em-none-eabihf
- name: Get Branch Name
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
id: branch_name
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Create Release
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.branch_name.outputs.SOURCE_TAG }}
draft: false
prerelease: false

- name: Upload files to Release
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
neotron-bmc-pico/target/thumbv6m-none-eabi/release/neotron-bmc-pico-f030
neotron-bmc-pico/target/thumbv6m-none-eabi/release/neotron-bmc-pico-f031
neotron-bmc-nucleo/target/thumbv7em-none-eabihf/release/neotron-bmc-nucleo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ jobs:
- uses: actions/checkout@v1
- name: Add Tool
run: rustup component add rustfmt
- name: Check Format
run: cargo fmt -- --check
- name: Check format neotron-bmc-pico
run: cd neotron-bmc-pico && cargo fmt -- --check
- name: Check format neotron-bmc-nucleo
run: cd neotron-bmc-nucleo && cargo fmt -- --check
43 changes: 0 additions & 43 deletions .github/workflows/release.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/target
Cargo.lock
*/target
target/
*Cargo.lock*
*/Cargo.lock
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* None

## v0.3.0
* Add STM32F030 support to neotron-bmc-pico

## v0.2.0
* Change to blink power LED when in standby
* Actually controls DC power and reset (but doesn't check the voltage rails yet)
Expand Down
76 changes: 12 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,17 @@ The NBMC appears to the main Neotron system processor as an Expansion Device. As

## Hardware Interface

The NBMC firmware is designed to run on an ST Micro STM32F0 (STM32F031K6T6) microcontroller

* 32-bit Arm Cortex-M0+ Core
* 3.3V I/O (5V tolerant)
* 32 KiB Flash
* 4 KiB SRAM
* LQFP-32 package (0.8mm pitch)


| Pin | Name | Signal | Function |
| :--- | :--- | :---------- | :------------------------------------------- |
| 02 | PF0 | BUTTON_nPWR | Power Button Input (active low) |
| 03 | PF1 | BUTTON_nRST | Reset Button Input (active low) |
| 06 | PA0 | MON_3V3 | 3.3V rail monitor Input (1.65V nominal) |
| 07 | PA1 | MON_5V | 5.0V rail monitor Input (1.65V nominal) |
| 08 | PA2 | nSYS_RESET | System Reset Output (active low) |
| 09 | PA3 | DC_ON | PSU Enable Output (active high) |
| 10 | PA4 | SPI1_nCS | SPI Chip Select Input (active low) |
| 11 | PA5 | SPI1_SCK | SPI Clock Input |
| 12 | PA6 | SPI1_CIPO | SPI Data Output |
| 13 | PA7 | SPI1_COPI | SPI Data Input |
| 14 | PB0 | LED0 | Output for Power LED |
| 15 | PB1 | LED1 | Output for Status LED |
| 18 | PA8 | IRQ_nHOST | Interrupt Output to the Host (active low) |
| 19 | PA9 | USART1_TX | UART Transmit Output |
| 20 | PA10 | USART1_RX | UART Receive Input |
| 21 | PA11 | USART1_CTS | UART Clear-to-Send Output |
| 22 | PA12 | USART1_RTS | UART Ready-to-Receive Input |
| 23 | PA13 | SWDIO | SWD Progamming Data Input |
| 24 | PA14 | SWCLK | SWD Programming Clock Input |
| 25 | PA15 | PS2_CLK0 | Keyboard Clock Input |
| 26 | PB3 | PS2_CLK1 | Mouse Clock Input |
| 27 | PB4 | PS2_DAT0 | Keyboard Data Input |
| 28 | PB5 | PS2_DAT1 | Mouse Data Input |
| 29 | PB6 | I2C1_SCL | I²C Clock |
| 30 | PB7 | I2C1_SDA | I²C Data |

Note that in the above table, the UART signals are wired as _Data Terminal Equipment (DTE)_ (i.e. like a PC, not like a Modem).

This design should also be pin-compatible with the following SoCs (although this firmware may need changes):

* STM32F042K4Tx
* STM32F042K6Tx
* STM32L071KBTx
* STM32L071KZTx
* STM32L072KZTx
* STM32L081KZTx
* STM32L082KZTx

Note that not all STM32 pins are 5V-tolerant, and the PS/2 protocol is a 5V open-collector system, so ensure that whichever part you pick has 5V-tolerant pins (marked `FT` or `FTt` in the datasheet) for the PS/2 signals. All of the parts above _should_ be OK, but they haven't been tested. Let us know if you try one!
### Neotron Pico

The NBMC firmware is designed to run on an ST Micro STM32F0 (STM32F031K6T6) microcontroller, as fitted to a [Neotron Pico](https://github.com/neotron-compute/neotron-pico).

See the [board-specific README](./neotron-bmc-pico/README.md)

### Nucleo-F401

The NBMC firmware can also run on an ST Micro STM32F4 Nucleo board.

See the [board-specific README](./neotron-bmc-nucleo/README.md)

## SPI Communications Protocol

Expand Down Expand Up @@ -346,20 +307,7 @@ TODO

## Build Requirements

1. rustup and Rust
- see https://www.rust-lang.org
2. The `thumbv6m-none-eabi` target
- run `rustup target add thumbv6m-none-eabi`
3. `probe-run`
- run `cargo install probe-run` from your `$HOME` dir (not this folder!)
4. `flip-link`
- run `cargo install flip-link` from your `$HOME` dir (not this folder!)

Then to build and flash, connect a probe supported by probe-rs (such as a SEGGER J-Link, or an ST-Link) and run:

```
$ cargo run --bin neotron-bmc --release
```
Build requirements are available for [Neotron-BMC-pico](neotron-bmc-pico/README.md) and [Neotron-BMC-nucleo](neotron-bmc-nucleo/README.md).

## Licence

Expand Down
17 changes: 17 additions & 0 deletions neotron-bmc-nucleo/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip STM32F401RETx"
rustflags = [
"-C", "linker=flip-link",
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
"-C", "link-arg=--nmagic",
]

[build]
target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7

[alias]
rb = "run --bin"
rrb = "run --release --bin"
32 changes: 32 additions & 0 deletions neotron-bmc-nucleo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
authors = ["Jonathan 'theJPster' Pallant <github@thejpster.org.uk>", "Aïssata 'Ai' Maiga <aimaiga2@gmail.com>"]
name = "neotron-bmc-nucleo"
edition = "2018"
version = "0.3.0"

[dependencies]
cortex-m = "0.7.1"
cortex-m-rt = "0.7"
defmt = "0.3.0"
defmt-rtt = "0.3.0"
cortex-m-rtic = "1.0"
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
stm32f4xx-hal = { version = "0.11", features = ["stm32f401", "rt"] }
debouncr = "0.2"
heapless= "0.7"
fugit = "0.3"

[features]
# set logging levels here
default = [
"defmt-default",
# "dependency-a/defmt-trace",
]

# do NOT modify these features
defmt-default = []
defmt-trace = []
defmt-debug = []
defmt-info = []
defmt-warn = []
defmt-error = []
60 changes: 60 additions & 0 deletions neotron-bmc-nucleo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Neotron-BMC-Nucleo

## Introduction

This folder is for the Board Management Controller (BMC) when running on an STM32F4 Nucleo board.

## Hardware Interface

The NBMC also supports running on an ST Nucleo-F401RE, for development and debugging purposes. The STM32F401RET6U MCU has:

* 32-bit Arm Cortex-M4 Core
* 3.3V I/O (5V tolerant)
* 512 KiB Flash
* 96 KiB SRAM
* LQFP64 package (10 * 10 mm)

| CPU Pin | Nucleo-64 Pin | Name | Signal | Function |
| ------- | ------------- | ---- | ----------- | ----------------------------------------- |
| 2 | CN7 23 | PC13 | BUTTON_nPWR | Power Button Input (active low) |
| 33 | CN10 16 | PB12 | BUTTON_nRST | Reset Button Input (active low) |
| 34 | CN10 30 | PB13 | MON_3V3 | 3.3V rail monitor Input (1.65V nominal) |
| 35 | CN10 28 | PB14 | MON_5V | 5.0V rail monitor Input (1.65V nominal) |
| 36 | CN10 26 | PB15 | nSYS_RESET | System Reset Output (active low) |
| 8 | CN8 6 | PC0 | DC_ON | PSU Enable Output (active high) |
| 20 | CN8 3 | PA4 | SPI1_NSS | SPI Chip Select Input (active low) ?? |
| 21 | CN5 6 | PA5 | SPI1_SCK | SPI Clock Input |
| 22 | CN5 5 | PA6 | SPI1_MISO | SPI Data Output |
| 23 | CN5 4 | PA7 | SPI1_MOSI | SPI Data Input |
| 9 | CN6 5 | PC1 | POWER_LED | Output for Power LED |
| 10 | CN7 35 | PC2 | STATUS_LED | Output for Status LED |
| 11 | CN7 37 | PC3 | IRQ_nHOST | Interrupt Output to the Host (active low) |
| 42 | CN10 21 | PA9 | USART1_TX | UART Transmit Output |
| 43 | CN10 33 | PA10 | USART1_RX | UART Receive Input |
| 44 | CN10 14 | PA11 | USART1_CTS | UART Clear-to-Send Output |
| 45 | CN10 12 | PA12 | USART1_RTS | UART Ready-to-Receive Input |
| 46 | CN7 13 | PA13 | SWDIO | SWD Progamming Data Input |
| 49 | CN7 15 | PA14 | SWCLK | SWD Programming Clock Input |
| 25 | CN10 6 | PC5 | PS2_CLK0 | Keyboard Clock Input |
| 26 | CN8 4 | PB0 | PS2_CLK1 | Mouse Clock Input |
| 27 | CN10 24 | PB1 | PS2_DAT0 | Keyboard Data Input |
| 28 | CN10 22 | PB2 | PS2_DAT1 | Mouse Data Input |
| 58 | CN10 17 | PB6 | I2C1_SCL | I²C Clock |
| 59 | CN7 21 | PB7 | I2C1_SDA | I²C Data |

## Build Requirements

1. rustup and Rust
- see https://www.rust-lang.org
2. The `thumbv7em-none-eabi` target
- run `rustup target add target=thumbv7em-none-eabi`
3. `probe-run`
- run `cargo install probe-run` from your `$HOME` dir (not this folder!)
4. `flip-link`
- run `cargo install flip-link` from your `$HOME` dir (not this folder!)

Then to build and flash, connect a probe supported by probe-rs (such as a SEGGER J-Link, or an ST-Link) and run:

```
$ cargo run --release
```
27 changes: 27 additions & 0 deletions neotron-bmc-nucleo/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//! This is the build-script for the Neotron BMC.
//!
//! It just copies the memory.x file somewhere Cargo can find it, then generates a version header.
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=memory.x");

let version_output = std::process::Command::new("git")
.current_dir(env::var_os("CARGO_MANIFEST_DIR").unwrap())
.args(&["describe", "--tags", "--all", "--dirty"])
.output()
.expect("running git-describe");
assert!(version_output.status.success());

std::fs::write(out.join("version.txt"), version_output.stdout).expect("writing version file");
}
Loading

0 comments on commit 4b3f7d6

Please sign in to comment.