Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Continuous integration #53

Merged
merged 13 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
matrix:
target:
- linux
- esp32
- esp32s3
# - esp32
# - esp32s3

steps:
- name: Setup | Checkout repository
Expand All @@ -48,7 +48,7 @@ jobs:
ldproxy: true

- name: Setup | Install necessary dependencies
run: sudo apt-get install -y libsdl2-dev gcc-multilib
run: sudo apt-get install -y gcc-multilib

- name: Setup | Build and source build tool
run: source Export.sh
Expand All @@ -60,4 +60,4 @@ jobs:
run: Build_tool/target/release/Build_tool clippy ${{ matrix.target }} --all-features --workspace -- -D warnings

- name: Run | Tests
run: Build_tool/target/release/Build_tool test ${{ matrix.target }} --all -- --include-ignored
run: Build_tool/target/release/Build_tool test ${{ matrix.target }} --all
62 changes: 31 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,40 +1,10 @@
[workspace]
members = [
"Modules/File_system",
"Modules/Virtual_machine",
"Modules/Graphics",
"Modules/Task",
"Modules/Users",
"Modules/Drivers",
"Modules/Peripherals",
"Modules/Memory",
"Modules/Time",
"Modules/ABI",
"Modules/Virtual_file_system",
"Modules/LittleFS",
"Modules/Target",
"Modules/Bindings/Utilities",
"Modules/Bindings/Host",
"Modules/Bindings/WASM",
"Modules/Executables/Shell/Command_line",
"Modules/Executable",
"Modules/Executables/WASM",
"Modules/Executables/Shell/Graphical",
"Modules/Executables/Terminal",
]
exclude = [
"Modules/Virtual_machine/Tests/WASM_test",
"Modules/Bindings/Tests/WASM_test",
]

[package]
name = "Xila"
version = "0.1.0"
authors = ["Alix ANNERAUD <[email protected]>"]
edition = "2021"
resolver = "2"
rust-version = "1.71"

rust-version = "1.82.0"

[dependencies]
# - WASM
Expand Down Expand Up @@ -84,3 +54,33 @@ WASM = ["dep:WASM_bindings"]
name = "Native"
path = "Examples/Native.rs"
required-features = ["Host"]

[workspace]
members = [
"Modules/File_system",
"Modules/Virtual_machine",
"Modules/Graphics",
"Modules/Task",
"Modules/Users",
"Modules/Drivers",
"Modules/Peripherals",
"Modules/Memory",
"Modules/Time",
"Modules/ABI",
"Modules/Virtual_file_system",
"Modules/LittleFS",
"Modules/Target",
"Modules/Bindings/Utilities",
"Modules/Bindings/Host",
"Modules/Bindings/WASM",
"Modules/Executables/Shell/Command_line",
"Modules/Executable",
"Modules/Executables/WASM",
"Modules/Executables/Shell/Graphical",
"Modules/Executables/Terminal",
]
exclude = [
"Modules/Virtual_machine/Tests/WASM_test",
"Modules/Bindings/Tests/WASM_test",
"Build_tool",
]
10 changes: 6 additions & 4 deletions Modules/Bindings/Host/Tests/WASM_test/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]

use WASM_bindings::*;

