This is an automated email from the ASF dual-hosted git repository.

yuanz pushed a commit to branch no-std
in repository 
https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git

commit 75a8ae5c0f7661f3cc432bcc433a38f01c2bf954
Author: Sumit Garg <[email protected]>
AuthorDate: Fri Nov 24 19:28:35 2023 +0530

    examples: hello_world-rs: Switch to use #![no_std]
    
    While at it drop redundant Cargo.lock
    
    Signed-off-by: Sumit Garg <[email protected]>
---
 examples/hello_world-rs/proto/Cargo.toml |   2 +-
 examples/hello_world-rs/proto/src/lib.rs |   2 +
 examples/hello_world-rs/ta/Cargo.lock    | 105 -------------------------------
 examples/hello_world-rs/ta/Cargo.toml    |   7 +--
 examples/hello_world-rs/ta/src/main.rs   |   2 +
 examples/hello_world-rs/ta/ta_static.rs  |  14 +++--
 6 files changed, 17 insertions(+), 115 deletions(-)

diff --git a/examples/hello_world-rs/proto/Cargo.toml 
b/examples/hello_world-rs/proto/Cargo.toml
index a12d1c0..284c8d4 100644
--- a/examples/hello_world-rs/proto/Cargo.toml
+++ b/examples/hello_world-rs/proto/Cargo.toml
@@ -27,4 +27,4 @@ edition = "2018"
 [dependencies]
 
 [build_dependencies]
-uuid = { version = "0.8" }
+uuid = { version = "1.6.1", default-features = false }
diff --git a/examples/hello_world-rs/proto/src/lib.rs 
b/examples/hello_world-rs/proto/src/lib.rs
index 4e517ec..5fe3f74 100644
--- a/examples/hello_world-rs/proto/src/lib.rs
+++ b/examples/hello_world-rs/proto/src/lib.rs
@@ -15,6 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#![no_std]
+
 pub enum Command {
     IncValue,
     DecValue,
diff --git a/examples/hello_world-rs/ta/Cargo.lock 
b/examples/hello_world-rs/ta/Cargo.lock
deleted file mode 100644
index 2980714..0000000
--- a/examples/hello_world-rs/ta/Cargo.lock
+++ /dev/null
@@ -1,105 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "bitflags"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
-
-[[package]]
-name = "hex"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
-
-[[package]]
-name = "libc"
-version = "0.2.99"
-
-[[package]]
-name = "optee-utee"
-version = "0.2.0"
-dependencies = [
- "bitflags",
- "hex",
- "libc",
- "optee-utee-macros",
- "optee-utee-sys",
- "uuid",
-]
-
-[[package]]
-name = "optee-utee-macros"
-version = "0.2.0"
-dependencies = [
- "quote",
- "syn",
-]
-
-[[package]]
-name = "optee-utee-sys"
-version = "0.2.0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "0.4.30"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "proto"
-version = "0.2.0"
-dependencies = [
- "uuid",
-]
-
-[[package]]
-name = "quote"
-version = "0.6.12"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "syn"
-version = "0.15.39"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "ta"
-version = "0.2.0"
-dependencies = [
- "libc",
- "optee-utee",
- "optee-utee-sys",
- "proto",
- "uuid",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
-
-[[package]]
-name = "uuid"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index";
-checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
diff --git a/examples/hello_world-rs/ta/Cargo.toml 
b/examples/hello_world-rs/ta/Cargo.toml
index 6a75dbb..a1f89c2 100644
--- a/examples/hello_world-rs/ta/Cargo.toml
+++ b/examples/hello_world-rs/ta/Cargo.toml
@@ -25,13 +25,12 @@ description = "An example of Rust OP-TEE TrustZone SDK."
 edition = "2018"
 
 [dependencies]
-libc = { path = "../../../rust/libc" }
 proto = { path = "../proto" }
-optee-utee-sys = { path = "../../../optee-utee/optee-utee-sys" }
-optee-utee = { path = "../../../optee-utee" }
+optee-utee-sys = { path = "../../../optee-utee/optee-utee-sys", 
default-features = false }
+optee-utee = { path = "../../../optee-utee", default-features = false }
 
 [build_dependencies]
-uuid = { version = "0.8" }
+uuid = { version = "1.6.1", default-features = false }
 proto = { path = "../proto" }
 
 [profile.release]
diff --git a/examples/hello_world-rs/ta/src/main.rs 
b/examples/hello_world-rs/ta/src/main.rs
index f7b2a00..f952896 100644
--- a/examples/hello_world-rs/ta/src/main.rs
+++ b/examples/hello_world-rs/ta/src/main.rs
@@ -15,7 +15,9 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#![no_std]
 #![no_main]
+#![feature(c_size_t)]
 
 use optee_utee::{
     ta_close_session, ta_create, ta_destroy, ta_invoke_command, 
ta_open_session, trace_println,
diff --git a/examples/hello_world-rs/ta/ta_static.rs 
b/examples/hello_world-rs/ta/ta_static.rs
index b31f8c3..53ca210 100644
--- a/examples/hello_world-rs/ta/ta_static.rs
+++ b/examples/hello_world-rs/ta/ta_static.rs
@@ -15,8 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
+use core::ffi::*;
+use core::mem;
+use core::primitive::u64;
+
 #[no_mangle]
-pub static mut trace_level: libc::c_int = TRACE_LEVEL;
+pub static mut trace_level: c_int = TRACE_LEVEL;
 
 #[no_mangle]
 pub static trace_ext_prefix: &[u8] = TRACE_EXT_PREFIX;
@@ -27,7 +31,7 @@ pub static ta_head: optee_utee_sys::ta_head = 
optee_utee_sys::ta_head {
     uuid: TA_UUID,
     stack_size: TA_STACK_SIZE + TA_FRAMEWORK_STACK_SIZE,
     flags: TA_FLAGS,
-    depr_entry: std::u64::MAX,
+    depr_entry: u64::MAX,
 };
 
 #[no_mangle]
@@ -35,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = 
optee_utee_sys::ta_head {
 pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];
 
 #[no_mangle]
-pub static ta_heap_size: libc::size_t = std::mem::size_of::<u8>() * 
TA_DATA_SIZE as usize;
+pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as 
usize;
 static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) 
!= 0;
 static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) 
!= 0;
 static FLAG_INSTANCE: bool = (TA_FLAGS & 
optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;
 
 #[no_mangle]
-pub static ta_num_props: libc::size_t = 9;
+pub static ta_num_props: c_size_t = 9;
 
 #[no_mangle]
 pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
@@ -93,6 +97,6 @@ pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
 ];
 
 #[no_mangle]
-pub unsafe extern "C" fn tahead_get_trace_level() -> libc::c_int {
+pub unsafe extern "C" fn tahead_get_trace_level() -> c_int {
     return trace_level;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to