Skip to content

Commit 0bc6760

Browse files
Can boot OS v0.1.0. (#9)
* Can boot OS v0.1.0. * Clean up workflows
1 parent d0b9b90 commit 0bc6760

File tree

12 files changed

+476
-203
lines changed

12 files changed

+476
-203
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
continue-on-error: ${{ matrix.experimental || false }}
12+
strategy:
13+
matrix:
14+
# All code should be running on stable now
15+
rust: [nightly, stable]
16+
include:
17+
# Nightly is only for reference and allowed to fail
18+
- rust: nightly
19+
experimental: true
20+
steps:
21+
- name: Checkout Code
22+
uses: actions/checkout@v3
23+
with:
24+
submodules: true
25+
26+
- name: Install Rust
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
profile: minimal
30+
toolchain: ${{ matrix.rust }}
31+
override: true
32+
target: thumbv6m-none-eabi
33+
34+
- name: Build Code
35+
run: cargo build --release --verbose
36+
37+
- name: Get Branch Name
38+
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
39+
id: branch_name
40+
run: |
41+
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
42+
43+
- name: Create Release
44+
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
45+
id: create_release
46+
uses: actions/create-release@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
tag_name: ${{ github.ref }}
51+
release_name: Release ${{ steps.branch_name.outputs.SOURCE_TAG }}
52+
draft: false
53+
prerelease: false
54+
55+
- name: Upload files to Release
56+
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
files: |
60+
target/thumbv6m-none-eabi/release/neotron-pico
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/clippy.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Clippy
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
clippy-check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
15+
- name: Install Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
components: clippy
20+
target: thumbv6m-none-eabi
21+
22+
- name: Run Clippy
23+
uses: actions-rs/clippy-check@v1
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
args: --all-features --target=thumbv6m-none-eabi

.github/workflows/format.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ name: Format
33
on: [push, pull_request]
44

55
jobs:
6-
check:
7-
6+
format-check:
87
runs-on: ubuntu-latest
9-
108
steps:
11-
- uses: actions/checkout@v1
12-
- name: Add Tool
13-
run: rustup component add rustfmt
14-
- name: Check Format
15-
run: cargo fmt -- --check
9+
- name: Checkout Code
10+
uses: actions/checkout@v3
11+
12+
- name: Install Rust
13+
uses: actions-rs/toolchain@v1
14+
with:
15+
toolchain: stable
16+
components: rustfmt
17+
18+
- name: Check Format
19+
run: cargo fmt -- --check

.github/workflows/release.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/rust.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ cortex-m = "0.7"
1414
rp-pico = "0.3"
1515
# Cortex-M run-time (or start-up) code
1616
cortex-m-rt = "0.7"
17-
# The BIOS API we export to the OS
18-
neotron-common-bios = { git = "https://github.com/Neotron-Compute/Neotron-Common-BIOS.git" }
17+
# The BIOS to OS API
18+
neotron-common-bios = "0.1.0"
1919
# For time keeping/handling
2020
embedded-time = "0.12"
2121
# For the RP2040 bootloader
@@ -28,8 +28,6 @@ defmt = "0.3"
2828
defmt-rtt = "0.3"
2929
# Send panics to the debugger
3030
panic-probe = "0.2"
31-
# Fetches git hashes from git at compile time
32-
git-version = "0.3"
3331
# RP2040 PIO assembler
3432
pio = "0.2"
3533
# Macros for RP2040 PIO assembler

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@ user@host ~ $ cargo install probe-rs
5555

5656
4. Power on your Neotron Pico.
5757

58-
5. Build and load the Neotron BIOS, and view the debug output stream, with `cargo run --release`:
58+
5. Build the Neotron OS
59+
60+
We use the "neotron-os-pico.ld" linker script to link it at `0x1002_0000`.
61+
62+
```console
63+
user@host ~/neotron-os $ cargo build --release
64+
user@host ~/neotron-os $ arm-none-eabi-objcopy -O binary ./target/thumbv6m-none-eabi/release/flash1002 ../neotron-pico-bios/src/flash1002.bin
65+
```
66+
67+
6. Build and load the Neotron BIOS, and view the debug output stream, with `cargo run --release`:
5968

6069
```console
6170
user@host ~/neotron-pico-bios $ DEFMT_LOG=debug cargo run --release

build.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,22 @@ fn main() {
2828
// here, we ensure the build script is only re-run when
2929
// `memory.x` is changed.
3030
println!("cargo:rerun-if-changed=memory.x");
31+
32+
// Get git version
33+
if let Ok(cmd_output) = std::process::Command::new("git")
34+
.arg("describe")
35+
.arg("--all")
36+
.arg("--dirty")
37+
.arg("--long")
38+
.output()
39+
{
40+
let git_version = std::str::from_utf8(&cmd_output.stdout).unwrap();
41+
println!(
42+
"cargo:rustc-env=BIOS_VERSION={} (git:{})",
43+
env!("CARGO_PKG_VERSION"),
44+
git_version.trim()
45+
);
46+
} else {
47+
println!("cargo:rustc-env=BIOS_VERSION={}", env!("CARGO_PKG_VERSION"));
48+
}
3149
}

memory.x

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,12 @@ SECTIONS {
6868
{
6969
KEEP(*(.boot2));
7070
} > BOOT2
71+
72+
/* ### Neotron OS */
73+
.flash_os ORIGIN(FLASH_OS) :
74+
{
75+
KEEP(*(.flash_os));
76+
} > FLASH_OS
7177
} INSERT BEFORE .text;
78+
79+

src/flash1002.bin

18.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)