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
jonathanpallant committed Mar 18, 2022
2 parents d5ef752 + 55c7b60 commit 987cbab
Show file tree
Hide file tree
Showing 16 changed files with 6,342 additions and 155 deletions.
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[target.thumbv6m-none-eabi]
# This will make a UF2 and copy it to the RP2040's Mass Storage Device bootloader
# runner = "elf2uf2-rs -d"
runner = "probe-run-rp --chip RP2040"
# This will flash over SWD with any compatible probe it finds. You need 0.3.1 or higher for RP2040 support.
runner = "probe-run --chip RP2040 --measure-stack"

rustflags = [
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
matrix:
# All code should be running on stable now
rust: [nightly, stable]
include:
# Nightly is only for reference and allowed to fail
- rust: nightly
experimental: true
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
target: thumbv6m-none-eabi

- name: Build Code
run: cargo build --release --verbose

- 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: |
target/thumbv6m-none-eabi/release/neotron-pico
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clippy

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
clippy-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
target: thumbv6m-none-eabi

- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --target=thumbv6m-none-eabi
20 changes: 12 additions & 8 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ name: Format
on: [push, pull_request]

jobs:
check:

format-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Add Tool
run: rustup component add rustfmt
- name: Check Format
run: cargo fmt -- --check
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt

- name: Check Format
run: cargo fmt -- --check
45 changes: 0 additions & 45 deletions .github/workflows/release.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Changelog

## Unreleased Changes ([Source](https://github.com/neotron-compute/neotron-pico-bios/tree/master) | [Changes](https://github.com/neotron-compute/neotron-pico-bios/compare/v0.1.0...master))
## Unreleased Changes ([Source](https://github.com/neotron-compute/neotron-pico-bios/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-pico-bios/compare/v0.3.0...develop))

* None

## v0.3.0 ([Source](https://github.com/neotron-compute/neotron-pico-bios/tree/v0.3.0) | [Release](https://github.com/neotron-compute/neotron-pico-bios/release/tag/v0.3.0))

* Boots OS 0.1.0
* VGA 80x30 text mode (640x480 @ 60Hz)
* Update defmt and other crates

## v0.2.0 ([Source](https://github.com/neotron-compute/neotron-pico-bios/tree/v0.2.0) | [Release](https://github.com/neotron-compute/neotron-pico-bios/release/tag/v0.2.0))

* Add RTT debugging using defmt
Expand Down
25 changes: 14 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
[package]
authors = ["Jonathan 'theJPster' Pallant <[email protected]>"]
edition = "2018"
resolver = "2"
readme = "README.md"
license = "GPL-3.0-or-later"
name = "neotron-pico-bios"
version = "0.2.0"
version = "0.3.0"

[dependencies]
# Useful Cortex-M specific functions (e.g. SysTick)
cortex-m = "0.7.3"
cortex-m = "0.7"
# The Raspberry Pi Pico HAL
pico = { git = "https://github.com/rp-rs/rp-hal.git" }
rp-pico = "0.3"
# Cortex-M run-time (or start-up) code
cortex-m-rt = "0.6.14"
# The BIOS API we export to the OS
neotron-common-bios = { git = "https://github.com/Neotron-Compute/Neotron-Common-BIOS.git" }
cortex-m-rt = "0.7"
# The BIOS to OS API
neotron-common-bios = "0.1.0"
# For time keeping/handling
embedded-time = "0.12"
# For the RP2040 bootloader
rp2040-boot2 = "0.1"
rp2040-boot2 = "0.2"
# For hardware abstraction traits
embedded-hal ="0.2"
# Gives us formatted PC-side logging
defmt = "0.2"
defmt = "0.3"
# Sends defmt logs to the SWD debugger
defmt-rtt = "0.2"
defmt-rtt = "0.3"
# Send panics to the debugger
panic-probe = "0.2"
# Fetches the BIOS version from git
git-version = "0.3"
# RP2040 PIO assembler
pio = "0.2"
# Macros for RP2040 PIO assembler
pio-proc = "0.2"

[features]
default = [
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,27 @@ The Neotron BIOS uses the [defmt](https://crates.io/crates/defmt) crate to provi

2. Flash your *Debugger* Pico with https://github.com/majbthrd/DapperMime firmware (e.g. by copying the UF2 file to the USB Mass Storage device)

3. On your PC, install *probe-rs-rp* from the RP2040-specific [probe-run](https://github.com/knurling-rs/probe-run) fork at https://github.com/rp-rs/probe-run.
3. On your PC, install [*probe-rs*](https://github.com/knurling-rs/probe-run), the programming tool from [Ferrous System's](https://www.ferrous-systems.com) [Knurling Project](https://github.com/knurling).

```console
user@host ~ $ cargo install probe-rs-rp
user@host ~ $ cargo install probe-rs
```

4. Power on your Neotron Pico.

5. Build and load the Neotron BIOS, and view the debug output stream, with `cargo run`:
5. Build the Neotron OS

We use the "neotron-os-pico.ld" linker script to link it at `0x1002_0000`.

```console
user@host ~/neotron-os $ cargo build --release
user@host ~/neotron-os $ arm-none-eabi-objcopy -O binary ./target/thumbv6m-none-eabi/release/flash1002 ../neotron-pico-bios/src/flash1002.bin
```

6. Build and load the Neotron BIOS, and view the debug output stream, with `cargo run --release`:

```console
user@host ~/neotron-pico-bios $ cargo run --release
user@host ~/neotron-pico-bios $ DEFMT_LOG=debug cargo run --release
Compiling neotron-pico-bios v0.1.0 (/home/jonathan/Documents/neotron/neotron-pico-bios)
Finished release [optimized + debuginfo] target(s) in 0.76s
Running `probe-run-rp --chip RP2040 target/thumbv6m-none-eabi/release/neotron-pico-bios`
Expand All @@ -75,6 +84,8 @@ user@host ~/neotron-pico-bios $ cargo run --release
└─ neotron_pico_bios::__cortex_m_rt_main @ src/main.rs:128
```

You should see your Neotron Pico boot, both over RTT in the `probe-run` output, and also on the VGA output.

## Changelog

See [CHANGELOG.md](./CHANGELOG.md)
Expand Down
18 changes: 18 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,22 @@ fn main() {
// here, we ensure the build script is only re-run when
// `memory.x` is changed.
println!("cargo:rerun-if-changed=memory.x");

// Get git version
if let Ok(cmd_output) = std::process::Command::new("git")
.arg("describe")
.arg("--all")
.arg("--dirty")
.arg("--long")
.output()
{
let git_version = std::str::from_utf8(&cmd_output.stdout).unwrap();
println!(
"cargo:rustc-env=BIOS_VERSION={} (git:{})",
env!("CARGO_PKG_VERSION"),
git_version.trim()
);
} else {
println!("cargo:rustc-env=BIOS_VERSION={}", env!("CARGO_PKG_VERSION"));
}
}
47 changes: 39 additions & 8 deletions memory.x
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,59 @@ MEMORY {
/*
* This is the remainder of the 2048 KiB flash chip.
*/
FLASH_OS: ORIGIN = 0x10020000, LENGTH = 2048K - 128K
FLASH_OS : ORIGIN = 0x10020000, LENGTH = 2048K - 128K
/*
* This is the internal SRAM in the RP2040.
* This is the bottom of the four striped banks of SRAM in the RP2040.
*/
RAM : ORIGIN = 0x20000000, LENGTH = 256K
RAM_OS : ORIGIN = 0x20000000, LENGTH = 0x3C000
/*
* This is the top of the four striped banks of SRAM in the RP2040.
*/
RAM : ORIGIN = 0x2003C000, LENGTH = 16K
/*
* This is the fifth bank, a 4KB block. We use this for Core 0 Stack.
*/
RAM_CORE0_STACK : ORIGIN = 0x20040000, LENGTH = 4K
/*
* This is the sixth bank, a 4KB block. We use this for Core 1 Stack.
*/
RAM_CORE1_STACK : ORIGIN = 0x20041000, LENGTH = 4K
}
/* This is where the call stack will be allocated. */
/* The stack is of the full descending type. */
/* You may want to use this variable to locate the call stack and static
variables in different memory regions. Below is shown the default value */
_stack_start = ORIGIN(RAM) + LENGTH(RAM);

/*
* This is where the call stack for Core 0 will be located. The stack is of
* the full descending type. You may want to use this variable to locate the
* call stack and static variables in different memory regions. Below is
* shown the default value
*/
_stack_start = ORIGIN(RAM_CORE0_STACK) + LENGTH(RAM_CORE0_STACK);

/*
* This is where the call stack for Core 1 will be located.
*/
_core1_stack_bottom = ORIGIN(RAM_CORE1_STACK);
_core1_stack_len = LENGTH(RAM_CORE1_STACK);

/*
* Export some symbols to tell the BIOS where it might find the OS.
*/
_flash_os_start = ORIGIN(FLASH_OS);
_flash_os_len = LENGTH(FLASH_OS);
_ram_os_start = ORIGIN(RAM_OS);
_ram_os_len = LENGTH(RAM_OS);

SECTIONS {
/* ### RP2040 Boot loader */
.boot2 ORIGIN(BOOT2) :
{
KEEP(*(.boot2));
} > BOOT2

/* ### Neotron OS */
.flash_os ORIGIN(FLASH_OS) :
{
KEEP(*(.flash_os));
} > FLASH_OS
} INSERT BEFORE .text;


Binary file added src/flash1002.bin
Binary file not shown.
Loading

0 comments on commit 987cbab

Please sign in to comment.