Skip to content

Commit

Permalink
Add dummy tasks executables
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgian committed Jul 12, 2023
1 parent 51bfab9 commit c4f6a73
Show file tree
Hide file tree
Showing 15 changed files with 304 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["boot", "bootloader", "kernel", "apps/hello"]
members = ["boot", "bootloader", "kernel", "apps/hello", "apps/atest", "apps/btest", "apps/ctest"]
resolver = "2"

[workspace.package]
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ objcopy:
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_16-felix/debug/felix-bootloader build/bootloader.bin
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_32-felix/debug/felix-kernel build/kernel.bin
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_32-felix/debug/hello build/hello.bin
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_32-felix/debug/atest build/atest.bin
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_32-felix/debug/btest build/btest.bin
@$(OBJCOPY) -I elf32-i386 -O binary target/x86_32-felix/debug/ctest build/ctest.bin

.PHONY: image
image:
Expand All @@ -62,6 +65,9 @@ image:
@$(MCOPY) -i build/partition.img dante "::dante"
@$(MCOPY) -i build/partition.img lorem "::lorem"
@$(MCOPY) -i build/partition.img build/hello.bin "::hello"
@$(MCOPY) -i build/partition.img build/atest.bin "::atest"
@$(MCOPY) -i build/partition.img build/btest.bin "::btest"
@$(MCOPY) -i build/partition.img build/ctest.bin "::ctest"
@dd if=build/partition.img of=build/disk.img bs=512 seek=36864 conv=notrunc
@rm -rf build/partition.img
@dd if=build/bootloader.bin of=build/disk.img bs=512 seek=2048 conv=notrunc
Expand Down
9 changes: 9 additions & 0 deletions apps/atest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "atest"
version = "0.1.0"
edition = "2021"

[dependencies]

[dependencies.libfelix]
path = "../../lib"
10 changes: 10 additions & 0 deletions apps/atest/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::path::Path;

fn main() {
let local_path = Path::new(env!("CARGO_MANIFEST_DIR"));
//tell rust to use custom linker script
println!(
"cargo:rustc-link-arg-bins=--script={}",
local_path.join("linker.ld").display()
);
}
39 changes: 39 additions & 0 deletions apps/atest/linker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ENTRY(_start)

SECTIONS {
. = 0x02000000;

.start_marker :
{
LONG(0xB16B00B5)
}

_app_start = .;

.start : {
*(.start)
}
.text : {
*(.text .text.*)
}
.bss : {
*(.bss .bss.*)
}
.rodata : {
*(.rodata .rodata.*)
}
.data : {
*(.data .data.*)
}
.eh_frame : {
*(.eh_frame .eh_frame.*)
}
.eh_frame_hdr : {
*(.eh_frame_hdr .eh_frame_hdr.*)
}

.end_marker :
{
SHORT(0xdead)
}
}
34 changes: 34 additions & 0 deletions apps/atest/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//HELLO
//Simple program to test libfelix

#![no_std]
#![no_main]

use core::panic::PanicInfo;
use libfelix;

#[no_mangle]
#[link_section = ".start"]
pub extern "C" fn _start() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 100_000_000 {
libfelix::println!("Process A running. {}% complete.", b);
a = 0;
b += 1;

if b == 100 {
libfelix::println!("Process A complete.");
break;
}
}
a += 1;
}
loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
9 changes: 9 additions & 0 deletions apps/btest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "btest"
version = "0.1.0"
edition = "2021"

[dependencies]

[dependencies.libfelix]
path = "../../lib"
10 changes: 10 additions & 0 deletions apps/btest/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::path::Path;

fn main() {
let local_path = Path::new(env!("CARGO_MANIFEST_DIR"));
//tell rust to use custom linker script
println!(
"cargo:rustc-link-arg-bins=--script={}",
local_path.join("linker.ld").display()
);
}
39 changes: 39 additions & 0 deletions apps/btest/linker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ENTRY(_start)

SECTIONS {
. = 0x02000000;

.start_marker :
{
LONG(0xB16B00B5)
}

_app_start = .;

.start : {
*(.start)
}
.text : {
*(.text .text.*)
}
.bss : {
*(.bss .bss.*)
}
.rodata : {
*(.rodata .rodata.*)
}
.data : {
*(.data .data.*)
}
.eh_frame : {
*(.eh_frame .eh_frame.*)
}
.eh_frame_hdr : {
*(.eh_frame_hdr .eh_frame_hdr.*)
}

.end_marker :
{
SHORT(0xdead)
}
}
34 changes: 34 additions & 0 deletions apps/btest/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//HELLO
//Simple program to test libfelix

#![no_std]
#![no_main]

use core::panic::PanicInfo;
use libfelix;

#[no_mangle]
#[link_section = ".start"]
pub extern "C" fn _start() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 100_000_000 {
libfelix::println!("Process B running. {}% complete.", b);
a = 0;
b += 1;

if b == 100 {
libfelix::println!("Process B complete.");
break;
}
}
a += 1;
}
loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
9 changes: 9 additions & 0 deletions apps/ctest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "ctest"
version = "0.1.0"
edition = "2021"

[dependencies]

[dependencies.libfelix]
path = "../../lib"
10 changes: 10 additions & 0 deletions apps/ctest/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::path::Path;

fn main() {
let local_path = Path::new(env!("CARGO_MANIFEST_DIR"));
//tell rust to use custom linker script
println!(
"cargo:rustc-link-arg-bins=--script={}",
local_path.join("linker.ld").display()
);
}
39 changes: 39 additions & 0 deletions apps/ctest/linker.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
ENTRY(_start)

SECTIONS {
. = 0x02000000;

.start_marker :
{
LONG(0xB16B00B5)
}

_app_start = .;

.start : {
*(.start)
}
.text : {
*(.text .text.*)
}
.bss : {
*(.bss .bss.*)
}
.rodata : {
*(.rodata .rodata.*)
}
.data : {
*(.data .data.*)
}
.eh_frame : {
*(.eh_frame .eh_frame.*)
}
.eh_frame_hdr : {
*(.eh_frame_hdr .eh_frame_hdr.*)
}

.end_marker :
{
SHORT(0xdead)
}
}
34 changes: 34 additions & 0 deletions apps/ctest/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//HELLO
//Simple program to test libfelix

#![no_std]
#![no_main]

use core::panic::PanicInfo;
use libfelix;

#[no_mangle]
#[link_section = ".start"]
pub extern "C" fn _start() {
let mut a: u32 = 0;
let mut b: u8 = 0;
loop {
if a == 100_000_000 {
libfelix::println!("Process C running. {}% complete.", b);
a = 0;
b += 1;

if b == 100 {
libfelix::println!("Process C complete.");
break;
}
}
a += 1;
}
loop {}
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}

0 comments on commit c4f6a73

Please sign in to comment.