Expand All @@ -11,7 +12,6 @@ fn main() {
let mut Window = Xila_graphics_object_t::MAX;
let mut Button = Xila_graphics_object_t::MAX;
let mut Label = Xila_graphics_object_t::MAX;
let mut Deleted_label = Xila_graphics_object_t::MAX;

unsafe {
println!("Window : {:x}", Window);
Expand All @@ -25,7 +25,7 @@ fn main() {
println!("Button : {:x}", Button);

Xila_graphics_label_create(Button, &mut Label as *mut _);
Xila_graphics_label_set_text(Label, "Hello, world!\0".as_ptr() as *mut _);
Xila_graphics_label_set_text(Label, c"Hello, world!".as_ptr() as *mut _);

println!("Label : {:x}", Label);

Expand All @@ -46,11 +46,13 @@ fn main() {
if Target == Button {
Xila_graphics_label_set_text(
Label,
"Button pressed!\0".as_ptr() as *mut _,
c"Button pressed!".as_ptr() as *mut _,
);
}
}
_ => {}
Event => {
println!("Event : {}", Event);
}
}

Xila_graphics_window_next_event(Window);
Expand Down
18 changes: 0 additions & 18 deletions Modules/LittleFS/src/File.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,6 @@ impl File_type {
Ok(Metadata)
}

pub fn Get_metadata_mutable(&mut self) -> Result_type<&mut Metadata_type> {
let Configuration = unsafe { self.0.File.cfg.read() };

if Configuration.attr_count == 0 {
return Err(Error_type::No_attribute);
}

let Attributes = unsafe { Configuration.attrs.read() };

if Attributes.size != size_of::<Metadata_type>() as u32 {
return Err(Error_type::No_attribute);
}

let Metadata = unsafe { &mut *(Attributes.buffer as *mut Metadata_type) };

Ok(Metadata)
}

pub fn Get_mode(&self) -> Mode_type {
self.0.Flags.Get_mode()
}
Expand Down
11 changes: 6 additions & 5 deletions Modules/LittleFS/src/File_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use core::mem::MaybeUninit;
use std::{collections::BTreeMap, ffi::CString, sync::RwLock};

use File_system::{
Device_type, Entry_type, File_identifier_type, File_system_identifier_type, File_system_traits,
Flags_type, Get_new_file_identifier, Inode_type, Local_file_identifier_type, Metadata_type,
Mode_type, Path_type, Position_type, Size_type, Statistics_type, Time_type, Type_type,
Device_type, Entry_type, File_identifier_inner_type, File_identifier_type,
File_system_identifier_type, File_system_traits, Flags_type, Get_new_file_identifier,
Inode_type, Local_file_identifier_type, Metadata_type, Mode_type, Path_type, Position_type,
Size_type, Statistics_type, Time_type, Type_type,
};
use Users::{Group_identifier_type, User_identifier_type};

Expand Down Expand Up @@ -158,9 +159,9 @@ impl File_system_type {
}

#[cfg(target_pointer_width = "64")]
const Directory_flag: u32 = 1 << 31;
const Directory_flag: File_identifier_inner_type = 1 << 31;
#[cfg(target_pointer_width = "32")]
const Directory_flag: u32 = 1 << 15;
const Directory_flag: File_identifier_inner_type = 1 << 15;

const Directory_minimum: File_identifier_type = File_identifier_type::New(Self::Directory_flag);

Expand Down
10 changes: 10 additions & 0 deletions Modules/Virtual_machine/Tests/WASM_test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,23 @@ fn Test_directory() {
}
}

/// Allocate memory
///
/// # Safety
///
/// This function is unsafe because it may return an invalid pointer.
#[no_mangle]
pub unsafe extern "C" fn Allocate(Size: usize) -> *mut u8 {
let Layout = std::alloc::Layout::from_size_align(Size, std::mem::size_of::<usize>()).unwrap();

std::alloc::alloc(Layout)
}

/// Deallocate memory
///
/// # Safety
///
/// This function is unsafe because it may cause undefined behavior if the pointer is invalid.
#[no_mangle]
pub unsafe extern "C" fn Deallocate(Pointer: *mut u8, Size: usize) {
let Layout = std::alloc::Layout::from_size_align(Size, std::mem::size_of::<usize>()).unwrap();
Expand Down
2 changes: 2 additions & 0 deletions Modules/Virtual_machine/WAMR/include/platform_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ extern "C"

uint64_t os_get_invalid_handle();

int os_getpagesize();

#ifdef __cplusplus
}
#endif /* end of extern "C" */
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]

#[cfg(feature = "WASM")]
use WASM_bindings::*;
#[cfg(all(target_arch = "wasm32", feature = "WASM"))]
pub use WASM_bindings::*;
Loading