From b7443314d77cf0a3bbc6e2a867bbaa77927f7b38 Mon Sep 17 00:00:00 2001 From: arctic-alpaca <67190338+arctic-alpaca@users.noreply.github.com> Date: Wed, 15 May 2024 08:10:29 +0200 Subject: [PATCH] Add option to include the Ethernet driver task. (#15) Before, we included the Ethernet driver task in every example, which broke some of them. This change makes this optional and configurable through xtask. --- app-tc37x/CMakeLists.txt | 5 +++++ app-tc37x/pxros/tasks/taskDeployment.c | 4 ++++ xtask/src/build.rs | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app-tc37x/CMakeLists.txt b/app-tc37x/CMakeLists.txt index e954742..76a5b28 100644 --- a/app-tc37x/CMakeLists.txt +++ b/app-tc37x/CMakeLists.txt @@ -11,6 +11,11 @@ cmake_path(SET pxros_utils_dir NORMALIZE $ENV{PXROS_UTILS}) cmake_path(SET illd_base NORMALIZE $ENV{ILLD_BASE}) cmake_path(SET illd_precompiled NORMALIZE $ENV{ILLD_PRECOMPILED}) +# Whether to include the ethernet driver task. +if (DEFINED ENV{INCLUDE_ETHERNET_DRIVER_TASK}) + add_compile_definitions(INCLUDE_ETHERNET_DRIVER_TASK) +endif() + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() diff --git a/app-tc37x/pxros/tasks/taskDeployment.c b/app-tc37x/pxros/tasks/taskDeployment.c index 47b6b92..cc5f5b3 100644 --- a/app-tc37x/pxros/tasks/taskDeployment.c +++ b/app-tc37x/pxros/tasks/taskDeployment.c @@ -24,9 +24,13 @@ /* Task Deployment Table * Task configuration relying on Task default Memory Class and Object pool */ +#ifdef INCLUDE_ETHERNET_DRIVER_TASK const task_deployment_t taskTable[] = { { PxEthTaskCreate, GETH_DRIVER_PRIO, PXCORE_0}, }; +#else +const task_deployment_t taskTable[] = {}; +#endif /* FUNTION: TaskDeploy * Function calls Task Create function according their core assignment in the taskTable diff --git a/xtask/src/build.rs b/xtask/src/build.rs index aca8951..f41edb0 100644 --- a/xtask/src/build.rs +++ b/xtask/src/build.rs @@ -49,6 +49,12 @@ pub struct Options { /// This is an expensive operation so it is disabled by default. #[arg(long, required = false)] pub build_illd: bool, + + /// Include the Ethernet driver task into PXROS task list. + /// + /// This is required if the Ethernet driver is used. + #[arg(long, required = false)] + pub include_ethernet_task: bool, } /// Tricore probe log level. @@ -152,7 +158,7 @@ pub fn build(options: Options) -> anyhow::Result<()> { env::set_current_dir(workspace_root_dir.join(options.app_folder))?; let build_directory = build_directory.to_str().expect("Path should be valid UTF-8."); - let make_result = make_pxros(build_directory, options.jobs, options.build_illd); + let make_result = make_pxros(build_directory, options.jobs, options.build_illd, options.include_ethernet_task); env::set_current_dir(current_directory)?; @@ -173,7 +179,12 @@ fn to_os_path(path: &str) -> String { /// /// This function is not inlined because we want to revert and go back to our /// old folder even if we encounter an error. -fn make_pxros(build_dir: &str, make_job_count: usize, build_illd: bool) -> anyhow::Result<()> { +fn make_pxros( + build_dir: &str, + make_job_count: usize, + build_illd: bool, + include_ethernet_task: bool, +) -> anyhow::Result<()> { let mut env_vars = vec![ ("PXROS_ROOT_PATH", to_os_path(pxros_hr::TRI_8_2_1_EVAL_KERNEL)), ("PXROS_UTILS", to_os_path(pxros_hr::TRI_8_2_1_EVAL_UTILS)), @@ -185,6 +196,10 @@ fn make_pxros(build_dir: &str, make_job_count: usize, build_illd: bool) -> anyho env_vars.push(("BUILD_ILLD", "1".into())); } + if include_ethernet_task { + env_vars.push(("INCLUDE_ETHERNET_DRIVER_TASK", "1".into())); + } + if !process::Command::new("cmake") .args(["-B", build_dir, "--fresh", "-G", "Unix Makefiles"]) .envs(env_vars.clone())