Skip to content

Commit 7821076

Browse files
Merge pull request #5 from Neotron-Compute/pico_fixups
Pico fixups
2 parents 5dd0218 + df45700 commit 7821076

File tree

9 files changed

+34
-21
lines changed

9 files changed

+34
-21
lines changed

.gitmodules

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ codegen-units = 1
3030
opt-level = "s"
3131

3232
[dependencies]
33-
neotron-common-bios = { path = "./common" }
33+
neotron-common-bios = "0.1.0"
3434
r0 = "1.0"
3535
postcard = "0.5"
3636
serde = { version = "1.0", default-features = false }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Your BIOS should tell you which one you want and how to load it onto your system
5050

5151
## Licence
5252

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

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

build.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
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");
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+
}
522
}

common

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MEMORY
3131
}
3232

3333
/* # Entry point = what the BIOS calls to start the OS */
34-
ENTRY(entry_point);
34+
ENTRY(main);
3535
EXTERN(__RESET_VECTOR);
3636

3737
/* # Sections */
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MEMORY
3131
}
3232

3333
/* # Entry point = what the BIOS calls to start the OS */
34-
ENTRY(entry_point);
34+
ENTRY(main);
3535
EXTERN(__RESET_VECTOR);
3636

3737
/* # Sections */
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ MEMORY
3131
}
3232

3333
/* # Entry point = what the BIOS calls to start the OS */
34-
ENTRY(entry_point);
34+
ENTRY(main);
3535
EXTERN(__RESET_VECTOR);
3636

3737
/* # Sections */

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize};
1818
// ===========================================================================
1919

2020
/// The OS version string
21-
const OS_VERSION: &str = concat!("Neotron OS, version ", env!("CARGO_PKG_VERSION"), "-2");
21+
const OS_VERSION: &str = concat!("Neotron OS, version ", env!("OS_VERSION"));
2222

2323
/// We store the API object supplied by the BIOS here
2424
static mut API: Option<&'static bios::Api> = None;
@@ -275,6 +275,7 @@ unsafe fn start_up_init() {
275275

276276
/// This is the function the BIOS calls. This is because we store the address
277277
/// of this function in the ENTRY_POINT_ADDR variable.
278+
#[no_mangle]
278279
pub extern "C" fn main(api: &'static bios::Api) -> ! {
279280
unsafe {
280281
start_up_init();
@@ -284,15 +285,14 @@ pub extern "C" fn main(api: &'static bios::Api) -> ! {
284285
let config = Config::load().unwrap_or_else(|_| Config::default());
285286

286287
if config.has_vga_console() {
287-
let mut addr: *mut u8 = core::ptr::null_mut();
288-
let mut width = 0;
289-
let mut height = 0;
290-
(api.video_memory_info_get)(&mut addr, &mut width, &mut height);
291-
if !addr.is_null() {
288+
let mode = (api.video_get_mode)();
289+
let (width, height) = (mode.text_width(), mode.text_height());
290+
291+
if let (Some(width), Some(height)) = (width, height) {
292292
let mut vga = VgaConsole {
293-
addr,
294-
width,
295-
height,
293+
addr: (api.video_get_framebuffer)(),
294+
width: width as u8,
295+
height: height as u8,
296296
row: 0,
297297
col: 0,
298298
};

0 commit comments

Comments
 (0)