Skip to content

Commit f0be8ec

Browse files
Merge branch 'release/v0.1.0'
2 parents cd809c3 + 7821076 commit f0be8ec

File tree

14 files changed

+137
-84
lines changed

14 files changed

+137
-84
lines changed

.cargo/config

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
[target.thumbv7em-none-eabihf]
2-
runner = 'arm-none-eabi-gdb --command=gdb.cfg -w'
3-
41
[build]
5-
target = "thumbv7em-none-eabihf"
2+
target = "thumbv6m-none-eabi"

.gitmodules

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

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"rust-analyzer.checkOnSave.allTargets": false,
3+
"rust-analyzer.cargo.target": "thumbv6m-none-eabi"
4+
}

Cargo.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "neotron_os"
2+
name = "neotron-os"
33
version = "0.1.0"
44
authors = ["Jonathan 'theJPster' Pallant <github@thejpster.org.uk>"]
55
edition = "2018"
@@ -9,7 +9,17 @@ readme = "README.md"
99
repository = "https://github.com/neotron-compute/Neotron-OS"
1010

1111
[[bin]]
12-
name = "neotron_os"
12+
name = "flash1002"
13+
test = false
14+
bench = false
15+
16+
[[bin]]
17+
name = "flash0802"
18+
test = false
19+
bench = false
20+
21+
[[bin]]
22+
name = "flash0002"
1323
test = false
1424
bench = false
1525

@@ -20,7 +30,7 @@ codegen-units = 1
2030
opt-level = "s"
2131

2232
[dependencies]
23-
neotron-common-bios = { path = "./common" }
33+
neotron-common-bios = "0.1.0"
2434
r0 = "1.0"
2535
postcard = "0.5"
2636
serde = { version = "1.0", default-features = false }

README.md

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,58 +19,38 @@ This OS is a work in progress. We intend to support:
1919

2020
## Build instructions
2121

22-
Your board will need an appropriate Neotron BIOS installed, and you need to have OpenOCD running for your particular board. You also need to set the linker
23-
arguments so you link the binary to suit the memory available on your system.
22+
Your board will need an appropriate Neotron BIOS installed, and you need to have
23+
OpenOCD or some other programming tool running for your particular board. See
24+
your BIOS instructions for more details.
2425

25-
### Build Instructions for the Neotron Pico
26+
We compile one version of Neotron OS, but we link it three times to produce
27+
three binaries:
2628

27-
The Neotron Pico has some special memory requirements - in particular, the
28-
flash lives at `0x1000_0000` and not `0x0000_0000`. There is 1920 KiB of
29-
flash, and 240 KiB of RAM available.
29+
* `flash0002` - is linked to run from address `0x0002_0000`
30+
* `flash1002` - is linked to run from address `0x1002_0000`
31+
* `flash0802` - is linked to run from address `0x0802_0000`
3032

3133
```
3234
$ git clone https://github.com/neotron-compute/Neotron-OS.git
3335
$ cd Neotron-OS
3436
$ git submodule update --init
35-
$ RUSTFLAGS="-C link-arg=-Tneotron-os-pico.ld" cargo build --release --target=thumbv6m-none-eabi
37+
$ cargo build --release
38+
$ ls ./target/thumbv6m-none-eabi/release/flash{10,08,00}02
39+
./target/thumbv6m-none-eabi/release/flash0002 ./target/thumbv6m-none-eabi/release/flash0802 ./target/thumbv6m-none-eabi/release/flash1002
3640
```
3741

38-
### Build Instructions for 256K RAM systems
39-
40-
Systems which reserve the second 512 KiB of Flash and first 256 KiB of SRAM
41-
for the OS can use this linker script. These systems include the Neotron
42-
340ST.
43-
44-
```
45-
$ git clone https://github.com/neotron-compute/Neotron-OS.git
46-
$ cd Neotron-OS
47-
$ git submodule update --init
48-
$ RUSTFLAGS="-C link-arg=-Tneotron-os-256k.ld" cargo run --release
49-
```
50-
51-
### Build Instructions for 32K RAM systems
52-
53-
Systems which reserve the second 128 KiB of Flash and first 26 KiB of SRAM for
54-
the OS can use this linker script. These systems include the Neotron 32.
55-
56-
```
57-
$ git clone https://github.com/neotron-compute/Neotron-OS.git
58-
$ cd Neotron-OS
59-
$ git submodule update --init
60-
$ RUSTFLAGS="-C link-arg=-Tneotron-os-26k.ld" cargo run --release
61-
```
62-
63-
TODO: Think of a better way of setting the memory limits for a particular OS build.
42+
Your BIOS should tell you which one you want and how to load it onto your system.
6443

