Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
thejpster committed Jan 7, 2023
2 parents f0be8ec + cba3cdc commit b275a18
Show file tree
Hide file tree
Showing 15 changed files with 1,233 additions and 211 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

51 changes: 41 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,46 @@ on: [push, pull_request]

jobs:
build:

name: Build (and Release)
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true
- name: Add Target
run: rustup target add thumbv7em-none-eabi
- name: Build
run: cargo build --verbose --target=thumbv7em-none-eabi
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Check Syntax
run: |
cargo check
- name: Install Targets and Tools
run: |
rustup target add thumbv7em-none-eabi
rustup target add thumbv7m-none-eabi
rustup target add thumbv6m-none-eabi
rustup component add llvm-tools-preview
cargo install cargo-binutils
- name: Build
run: ./build.sh
- name: Upload files to Release
if: github.event_name == 'push' && startswith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
./release/thumbv6m-none-eabi-flash0002-libneotron_os.bin
./release/thumbv6m-none-eabi-flash0002-libneotron_os.elf
./release/thumbv6m-none-eabi-flash0802-libneotron_os.bin
./release/thumbv6m-none-eabi-flash0802-libneotron_os.elf
./release/thumbv6m-none-eabi-flash1002-libneotron_os.bin
./release/thumbv6m-none-eabi-flash1002-libneotron_os.elf
./release/thumbv7em-none-eabi-flash0002-libneotron_os.bin
./release/thumbv7em-none-eabi-flash0002-libneotron_os.elf
./release/thumbv7em-none-eabi-flash0802-libneotron_os.bin
./release/thumbv7em-none-eabi-flash0802-libneotron_os.elf
./release/thumbv7em-none-eabi-flash1002-libneotron_os.bin
./release/thumbv7em-none-eabi-flash1002-libneotron_os.elf
./release/thumbv7m-none-eabi-flash0002-libneotron_os.bin
./release/thumbv7m-none-eabi-flash0002-libneotron_os.elf
./release/thumbv7m-none-eabi-flash0802-libneotron_os.bin
./release/thumbv7m-none-eabi-flash0802-libneotron_os.elf
./release/thumbv7m-none-eabi-flash1002-libneotron_os.bin
./release/thumbv7m-none-eabi-flash1002-libneotron_os.elf
./release/x86_64-unknown-linux-gnu-libneotron_os.so
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
**/*.rs.bk
Cargo.lock
/release
9 changes: 9 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

## v0.2.0

Adds HID support and basic shell, with 'mem' and 'fill' commands.

## v0.1.0

First version.
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neotron-os"
version = "0.1.0"
version = "0.2.0"
authors = ["Jonathan 'theJPster' Pallant <github@thejpster.org.uk>"]
edition = "2018"
description = "The Neotron Operating System"
Expand All @@ -23,14 +23,22 @@ name = "flash0002"
test = false
bench = false

[lib]
crate-type = ["rlib", "cdylib"]

[profile.release]
lto = true
debug = true
codegen-units = 1
opt-level = "s"
panic = "abort"

[profile.dev]
panic = "abort"

[dependencies]
neotron-common-bios = "0.1.0"
neotron-common-bios = "0.7"
r0 = "1.0"
postcard = "0.5"
serde = { version = "1.0", default-features = false }
menu = "0.3"
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Neotron OS

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).
This is the Neotron OS. It will run on any system which has an implementation
of the [Neotron BIOS](https://github.com/neotron-compute/Neotron-Common-BIOS).

## Status

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

We compile one version of Neotron OS, but we link it three times to produce
three binaries:
three different binaries:

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

```
```console
$ git clone https://github.com/neotron-compute/Neotron-OS.git
$ cd Neotron-OS
$ git submodule update --init
$ cargo build --release
$ ls ./target/thumbv6m-none-eabi/release/flash{10,08,00}02
$ cargo build --target thumbv6m-none-eabi --release --bins
$ ls ./target/thumbv6m-none-eabi/release/flash*02
./target/thumbv6m-none-eabi/release/flash0002 ./target/thumbv6m-none-eabi/release/flash0802 ./target/thumbv6m-none-eabi/release/flash1002
```

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

You can also build a *shared object* to load into a Windows/Linux/macOS application.

```console
$ cargo build --lib
$ ls ./target/debug/*.so
./target/debug/libneotron_os.so
```

## Changelog

### Unreleased Changes ([Source](https://github.com/neotron-compute/Neotron-OS/tree/master))
Expand Down
12 changes: 9 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::env;
fn main() {
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
if let Ok("none") = env::var("CARGO_CFG_TARGET_OS").as_deref() {
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
}

if let Ok(cmd_output) = std::process::Command::new("git")
.arg("describe")
Expand All @@ -19,4 +22,7 @@ fn main() {
} else {
println!("cargo:rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
}

#[cfg(target_os = "macos")]
println!("cargo:rustc-link-lib=c");
}
21 changes: 21 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -euo pipefail

RELEASE_DIR=./release

mkdir -p ${RELEASE_DIR}

# Build the embedded binaries for each core type and each flash layout
for TARGET_ARCH in thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi; do
for BINARY in flash0002 flash0802 flash1002; do
# objcopy will do the build for us first
cargo objcopy --verbose --release --target=${TARGET_ARCH} --bin ${BINARY} -- -O binary ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.bin
# Keep the ELF file too (for debugging)
cp ./target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.elf
done
done

# Build the host version
cargo build --verbose --lib --release --target=x86_64-unknown-linux-gnu
cp ./target/x86_64-unknown-linux-gnu/release/libneotron_os.so ${RELEASE_DIR}/x86_64-unknown-linux-gnu-libneotron_os.so
3 changes: 1 addition & 2 deletions src/bin/flash0002.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
/// of our portion of Flash.
#[link_section = ".entry_point"]
#[used]
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
neotron_os::main;
pub static ENTRY_POINT_ADDR: extern "C" fn(*const neotron_common_bios::Api) -> ! = neotron_os::main;
3 changes: 1 addition & 2 deletions src/bin/flash0802.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
/// of our portion of Flash.
#[link_section = ".entry_point"]
#[used]
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
neotron_os::main;
pub static ENTRY_POINT_ADDR: extern "C" fn(*const neotron_common_bios::Api) -> ! = neotron_os::main;
3 changes: 1 addition & 2 deletions src/bin/flash1002.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
/// of our portion of Flash.
#[link_section = ".entry_point"]
#[used]
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
neotron_os::main;
pub static ENTRY_POINT_ADDR: extern "C" fn(*const neotron_common_bios::Api) -> ! = neotron_os::main;

0 comments on commit b275a18

Please sign in to comment.