diff --git a/.gitignore b/.gitignore index 4fffb2f89cbd8f2169ce9914bd16bd43785bb368..502d4f0ed10e4580a3977f8f1c079f7c6f7ecb5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /Cargo.lock +src/liteos/config.rs diff --git a/Cargo.toml b/Cargo.toml index 8321d77b82b89db557a8fb3ffb91f8e57bcedca5..7d7c1dfc2548415c457fae8a8cb178a3cbf896ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,9 @@ version = "0.1.0" crate-type = ["rlib"] [dependencies] -cfg-if = "1.0.0" -utils = { git = "https://gitee.com/iot-ua/utils.git" } +utils = { git = "https://gitee.com/iot-ua/utils.git", branch = "develop" } +cfg-if = "1.0.0" [target.'cfg(unix)'.dependencies] libc = { version = "0.2.126", default-features = false } diff --git a/build.rs b/build.rs index 822a1283f87e1d40433287603da8b30e54e4e3d0..7430808cecd4fe1d31ba60c1d13726de1d8f5d9f 100644 --- a/build.rs +++ b/build.rs @@ -10,18 +10,25 @@ fn main() { let target_os = env::var("CARGO_CFG_LITEOS").is_ok(); // Decode liteos configuration information and automatically generate configuration files. if target_os { + let pwd = env::var("PWD").unwrap(); + let pwd = PathBuf::from_str(&pwd).unwrap(); + let manifest_path = env::var("CARGO_MANIFEST_DIR").unwrap(); + let manifest_path = PathBuf::from_str(&manifest_path).unwrap(); + let los_path = env::var("CARGO_CFG_LOS_PATH").unwrap(); - let los_path = PathBuf::from_str(&los_path).unwrap(); + let los_path = pwd.join(&los_path); + let fs = File::options() .read(true) .open(los_path.join(".config")) .unwrap(); let fs = BufReader::new(fs); + println!("{}",manifest_path.join("src/liteos/config.rs").to_str().unwrap()); let mut fcfg = File::options() .write(true) .create(true) .truncate(true) - .open("./src/liteos/libc/config.rs") + .open(manifest_path.join("src/liteos/config.rs")) .unwrap(); let is_empty_line = Regex::new(r"^ *?#|^ *?$").unwrap(); let kv = Regex::new(r#"^ *?(\w+) *?= *?(.*)$"#).unwrap(); diff --git a/doc/code_info.md b/doc/code_info.md index 7edab6ed376f7b02478e9d626e7a16d3a194e421..87e7a82873c1e53bca6025faf7c8abdaaa2e611f 100644 --- a/doc/code_info.md +++ b/doc/code_info.md @@ -6,7 +6,7 @@ | ---------- | ----------------------- | --------------------- | -------------------------- | | .cargo | | | Cargo 编译配置文件 | |doc | | | 文档 | -|scr | | | 原码 | +|src | | | 源码 | | |common | |平台无关部分代码| | |liteos | |华为LiteOS_M 相关实现| | | |libc |编译时生成的 Lite_OS 配置信息| diff --git a/src/liteos/libc.rs b/src/liteos/libc.rs index c398d4b00a0b5aef5cdf8e4ce214148b8c019c96..935ba129c462665a8e184299557f3b6790f5fdbc 100644 --- a/src/liteos/libc.rs +++ b/src/liteos/libc.rs @@ -1,3 +1,4 @@ +#[path = "./config.rs"] mod config; pub type size_t = usize; pub mod heap { @@ -138,4 +139,4 @@ pub mod task { extern "C" { pub fn LOS_TaskDelay(tick: u32) -> u32; } -} \ No newline at end of file +} diff --git a/src/liteos/libc/config.rs b/src/liteos/libc/config.rs deleted file mode 100644 index 0e583415d0f64d633635874e82d94fc6ba429154..0000000000000000000000000000000000000000 --- a/src/liteos/libc/config.rs +++ /dev/null @@ -1,16 +0,0 @@ -//The following content is automatically generated by the compiler. -//please do not modify it. -pub const LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT: usize = 2usize; -pub const LOSCFG_BASE_CORE_TSK_LIMIT: usize = 12usize; -pub const LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE: usize = 400usize; -pub const LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE: usize = 800usize; -pub const LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE: usize = 800usize; -pub const LOSCFG_BASE_CORE_TSK_IDLE_STACK_SIZE: usize = 400usize; -pub const LOSCFG_BASE_CORE_TSK_DEFAULT_PRIO: usize = 10usize; -pub const LOSCFG_BASE_CORE_TICK_PER_SECOND: usize = 1000usize; -pub const LOSCFG_PLATFORM_HWI_LIMIT: usize = 256usize; -pub const LOSCFG_HWI_PRIO_LIMIT: usize = 32usize; -pub const LOSCFG_BASE_CORE_SWTMR_LIMIT: usize = 16usize; -pub const LOSCFG_BASE_IPC_QUEUE_LIMIT: usize = 10usize; -pub const LOSCFG_BASE_IPC_MUX_LIMIT: usize = 20usize; -pub const LOSCFG_BASE_IPC_SEM_LIMIT: usize = 20usize;