Skip to content

Commit 6b75981

Browse files
committed
Initial commit
0 parents  commit 6b75981

9 files changed

Lines changed: 886 additions & 0 deletions

File tree

.cargo/config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[target.thumbv7em-none-eabihf]
2+
runner = 'gdb-multiarch'
3+
rustflags = [
4+
"-C", "link-arg=-Tmemory.x",
5+
]
6+
[build]
7+
target = "thumbv7em-none-eabihf"

.github/workflows/format.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Format
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check:
7+
8+
runs-on: ubuntu-latest
9+
10+
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

.github/workflows/rust.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Add Target
13+
run: rustup target add thumbv7em-none-eabi
14+
- name: Build
15+
run: cargo build --verbose --target=thumbv7em-none-eabi

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
5+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
6+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
7+
Cargo.lock
8+
9+
# These are backup files generated by rustfmt
10+
**/*.rs.bk

Cargo.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "neotron-xxx-bios"
3+
version = "0.1.0"
4+
authors = ["Some Developer <some.developer@example.com>"]
5+
edition = "2018"
6+
readme = "README.md"
7+
8+
[dependencies]
9+
cortex-m = "0.6.0"
10+
cortex-m-rt = "0.6.10"
11+
panic-halt = "0.2.0"
12+
# TODO add more dependencies here, like the BIOS API crate
13+
14+
# Lets you use cargo-fix
15+
[[bin]]
16+
name = "neotron-xxx-bios"
17+
test = false
18+
bench = false
19+
20+
[profile.release]
21+
codegen-units = 1 # better optimizations
22+
debug = true # symbols are nice and they don't increase the size on Flash
23+
lto = true # better optimizations

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Neotron-XXX-BIOS
2+
3+
> Template repository for new BIOS implementations. You should delete these
4+
> quoted blocks and correct the rest of the text as required.
5+
6+
This is the [Neotron](https://github.com/neotron-compute) BIOS for the FooBar XYZ development board.
7+
8+
![Build Status](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/workflows/Build/badge.svg "Github Action Build Status")
9+
10+
![Format Status](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/workflows/Format/badge.svg "Github Action Format Check Status")
11+
12+
## Compatibility
13+
14+
This BIOS will run on the official FooBar XYZ Developer Kit, and also the FooBar XYZ Explorer board. Both feature the same FooBar XYZ SoC. Other boards with the same SoC can be supported with a minor change to the pin configurations.
15+
16+
## Features
17+
18+
> Replace this with the specs of your board!
19+
20+
The FooBar XYZ Developer Kit offers:
21+
22+
* 128 KiB RAM
23+
* 512 KiB Flash
24+
* Cortex-M4 clocked at 64 MHz
25+
* SD/MMC Slot, with DMA
26+
* 3-wire TTL UART
27+
* Hardware accelerated graphics blitter
28+
* 8-colour VGA output on pins P0, P1, P2, P4 and P5.
29+
* Stereo sound on the on-board 3.5mm jack
30+
31+
The FooBar XYZ Explorer Board adds:
32+
33+
* On-board LCD with 480x272 resolution (60x17 text mode) in 16 colours
34+
* RS-232 port
35+
36+
## Changelog
37+
38+
> Your repo should implement a Changelog in this format. Add a new section
39+
> every time you tag a release. Don't forget to change `$GITHUB_USERNAME` and
40+
> `$GITHUB_REPO` to the appropriate values for your repository!
41+
42+
### Unreleased Changes ([Source](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/tree/master) | [Changes](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/compare/v0.2.0...master))
43+
44+
* None
45+
46+
### v0.2.0 ([Source](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/tree/v0.2.0) | [Changes](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/compare/v0.1.0...v0.2.0))
47+
48+
* Fixed changelog in README.
49+
50+
### v0.1.0 ([Source](https://github.com/$GITHUB_USERNAME/$GITHUB_REPO/tree/v0.1.0))
51+
52+
* First release
53+
54+
## Licence
55+
56+
> This is an example licence. You can change it if you so desire, but please
57+
> do pay attention to the licenses of any components you use in your BIOS.
58+
59+
Neotron-XXX-BIOS Copyright (c) Some Developer, 2019
60+
61+
This program is free software: you can redistribute it and/or modify
62+
it under the terms of the GNU General Public License as published by
63+
the Free Software Foundation, either version 3 of the License, or
64+
(at your option) any later version.
65+
66+
This program is distributed in the hope that it will be useful,
67+
but WITHOUT ANY WARRANTY; without even the implied warranty of
68+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69+
GNU General Public License for more details.
70+
71+
You should have received a copy of the GNU General Public License
72+
along with this program. If not, see <https://www.gnu.org/licenses/>.
73+
74+
## Contribution
75+
76+
Unless you explicitly state otherwise, any contribution intentionally
77+
submitted for inclusion in the work by you shall be licensed as above, without
78+
any additional terms or conditions.

memory.x

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MEMORY
2+
{
3+
/* NOTE 1 K = 1 KiBi = 1024 bytes */
4+
/* TODO Adjust these memory regions to match your device memory layout */
5+
FLASH : ORIGIN = 0x00000000, LENGTH = 512K
6+
RAM : ORIGIN = 0x20000000, LENGTH = 128K
7+
}

src/main.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
//! # Neotron XXX BIOS
2+
//!
3+
//! This is the BIOS for the Neotron XXX.
4+
5+
#![no_std]
6+
#![no_main]
7+
8+
// Make sure we halt the CPU on panic
9+
extern crate panic_halt;
10+
11+
use core::fmt::Write;
12+
use cortex_m_rt::entry;
13+
14+
/// BIOS Version
15+
static BIOS_VERSION: &'static str = "v0.1.0";
16+
17+
/// Describes the hardware in the system
18+
struct Hardware {
19+
_cp: cortex_m::Peripherals,
20+
// Add your CPU specific hardware here
21+
}
22+
23+
/// Entry point for the BIOS. This is called by the startup code.
24+
#[entry]
25+
fn main() -> ! {
26+
// Set up the hardware
27+
let mut h = hardware_setup();
28+
29+
// Print the BIOS version
30+
writeln!(h, "Neotron XXX BIOS {}", BIOS_VERSION).unwrap();
31+
writeln!(h, "Finding OS...").unwrap();
32+
33+
// Here is where we find the OS and jump to it. We might:
34+
// * load it from the first sector of an SD card,
35+
// * search in Flash for it, or
36+
// * jump to a specific location in Flash.
37+
38+
// Uh-oh - tell the user a bad thing happened
39+
panic!("No operating system found.");
40+
}
41+
42+
/// Configure the hardware
43+
fn hardware_setup() -> Hardware {
44+
Hardware {
45+
_cp: cortex_m::Peripherals::take().expect("Couldn't get hardware"),
46+
}
47+
}
48+
49+
impl core::fmt::Write for Hardware {
50+
fn write_str(&mut self, _msg: &str) -> core::fmt::Result {
51+
// Write _msg to the screen, converting to the video character set as
52+
// required.
53+
Ok(())
54+
}
55+
}
56+
57+
// End of file

0 commit comments

Comments
 (0)