6544
## Changelog
6645

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

6948
* Basic `println!` to the text buffer.
49+
* Re-arranged linker script setup
7050

7151
## Licence
7252

73-
Neotron-OS Copyright (c) The Neotron Developers, 2020
53+
Neotron-OS Copyright (c) The Neotron Developers, 2022
7454

7555
This program is free software: you can redistribute it and/or modify
7656
it under the terms of the GNU General Public License as published by

build.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
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");
5+
6+
if let Ok(cmd_output) = std::process::Command::new("git")
7+
.arg("describe")
8+
.arg("--all")
9+
.arg("--dirty")
10+
.arg("--long")
11+
.output()
12+
{
13+
let git_version = std::str::from_utf8(&cmd_output.stdout).unwrap();
14+
println!(
15+
"cargo:rustc-env=OS_VERSION={} (git:{})",
16+
env!("CARGO_PKG_VERSION"),
17+
git_version.trim()
18+
);
19+
} else {
20+
println!("cargo:rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
21+
}
22+
}

common

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@
2121
/* Provides information about the memory layout of the device */
2222
MEMORY
2323
{
24-
/* The OS gets the top 128 KiB of Flash, leaving the first 128 KiB for the BIOS */
24+
/* The first 128 KiB is for the BIOS. We get the rest. */
2525
FLASH (rx) : ORIGIN = 0x00020000, LENGTH = 128K
26-
/* The BIOS gets the top 6 KiB of SRAM (including the Stack), leaving 26 KiB for the OS (at 0x2000_0000 to 0x2000_67FF) */
27-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 26K
26+
/*
27+
* We get the bottom 4KB of RAM. Anything above that is for applications
28+
* (up to wherever the BIOS tells us we can use.)
29+
*/
30+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
2831
}
2932

3033
/* # Entry point = what the BIOS calls to start the OS */
31-
ENTRY(entry_point);
34+
ENTRY(main);
3235
EXTERN(__RESET_VECTOR);
3336

3437
/* # Sections */
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@
2121
/* Provides information about the memory layout of the device */
2222
MEMORY
2323
{
24-
/* The BIOS gets the first 512 KiB of Flash, leaving 512 KiB for the OS */
25-
FLASH (rx) : ORIGIN = 0x08080000, LENGTH = 512K
26-
/* The BIOS gets the top 64 KiB of SRAM (including the Stack), leaving 256 KiB for the OS
27-
(at 0x2000_0000 to 0x2003_FFFF). The RAM is actually split into three banks, but we can
28-
largely ignore that.
29-
*/
30-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
31-
/* The SDRAM holds the LCD framebuffers */
24+
/* The first 128 KiB is for the BIOS. We get the rest. */
25+
FLASH (rx) : ORIGIN = 0x08020000, LENGTH = 128K
26+
/*
27+
* We get the bottom 4KB of RAM. Anything above that is for applications
28+
* (up to wherever the BIOS tells us we can use.)
29+
*/
30+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
3231
}
3332

3433
/* # Entry point = what the BIOS calls to start the OS */
35-
ENTRY(entry_point);
34+
ENTRY(main);
3635
EXTERN(__RESET_VECTOR);
3736

3837
/* # Sections */
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@
2121
/* Provides information about the memory layout of the device */
2222
MEMORY
2323
{
24-
/* The BIOS gets the first 128 KiB of Flash, leaving 1920 KiB for the OS */
25-
FLASH (rx) : ORIGIN = 0x10020000, LENGTH = 0x1E0000
24+
/* The first 128 KiB is for the BIOS. We get the rest. */
25+
FLASH (rx) : ORIGIN = 0x10020000, LENGTH = 128K
2626
/*
27-
* The RP2040 has 256 KiB of SRAM striped across four banks (for high
28-
* performance), plus a fifth bank containing another 8 KiB of RAM. The
29-
* BIOS is at the top of the high-performance RAM. We get the lower part.
27+
* We get the bottom 4KB of RAM. Anything above that is for applications
28+
* (up to wherever the BIOS tells us we can use.)
3029
*/
31-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x3C000
32-
/* The SDRAM holds the LCD framebuffers */
30+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4K
3331
}
3432

3533
/* # Entry point = what the BIOS calls to start the OS */
36-
ENTRY(entry_point);
34+
ENTRY(main);
3735
EXTERN(__RESET_VECTOR);
3836

3937
/* # Sections */

0 commit comments

Comments
 (0)