Skip to content

Commit b275a18

Browse files
committed
Merge branch 'release/v0.2.0'
2 parents f0be8ec + cba3cdc commit b275a18

File tree

15 files changed

+1233
-211
lines changed

15 files changed

+1233
-211
lines changed

.cargo/config

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

.github/workflows/rust.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,46 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
7+
name: Build (and Release)
88
runs-on: ubuntu-latest
9-
109
steps:
11-
- name: Checkout
12-
uses: actions/checkout@v1
13-
with:
14-
submodules: true
15-
- name: Add Target
16-
run: rustup target add thumbv7em-none-eabi
17-
- name: Build
18-
run: cargo build --verbose --target=thumbv7em-none-eabi
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
submodules: true
14+
- name: Check Syntax
15+
run: |
16+
cargo check
17+
- name: Install Targets and Tools
18+
run: |
19+
rustup target add thumbv7em-none-eabi
20+
rustup target add thumbv7m-none-eabi
21+
rustup target add thumbv6m-none-eabi
22+
rustup component add llvm-tools-preview
23+
cargo install cargo-binutils
24+
- name: Build
25+
run: ./build.sh
26+
- name: Upload files to Release
27+
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
files: |
31+
./release/thumbv6m-none-eabi-flash0002-libneotron_os.bin
32+
./release/thumbv6m-none-eabi-flash0002-libneotron_os.elf
33+
./release/thumbv6m-none-eabi-flash0802-libneotron_os.bin
34+
./release/thumbv6m-none-eabi-flash0802-libneotron_os.elf
35+
./release/thumbv6m-none-eabi-flash1002-libneotron_os.bin
36+
./release/thumbv6m-none-eabi-flash1002-libneotron_os.elf
37+
./release/thumbv7em-none-eabi-flash0002-libneotron_os.bin
38+
./release/thumbv7em-none-eabi-flash0002-libneotron_os.elf
39+
./release/thumbv7em-none-eabi-flash0802-libneotron_os.bin
40+
./release/thumbv7em-none-eabi-flash0802-libneotron_os.elf
41+
./release/thumbv7em-none-eabi-flash1002-libneotron_os.bin
42+
./release/thumbv7em-none-eabi-flash1002-libneotron_os.elf
43+
./release/thumbv7m-none-eabi-flash0002-libneotron_os.bin
44+
./release/thumbv7m-none-eabi-flash0002-libneotron_os.elf
45+
./release/thumbv7m-none-eabi-flash0802-libneotron_os.bin
46+
./release/thumbv7m-none-eabi-flash0802-libneotron_os.elf
47+
./release/thumbv7m-none-eabi-flash1002-libneotron_os.bin
48+
./release/thumbv7m-none-eabi-flash1002-libneotron_os.elf
49+
./release/x86_64-unknown-linux-gnu-libneotron_os.so

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
**/*.rs.bk
33
Cargo.lock
4+
/release

CHANGELOG.MD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
## v0.2.0
4+
5+
Adds HID support and basic shell, with 'mem' and 'fill' commands.
6+
7+
## v0.1.0
8+
9+
First version.

Cargo.toml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "neotron-os"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["Jonathan 'theJPster' Pallant <github@thejpster.org.uk>"]
55
edition = "2018"
66
description = "The Neotron Operating System"
@@ -23,14 +23,22 @@ name = "flash0002"
2323
test = false
2424
bench = false
2525

26+
[lib]
27+
crate-type = ["rlib", "cdylib"]
28+
2629
[profile.release]
2730
lto = true
2831
debug = true
2932
codegen-units = 1
3033
opt-level = "s"
34+
panic = "abort"
35+
36+
[profile.dev]
37+
panic = "abort"
3138

3239
[dependencies]
33-
neotron-common-bios = "0.1.0"
40+
neotron-common-bios = "0.7"
3441
r0 = "1.0"
3542
postcard = "0.5"
3643
serde = { version = "1.0", default-features = false }
44+
menu = "0.3"

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Neotron OS
22

3-
This is the Neotron OS. It will run on any system which can execute ARM Thumb v7-M instructions, and has an implementation of the [Neotron BIOS](https://github.com/neotron-compute/Neotron-BIOS).
3+
This is the Neotron OS. It will run on any system which has an implementation
4+
of the [Neotron BIOS](https://github.com/neotron-compute/Neotron-Common-BIOS).
45

56
## Status
67

@@ -24,23 +25,30 @@ OpenOCD or some other programming tool running for your particular board. See
2425
your BIOS instructions for more details.
2526

2627
We compile one version of Neotron OS, but we link it three times to produce
27-
three binaries:
28+
three different binaries:
2829

2930
* `flash0002` - is linked to run from address `0x0002_0000`
3031
* `flash1002` - is linked to run from address `0x1002_0000`
3132
* `flash0802` - is linked to run from address `0x0802_0000`
3233

33-
```
34+
```console
3435
$ git clone https://github.com/neotron-compute/Neotron-OS.git
3536
$ cd Neotron-OS
36-
$ git submodule update --init
37-
$ cargo build --release
38-
$ ls ./target/thumbv6m-none-eabi/release/flash{10,08,00}02
37+
$ cargo build --target thumbv6m-none-eabi --release --bins
38+
$ ls ./target/thumbv6m-none-eabi/release/flash*02
3939
./target/thumbv6m-none-eabi/release/flash0002 ./target/thumbv6m-none-eabi/release/flash0802 ./target/thumbv6m-none-eabi/release/flash1002
4040
```
4141

4242
Your BIOS should tell you which one you want and how to load it onto your system.
4343

44+
You can also build a *shared object* to load into a Windows/Linux/macOS application.
45+
46+
```console
47+
$ cargo build --lib
48+
$ ls ./target/debug/*.so
49+
./target/debug/libneotron_os.so
50+
```
51+
4452
## Changelog
4553

4654
### Unreleased Changes ([Source](https://github.com/neotron-compute/Neotron-OS/tree/master))

build.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
use std::env;
12
fn main() {
2-
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
3-
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
4-
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
3+
if let Ok("none") = env::var("CARGO_CFG_TARGET_OS").as_deref() {
4+
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
5+
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
6+
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
7+
}
58

69
if let Ok(cmd_output) = std::process::Command::new("git")
710
.arg("describe")
@@ -19,4 +22,7 @@ fn main() {
1922
} else {
2023
println!("cargo:rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
2124
}
25+
26+
#[cfg(target_os = "macos")]
27+
println!("cargo:rustc-link-lib=c");
2228
}

build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
RELEASE_DIR=./release
6+
7+
mkdir -p ${RELEASE_DIR}
8+
9+
# Build the embedded binaries for each core type and each flash layout
10+
for TARGET_ARCH in thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi; do
11+
for BINARY in flash0002 flash0802 flash1002; do
12+
# objcopy will do the build for us first
13+
cargo objcopy --verbose --release --target=${TARGET_ARCH} --bin ${BINARY} -- -O binary ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.bin
14+
# Keep the ELF file too (for debugging)
15+
cp ./target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.elf
16+
done
17+
done
18+
19+
# Build the host version
20+
cargo build --verbose --lib --release --target=x86_64-unknown-linux-gnu
21+
cp ./target/x86_64-unknown-linux-gnu/release/libneotron_os.so ${RELEASE_DIR}/x86_64-unknown-linux-gnu-libneotron_os.so

src/bin/flash0002.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
/// of our portion of Flash.
1414
#[link_section = ".entry_point"]
1515
#[used]
16-
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
17-
neotron_os::main;
16+
pub static ENTRY_POINT_ADDR: extern "C" fn(*const neotron_common_bios::Api) -> ! = neotron_os::main;

src/bin/flash0802.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
/// of our portion of Flash.
1414
#[link_section = ".entry_point"]
1515
#[used]
16-
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
17-
neotron_os::main;
16+
pub static ENTRY_POINT_ADDR: extern "C" fn(*const neotron_common_bios::Api) -> ! = neotron_os::main;

0 commit comments

Comments
 (0)