Skip to content

Commit a95aaa3

Browse files
authored
Merge pull request #93 from Neotron-Compute/release/v0.8.0
Release/v0.8.0
2 parents a87d17e + 939df1b commit a95aaa3

File tree

16 files changed

+459
-253
lines changed

16 files changed

+459
-253
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
submodules: true
1414
- name: Add Tool

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
submodules: true
1414

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Change Log
22

3-
## Unreleased changes ([Source](https://github.com/neotron-compute/neotron-os/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-os/compare/v0.7.1...develop))
3+
## Unreleased changes ([Source](https://github.com/neotron-compute/neotron-os/tree/develop) | [Changes](https://github.com/neotron-compute/neotron-os/compare/v0.8.0...develop))
44

55
* None
66

7+
## v0.8.0 - 2024-04-11 ([Source](https://github.com/neotron-compute/neotron-os/tree/v0.8.0) | [Release](https://github.com/neotron-compute/neotron-os/releases/tag/v0.8.0))
8+
9+
* Added a global `FILESYSTEM` object
10+
* Updated to embedded-sdmmc 0.7
11+
* Updated to Neotron Common BIOS 0.12
12+
* Add a bitmap viewer command - `gfx`
13+
* Treat text buffer as 32-bit values
14+
715
## v0.7.1 - 2023-10-21 ([Source](https://github.com/neotron-compute/neotron-os/tree/v0.7.1) | [Release](https://github.com/neotron-compute/neotron-os/releases/tag/v0.7.1))
816

917
* Update `Cargo.lock` so build string no longer shows build as *dirty*

Cargo.lock

