DemesneGH commented on code in PR #156:
URL: 
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/156#discussion_r1897929125


##########
optee-utee-build/src/ta_config.rs:
##########
@@ -0,0 +1,193 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+use crate::Error;
+use std::convert::TryInto;
+
+/// Configuration options for TA
+///
+/// Examples
+///
+/// # use a default configuration
+/// ```rust
+/// use optee_utee_build::TAConfig;
+/// # use optee_utee_build::Error;
+/// # fn main() -> Result<(), Error> {
+/// const UUID: &str = "d93c2970-b1a6-4b86-90ac-b42830e78d9b";
+/// let ta_config = TAConfig::new_default(
+///     UUID,
+///     "0.1.0",
+///     "hello world",
+/// )?;
+/// # Ok(())
+/// # }
+/// ```
+///
+/// and since we already have `version` and `description` in `cargo.toml`,
+/// we can make it simpler by using them as parameters:
+///
+/// ```rust
+/// use optee_utee_build::TAConfig;
+/// # use optee_utee_build::Error;
+/// # fn main() -> Result<(), Error> {
+/// const UUID: &str = "d93c2970-b1a6-4b86-90ac-b42830e78d9b";
+/// let ta_config = TAConfig::new_default_with_cargo_env(UUID)?;
+/// # Ok(())
+/// # }
+/// ```
+///
+/// # make some modifications
+/// ```rust
+/// use optee_utee_build::TAConfig;
+/// # use optee_utee_build::Error;
+/// # fn main() -> Result<(), Error> {
+/// const UUID: &str = "d93c2970-b1a6-4b86-90ac-b42830e78d9b";
+/// let ta_config = TAConfig::new_default(
+///     UUID,
+///     "0.1.0",
+///     "hello world",
+/// )?.ta_stack_size(10 * 1024).ta_data_size(32 * 1024);
+/// # Ok(())
+/// # }
+/// ```
+#[derive(Debug, Clone)]
+pub struct TAConfig {
+    pub uuid: uuid::Uuid,
+    pub ta_flags: u32,
+    pub ta_data_size: u32,
+    pub ta_stack_size: u32,
+    pub ta_version: String,
+    pub ta_description: String,
+    pub trace_level: i32,
+    pub trace_ext_prefix: String,
+    pub ta_framework_stack_size: u32,
+    pub ext_properties: Vec<Property>,
+}
+
+impl TAConfig {
+    /// Generate a default config by uuid, this is a wrapper of `new_default`
+    /// function, it retrieves version and description from cargo.toml by

Review Comment:
   "cargo.toml" => "your TA's Cargo.toml"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org
For additional commands, e-mail: dev-h...@teaclave.apache.org

Reply via email to