diff --git a/apps/microtvm/zephyr/template_project/app-overlay/nucleo_l4r5zi.overlay b/apps/microtvm/zephyr/template_project/app-overlay/nucleo_l4r5zi.overlay new file mode 100644 index 000000000000..360e0753d4f5 --- /dev/null +++ b/apps/microtvm/zephyr/template_project/app-overlay/nucleo_l4r5zi.overlay @@ -0,0 +1,23 @@ + +/* + * 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. + */ + +&rcc { + clock-frequency = ; +}; diff --git a/apps/microtvm/zephyr/template_project/microtvm_api_server.py b/apps/microtvm/zephyr/template_project/microtvm_api_server.py index b73779f68148..5a0bc7309c63 100644 --- a/apps/microtvm/zephyr/template_project/microtvm_api_server.py +++ b/apps/microtvm/zephyr/template_project/microtvm_api_server.py @@ -567,6 +567,8 @@ def _generate_cmake_args(self, mlf_extracted_path, options) -> str: return cmake_args def generate_project(self, model_library_format_path, standalone_crt_dir, project_dir, options): + zephyr_board = options["zephyr_board"] + # Check Zephyr version version = self._get_platform_version(get_zephyr_base(options)) if version != ZEPHYR_VERSION: @@ -586,6 +588,11 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec # Copy boards.json file to generated project. shutil.copy2(BOARDS, project_dir / BOARDS.name) + # Copy overlay files + board_overlay_path = API_SERVER_DIR / "app-overlay" / f"{zephyr_board}.overlay" + if board_overlay_path.exists(): + shutil.copy2(board_overlay_path, project_dir / f"{zephyr_board}.overlay") + # Place Model Library Format tarball in the special location, which this script uses to decide # whether it's being invoked in a template or generated project. project_model_library_format_tar_path = project_dir / MODEL_LIBRARY_FORMAT_RELPATH @@ -597,9 +604,9 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec os.makedirs(extract_path) tf.extractall(path=extract_path) - if self._is_qemu(options["zephyr_board"], options.get("use_fvp")): + if self._is_qemu(zephyr_board, options.get("use_fvp")): shutil.copytree(API_SERVER_DIR / "qemu-hack", project_dir / "qemu-hack") - elif self._is_fvp(options["zephyr_board"], options.get("use_fvp")): + elif self._is_fvp(zephyr_board, options.get("use_fvp")): shutil.copytree(API_SERVER_DIR / "fvp-hack", project_dir / "fvp-hack") # Populate CRT. @@ -650,7 +657,7 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec for item in flags: cmake_f.write(f"target_compile_definitions(app PUBLIC {item})\n") - if self._is_fvp(options["zephyr_board"], options.get("use_fvp")): + if self._is_fvp(zephyr_board, options.get("use_fvp")): cmake_f.write(f"target_compile_definitions(app PUBLIC -DFVP=1)\n") self._create_prj_conf(project_dir, options) @@ -665,7 +672,7 @@ def generate_project(self, model_library_format_path, standalone_crt_dir, projec # Populate src/ src_dir = project_dir / "src" if options["project_type"] != "host_driven" or self._is_fvp( - options["zephyr_board"], options.get("use_fvp") + zephyr_board, options.get("use_fvp") ): shutil.copytree(API_SERVER_DIR / "src" / options["project_type"], src_dir) else: diff --git a/cmake/modules/Zephyr.cmake b/cmake/modules/Zephyr.cmake index be4f85dac33d..644675dcf871 100644 --- a/cmake/modules/Zephyr.cmake +++ b/cmake/modules/Zephyr.cmake @@ -29,6 +29,7 @@ if(USE_MICRO) "apps/microtvm/zephyr/template_project/src/host_driven *.h -> zephyr/src/host_driven" "apps/microtvm/zephyr/template_project/fvp-hack * -> zephyr/fvp-hack" "apps/microtvm/zephyr/template_project/qemu-hack * -> zephyr/qemu-hack" + "apps/microtvm/zephyr/template_project/app-overlay * -> zephyr/app-overlay" "apps/microtvm/zephyr/template_project/crt_config *.h -> zephyr/crt_config" ) diff --git a/tests/lint/check_file_type.py b/tests/lint/check_file_type.py index 7e09c3c7cfa6..51a80431d37f 100644 --- a/tests/lint/check_file_type.py +++ b/tests/lint/check_file_type.py @@ -148,6 +148,7 @@ "apps/microtvm/zephyr/template_project/qemu-hack/qemu-system-riscv32", "apps/microtvm/zephyr/template_project/qemu-hack/qemu-system-riscv64", "apps/microtvm/zephyr/template_project/fvp-hack/FVP_Corstone_SSE-300_Ethos-U55", + "apps/microtvm/zephyr/template_project/app-overlay/nucleo_l4r5zi.overlay", # microTVM Virtual Machines "apps/microtvm/poetry.lock", "apps/microtvm/reference-vm/Vagrantfile",