Lines changed: 7 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "neotron-os"
3-
version = "0.7.1"
3+
version = "0.8.0"
44
authors = [
55
"Jonathan 'theJPster' Pallant <github@thejpster.org.uk>",
66
"The Neotron Developers"
@@ -41,17 +41,17 @@ panic = "abort"
4141
panic = "abort"
4242

4343
[dependencies]
44-
neotron-common-bios = "0.11.1"
45-
pc-keyboard = "0.7"
46-
r0 = "1.0"
44+
chrono = { version = "0.4", default-features = false }
45+
embedded-sdmmc = { version = "0.7", default-features = false }
4746
heapless = "0.7"
48-
postcard = "1.0"
49-
serde = { version = "1.0", default-features = false }
5047
menu = "0.3"
51-
chrono = { version = "0.4", default-features = false }
52-
embedded-sdmmc = { version = "0.6", default-features = false }
5348
neotron-api = "0.1"
49+
neotron-common-bios = "0.12.0"
5450
neotron-loader = "0.1"
51+
pc-keyboard = "0.7"
52+
postcard = "1.0"
53+
r0 = "1.0"
54+
serde = { version = "1.0", default-features = false }
5555
vte = "0.12"
5656

5757
[features]

build.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
RELEASE_DIR=./release
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
RELEASE_DIR=${SCRIPT_DIR}/release
68

79
mkdir -p ${RELEASE_DIR}
810

@@ -11,15 +13,15 @@ for TARGET_ARCH in thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi; do
1113
echo "TARGET is ${TARGET_ARCH}"
1214
for BINARY in flash0002 flash0802 flash1002; do
1315
echo "BINARY is ${BINARY}"
14-
cargo build $* --release --target=${TARGET_ARCH} --bin ${BINARY}
16+
( cd ${SCRIPT_DIR} && cargo build $* --release --target=${TARGET_ARCH} --bin ${BINARY} )
1517
# objcopy would do the build for us first, but it doesn't have good build output
16-
rust-objcopy -O binary ./target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.bin
18+
rust-objcopy -O binary ${SCRIPT_DIR}/target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.bin
1719
# Keep the ELF file too (for debugging)
18-
cp ./target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.elf
20+
cp ${SCRIPT_DIR}/target/${TARGET_ARCH}/release/${BINARY} ${RELEASE_DIR}/${TARGET_ARCH}-${BINARY}-libneotron_os.elf
1921
done
2022
done
2123

2224
# Build the host version
2325
echo "Building HOST"
24-
cargo build --verbose --lib --release --target=x86_64-unknown-linux-gnu
25-
cp ./target/x86_64-unknown-linux-gnu/release/libneotron_os.so ${RELEASE_DIR}/x86_64-unknown-linux-gnu-libneotron_os.so
26+
( cd ${SCRIPT_DIR} && cargo build --verbose --lib --release --target=x86_64-unknown-linux-gnu )
27+
cp ${SCRIPT_DIR}/target/x86_64-unknown-linux-gnu/release/libneotron_os.so ${RELEASE_DIR}/x86_64-unknown-linux-gnu-libneotron_os.so

src/commands/fs.rs

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! File Systems related commands for Neotron OS
22
3-
use crate::{bios, osprint, osprintln, Ctx};
3+
use crate::{osprint, osprintln, Ctx, FILESYSTEM};
44

55
pub static DIR_ITEM: menu::Item<Ctx> = menu::Item {
66
item_type: menu::ItemType::Callback {
@@ -49,17 +49,11 @@ pub static TYPE_ITEM: menu::Item<Ctx> = menu::Item {
4949

5050
/// Called when the "dir" command is executed.
5151
fn dir(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _ctx: &mut Ctx) {
52-
fn work() -> Result<(), embedded_sdmmc::Error<bios::Error>> {
52+
fn work() -> Result<(), crate::fs::Error> {
5353
osprintln!("Listing files on Block Device 0, /");
54-
let bios_block = crate::fs::BiosBlock();
55-
let time = crate::fs::BiosTime();
56-
let mut mgr = embedded_sdmmc::VolumeManager::new(bios_block, time);
57-
// Open the first partition
58-
let volume = mgr.open_volume(embedded_sdmmc::VolumeIdx(0))?;
59-
let root_dir = mgr.open_root_dir(volume)?;
60-
let mut total_bytes = 0u64;
54+
let mut total_bytes = 0;
6155
let mut num_files = 0;
62-
mgr.iterate_dir(root_dir, |dir_entry| {
56+
FILESYSTEM.iterate_root_dir(|dir_entry| {
6357
let padding = 8 - dir_entry.name.base_name().len();
6458
for b in dir_entry.name.base_name() {
6559
let ch = *b as char;
@@ -124,17 +118,11 @@ fn load(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &m
124118

125119
/// Called when the "exec" command is executed.
126120
fn exec(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &mut Ctx) {
127-
fn work(ctx: &mut Ctx, filename: &str) -> Result<(), embedded_sdmmc::Error<bios::Error>> {
128-
let bios_block = crate::fs::BiosBlock();
129-
let time = crate::fs::BiosTime();
130-
let mut mgr = embedded_sdmmc::VolumeManager::new(bios_block, time);
131-
// Open the first partition
132-
let volume = mgr.open_volume(embedded_sdmmc::VolumeIdx(0))?;
133-
let root_dir = mgr.open_root_dir(volume)?;
134-
let file = mgr.open_file_in_dir(root_dir, filename, embedded_sdmmc::Mode::ReadOnly)?;
121+
fn work(ctx: &mut Ctx, filename: &str) -> Result<(), crate::fs::Error> {
122+
let file = FILESYSTEM.open_file(filename, embedded_sdmmc::Mode::ReadOnly)?;
135123
let buffer = ctx.tpa.as_slice_u8();
136-
let count = mgr.read(file, buffer)?;
137-
if count != mgr.file_length(file)? as usize {
124+
let count = file.read(buffer)?;
125+
if count != file.length() as usize {
138126
osprintln!("File too large! Max {} bytes allowed.", buffer.len());
139127
return Ok(());
140128
}
@@ -159,17 +147,11 @@ fn exec(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &m
159147

160148
/// Called when the "type" command is executed.
161149
fn typefn(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &mut Ctx) {
162-
fn work(ctx: &mut Ctx, filename: &str) -> Result<(), embedded_sdmmc::Error<bios::Error>> {
163-
let bios_block = crate::fs::BiosBlock();
164-
let time = crate::fs::BiosTime();
165-
let mut mgr = embedded_sdmmc::VolumeManager::new(bios_block, time);
166-
// Open the first partition
167-
let volume = mgr.open_volume(embedded_sdmmc::VolumeIdx(0))?;
168-
let root_dir = mgr.open_root_dir(volume)?;
169-
let file = mgr.open_file_in_dir(root_dir, filename, embedded_sdmmc::Mode::ReadOnly)?;
150+
fn work(ctx: &mut Ctx, filename: &str) -> Result<(), crate::fs::Error> {
151+
let file = FILESYSTEM.open_file(filename, embedded_sdmmc::Mode::ReadOnly)?;
170152
let buffer = ctx.tpa.as_slice_u8();
171-
let count = mgr.read(file, buffer)?;
172-
if count != mgr.file_length(file)? as usize {
153+
let count = file.read(buffer)?;
154+
if count != file.length() as usize {
173155
osprintln!("File too large! Max {} bytes allowed.", buffer.len());
174156
return Ok(());
175157
}

src/commands/hardware.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@ fn lsbus(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _ctx:
152152
osprintln!("Neotron Bus Devices:");
153153
for dev_idx in 0..=255u8 {
154154
if let bios::FfiOption::Some(device_info) = (api.bus_get_info)(dev_idx) {
155-
let kind = match device_info.kind {
156-
bios::bus::PeripheralKind::Slot => "Slot",
157-
bios::bus::PeripheralKind::SdCard => "SdCard",
158-
bios::bus::PeripheralKind::Reserved => "Reserved",
155+
let kind = match device_info.kind.make_safe() {
156+
Ok(bios::bus::PeripheralKind::Slot) => "Slot",
157+
Ok(bios::bus::PeripheralKind::SdCard) => "SdCard",
158+
Ok(bios::bus::PeripheralKind::Reserved) => "Reserved",
159+
_ => "Unknown",
159160
};
160161
osprintln!("\t{}: {} ({})", dev_idx, device_info.name, kind);
161162
found = true;
@@ -205,11 +206,12 @@ fn lsuart(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, _args: &[&str], _ctx
205206
osprintln!("UART Devices:");
206207
for dev_idx in 0..=255u8 {
207208
if let bios::FfiOption::Some(device_info) = (api.serial_get_info)(dev_idx) {
208-
let device_type = match device_info.device_type {
209-
bios::serial::DeviceType::Rs232 => "RS232",
210-
bios::serial::DeviceType::TtlUart => "TTL",
211-
bios::serial::DeviceType::UsbCdc => "USB",
212-
bios::serial::DeviceType::Midi => "MIDI",
209+
let device_type = match device_info.device_type.make_safe() {
210+
Ok(bios::serial::DeviceType::Rs232) => "RS232",
211+
Ok(bios::serial::DeviceType::TtlUart) => "TTL",
212+
Ok(bios::serial::DeviceType::UsbCdc) => "USB",
213+
Ok(bios::serial::DeviceType::Midi) => "MIDI",
214+
_ => "Unknown",
213215
};
214216
osprintln!("\t{}: {} ({})", dev_idx, device_info.name, device_type);
215217
found = true;
@@ -225,13 +227,13 @@ fn shutdown(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], _ctx
225227
let api = API.get();
226228
if let Ok(Some(_)) = menu::argument_finder(item, args, "reboot") {
227229
osprintln!("Rebooting...");
228-
(api.power_control)(bios::PowerMode::Reset);
230+
(api.power_control)(bios::PowerMode::Reset.make_ffi_safe());
229231
} else if let Ok(Some(_)) = menu::argument_finder(item, args, "bootloader") {
230232
osprintln!("Rebooting into bootloader...");
231-
(api.power_control)(bios::PowerMode::Bootloader);
233+
(api.power_control)(bios::PowerMode::Bootloader.make_ffi_safe());
232234
} else {
233235
osprintln!("Shutting down...");
234-
(api.power_control)(bios::PowerMode::Off);
236+
(api.power_control)(bios::PowerMode::Off.make_ffi_safe());
235237
}
236238
}
237239

src/commands/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub static OS_MENU: menu::Menu<Ctx> = menu::Menu {
3535
&fs::TYPE_ITEM,
3636
&screen::CLS_ITEM,
3737
&screen::MODE_ITEM,
38+
&screen::GFX_ITEM,
3839
&input::KBTEST_ITEM,
3940
&hardware::SHUTDOWN_ITEM,
4041
&sound::MIXER_ITEM,

0 commit comments

Comments
 (0)