Skip to content

Commit 5dd0218

Browse files
Merge pull request #4 from Neotron-Compute/updated_build_variants
Clean up build variants.
2 parents cd809c3 + 31cb240 commit 5dd0218

File tree

12 files changed

+107
-67
lines changed

12 files changed

+107
-67
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"

.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: 12 additions & 2 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

README.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,34 @@ 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

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1000.ld");
3+
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0800.ld");
4+
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0000.ld");
5+
}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
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 */
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
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 */
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
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 */

src/bin/flash0002.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Binary Neotron OS Image
2+
//!
3+
//! This is for Flash Addresses that start at `0x0002_0000`.
4+
//!
5+
//! Copyright (c) The Neotron Developers, 2022
6+
//!
7+
//! Licence: GPL v3 or higher (see ../LICENCE.md)
8+
9+
#![no_std]
10+
#![no_main]
11+
12+
/// This tells the BIOS how to start the OS. This must be the first four bytes
13+
/// of our portion of Flash.
14+
#[link_section = ".entry_point"]
15+
#[used]
16+
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
17+
neotron_os::main;

src/bin/flash0802.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Binary Neotron OS Image
2+
//!
3+
//! This is for Flash Addresses that start at `0x0802_0000`.
4+
//!
5+
//! Copyright (c) The Neotron Developers, 2022
6+
//!
7+
//! Licence: GPL v3 or higher (see ../LICENCE.md)
8+
9+
#![no_std]
10+
#![no_main]
11+
12+
/// This tells the BIOS how to start the OS. This must be the first four bytes
13+
/// of our portion of Flash.
14+
#[link_section = ".entry_point"]
15+
#[used]
16+
pub static ENTRY_POINT_ADDR: extern "C" fn(&'static neotron_common_bios::Api) -> ! =
17+
neotron_os::main;

0 commit comments

Comments
 (0)