mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
get rid of the awful dummy arg hack and use #used directive to keep font maps in loader
This commit is contained in:
parent
d7e1959fed
commit
838fa25bad
8 changed files with 27 additions and 11 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#[allow(dead_code)]
|
||||
#[link_section=".fontdata"]
|
||||
#[no_mangle]
|
||||
#[used]
|
||||
/// Packed glyph pattern data.
|
||||
/// Record format:
|
||||
/// [offset+0]: ((w as u8) << 16) | ((h as u8) << 8) | (yOffset as u8)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#[allow(dead_code)]
|
||||
#[link_section=".fontdata"]
|
||||
#[no_mangle]
|
||||
#[used]
|
||||
/// Packed glyph pattern data.
|
||||
/// Record format:
|
||||
/// [offset+0]: ((w as u8) << 16) | ((h as u8) << 8) | (yOffset as u8)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#[allow(dead_code)]
|
||||
#[link_section=".fontdata"]
|
||||
#[no_mangle]
|
||||
#[used]
|
||||
/// Packed glyph pattern data.
|
||||
/// Record format:
|
||||
/// [offset+0]: ((w as u8) << 16) | ((h as u8) << 8) | (yOffset as u8)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#[allow(dead_code)]
|
||||
#[link_section=".fontdata"]
|
||||
#[no_mangle]
|
||||
#[used]
|
||||
/// Packed glyph pattern data.
|
||||
/// Record format:
|
||||
/// [offset+0]: ((w as u8) << 16) | ((h as u8) << 8) | (yOffset as u8)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#[allow(dead_code)]
|
||||
#[link_section=".fontdata"]
|
||||
#[no_mangle]
|
||||
#[used]
|
||||
/// Packed glyph pattern data.
|
||||
/// Record format:
|
||||
/// [offset+0]: ((w as u8) << 16) | ((h as u8) << 8) | (yOffset as u8)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,23 @@ import sys
|
|||
import re
|
||||
from collections import OrderedDict
|
||||
|
||||
"""
|
||||
This script should be run whenever the fonts are updated inside the blitstr dependency. The
|
||||
thought is that this is a rare event, and therefore it's better to run this on the rare occassions
|
||||
that this happens and vendor in the font files as references to their location in the FLASH
|
||||
memory map.
|
||||
|
||||
The main motivation for this is to disintegrate the font maps from the kernel image itself,
|
||||
as it is a large ball of static data that rarely changes, and it slows down updates and
|
||||
development. Maybe once the kernel supports servers that are bootable from disk images, we
|
||||
can do away with this methodology. But for now, this helps keep the kernel trim, and speeds
|
||||
up the development process.
|
||||
|
||||
This script is designed to be run "in-place" where it is found in the xous-core tree. It
|
||||
hard-codes the location of the graphics-server crate to encode the locations of the fonts.
|
||||
It also, by default, assumes that the `blitstr` crate is cloned into a directory at the
|
||||
same level as xous-core, but this can be changed with the `-d` command line argument.
|
||||
"""
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Build the Betrusted SoC")
|
||||
parser.add_argument(
|
||||
|
|
@ -28,6 +45,7 @@ def main():
|
|||
outfile.write("#[allow(dead_code)]\n")
|
||||
outfile.write("#[link_section=\".fontdata\"]\n")
|
||||
outfile.write("#[no_mangle]\n")
|
||||
outfile.write("#[used]\n")
|
||||
copy = False
|
||||
for line in infile:
|
||||
if line.strip() == "/// Packed glyph pattern data.":
|
||||
|
|
|
|||
|
|
@ -367,7 +367,6 @@ extern "C" {
|
|||
entrypoint: usize,
|
||||
stack: usize,
|
||||
debug: bool,
|
||||
keep: u32,
|
||||
) -> !;
|
||||
}
|
||||
|
||||
|
|
@ -1045,11 +1044,6 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
|
|||
println!(" Regular @ {:08x}", fonts::regular::DATA_REGULAR.as_ptr() as u32);
|
||||
println!(" Small @ {:08x}", fonts::small::DATA_SMALL.as_ptr() as u32);
|
||||
println!(" Bold @ {:08x}", fonts::bold::DATA_BOLD.as_ptr() as u32);
|
||||
let keep_fonts = fonts::hanzi::DATA_HANZI.as_ptr() as u32 +
|
||||
fonts::emoji::DATA_EMOJI.as_ptr() as u32 +
|
||||
fonts::regular::DATA_REGULAR.as_ptr() as u32 +
|
||||
fonts::small::DATA_SMALL.as_ptr() as u32 +
|
||||
fonts::bold::DATA_BOLD.as_ptr() as u32;
|
||||
|
||||
// The MMU should be set up now, and memory pages assigned to their
|
||||
// respective processes.
|
||||
|
|
@ -1072,7 +1066,6 @@ fn boot_sequence(args: KernelArguments, _signature: u32) -> ! {
|
|||
cfg.processes[0].entrypoint,
|
||||
cfg.processes[0].sp,
|
||||
cfg.debug,
|
||||
keep_fonts,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,20 +31,20 @@ fn draw_boot_logo(display: &mut XousDisplay) {
|
|||
|
||||
#[cfg(target_os = "none")]
|
||||
fn map_fonts() {
|
||||
info!("GFX: mapping fonts");
|
||||
//info!("GFX: mapping fonts");
|
||||
// this maps an extra page if the total length happens to fall on a 4096-byte boundary, but this is ok
|
||||
// because the reserved area is much larger
|
||||
let fontlen: u32 = ((fontmap::FONT_TOTAL_LEN as u32) & 0xFFFF_F000) + 0x1000;
|
||||
info!("GFX: requesting map of length 0x{:08x} at 0x{:08x}", fontlen, fontmap::FONT_BASE);
|
||||
//info!("GFX: requesting map of length 0x{:08x} at 0x{:08x}", fontlen, fontmap::FONT_BASE);
|
||||
let fontregion = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(fontmap::FONT_BASE),
|
||||
None,
|
||||
fontlen as usize,
|
||||
xous::MemoryFlags::R,
|
||||
).expect("GFX: couldn't map fonts");
|
||||
info!("GFX: font base at 0x{:08x}, len of 0x{:08x}", usize::from(fontregion.addr), usize::from(fontregion.size));
|
||||
info!("GFX: font base at virtual 0x{:08x}, len of 0x{:08x}", usize::from(fontregion.addr), usize::from(fontregion.size));
|
||||
|
||||
info!("GFX: mapping regular font to 0x{:08x}", usize::from(fontregion.addr) + fontmap::REGULAR_OFFSET as usize);
|
||||
//info!("GFX: mapping regular font to 0x{:08x}", usize::from(fontregion.addr) + fontmap::REGULAR_OFFSET as usize);
|
||||
blitstr::map_font(blitstr::GlyphData::Emoji((usize::from(fontregion.addr) + fontmap::EMOJI_OFFSET) as usize));
|
||||
blitstr::map_font(blitstr::GlyphData::Hanzi((usize::from(fontregion.addr) + fontmap::HANZI_OFFSET) as usize));
|
||||
blitstr::map_font(blitstr::GlyphData::Regular((usize::from(fontregion.addr) + fontmap::REGULAR_OFFSET) as usize));
|
||||
|
|
|
|||
Loading…
Reference in a new issue