diff --git a/apps/microtvm/zephyr/template_project/CMakeLists.txt.template b/apps/microtvm/zephyr/template_project/CMakeLists.txt.template index bbd975315e880..9386576c394b2 100644 --- a/apps/microtvm/zephyr/template_project/CMakeLists.txt.template +++ b/apps/microtvm/zephyr/template_project/CMakeLists.txt.template @@ -28,9 +28,7 @@ set(QEMU_PIPE CACHE PATH "Path to QEMU pipe") find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) project(microtvm_autogenerated_project) -if(${ENABLE_CMSIS}) - set(CMSIS_PATH ) - +if(DEFINED CMSIS_PATH) file(GLOB_RECURSE cmsis_lib_srcs ${CMSIS_PATH}/CMSIS/NN/Source/ActivationFunctions/*.c ${CMSIS_PATH}/CMSIS/NN/Source/BasicMathFunctions/*.c diff --git a/apps/microtvm/zephyr/template_project/microtvm_api_server.py b/apps/microtvm/zephyr/template_project/microtvm_api_server.py index 5ea4d73be7ec6..b3dc26f5ca94d 100644 --- a/apps/microtvm/zephyr/template_project/microtvm_api_server.py +++ b/apps/microtvm/zephyr/template_project/microtvm_api_server.py @@ -370,7 +370,7 @@ def _get_nrf_device_args(serial_number: str): ] -def get_zephyr_base(options: dict): +def get_zephyr_base(options: dict) -> str: """Returns Zephyr base path""" zephyr_base = options.get("zephyr_base", ZEPHYR_BASE) assert zephyr_base, "'zephyr_base' option not passed and not found by default!" @@ -470,7 +470,6 @@ def _create_prj_conf( API_SERVER_CRT_LIBS_TOKEN = "" CMAKE_ARGS_TOKEN = "" QEMU_PIPE_TOKEN = "" - CMSIS_PATH_TOKEN = "" CRT_LIBS_BY_PROJECT_TYPE = { "host_driven": "microtvm_rpc_server microtvm_rpc_common aot_executor_module aot_executor common", @@ -508,7 +507,14 @@ def _cmsis_required(self, project_path: Union[str, pathlib.Path]) -> bool: return False def _generate_cmake_args( - self, mlf_extracted_path, board, use_fvp, west_cmd, zephyr_base, verbose, cmsis_path + self, + mlf_extracted_path, + board: str, + use_fvp: bool, + west_cmd: str, + zephyr_base: str, + verbose: bool, + cmsis_path: pathlib.Path, ) -> str: cmake_args = "\n# cmake args\n" if verbose: @@ -530,10 +536,9 @@ def _generate_cmake_args( cmake_args += f"set(BOARD {board})\n" - enable_cmsis = self._cmsis_required(mlf_extracted_path) - if enable_cmsis: + if self._cmsis_required(mlf_extracted_path): assert cmsis_path, CMSIS_PATH_ERROR - cmake_args += f"set(ENABLE_CMSIS {str(enable_cmsis).upper()})\n" + cmake_args += f"set(CMSIS_PATH {str(cmsis_path)})\n" return cmake_args @@ -632,10 +637,6 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec self.qemu_pipe_dir = pathlib.Path(tempfile.mkdtemp()) line = line.replace(self.QEMU_PIPE_TOKEN, str(self.qemu_pipe_dir / "fifo")) - if self.CMSIS_PATH_TOKEN in line and self._cmsis_required(extract_path): - assert cmsis_path, CMSIS_PATH_ERROR - line = line.replace(self.CMSIS_PATH_TOKEN, cmsis_path) - cmake_f.write(line) heap_size = recommended_heap_size