Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Nov 15, 2022
1 parent 0669c34 commit f47a3f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ set(QEMU_PIPE <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 <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
Expand Down
21 changes: 11 additions & 10 deletions apps/microtvm/zephyr/template_project/microtvm_api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down Expand Up @@ -470,7 +470,6 @@ def _create_prj_conf(
API_SERVER_CRT_LIBS_TOKEN = "<API_SERVER_CRT_LIBS>"
CMAKE_ARGS_TOKEN = "<CMAKE_ARGS>"
QEMU_PIPE_TOKEN = "<QEMU_PIPE>"
CMSIS_PATH_TOKEN = "<CMSIS_PATH>"

CRT_LIBS_BY_PROJECT_TYPE = {
"host_driven": "microtvm_rpc_server microtvm_rpc_common aot_executor_module aot_executor common",
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f47a3f1

Please sign in to comment.