From 515d6db90bb27b32d0288f50e8dfd311ef23037b Mon Sep 17 00:00:00 2001 From: Gustavo Romero Date: Mon, 11 Jan 2021 22:20:46 +0000 Subject: [PATCH] =?UTF-8?q?[=C2=B5TVM]=20Add=20ST=20STM32F746=20disco=20bo?= =?UTF-8?q?ard=20to=20tflite=20tutorial=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently tutorial script 'micro_tflite.py' assumes that all boards with target STM32F746 are Nucleo boards. As a consequence once that target is selected the script automatically defaults to the Nucleo board. However, the STM32F746 is also used on Discovery Kit boards (aka disco) which are quite similar but have some differences, so Nucleo config and final image don't work on the disco boards. That commit adds a way to select a different dev board and adds comments accordingly, informing how to use the script with STM32F746 disco boards. Signed-off-by: Gustavo Romero --- tutorials/micro/micro_tflite.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tutorials/micro/micro_tflite.py b/tutorials/micro/micro_tflite.py index feabcf71ae2c..c28918380265 100644 --- a/tutorials/micro/micro_tflite.py +++ b/tutorials/micro/micro_tflite.py @@ -179,13 +179,17 @@ # %% # Compiling for physical hardware -# When running on physical hardware, choose a target that describes -# the hardware. The STM32F746 Nucleo target is chosen in this commented -# code: +# When running on physical hardware, choose a target and a board that +# describe the hardware. The STM32F746 Nucleo target and board is chosen in +# this commented code. Another option would be to choose the same target but +# the STM32F746 Discovery board instead. The disco board has the same +# microcontroller as the Nucleo board but a couple of wirings and configs +# differ, so it's necessary to select the "stm32f746g_disco" board below. # # .. code-block:: python # # TARGET = tvm.target.target.micro("stm32f746xx") +# BOARD = "nucleo_f746zg" # or "stm32f746g_disco" ###################################################################### # Now, compile the model for the target: @@ -217,12 +221,12 @@ # repo_root = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], encoding='utf-8').strip() # project_dir = f"{repo_root}/tests/micro/qemu/zephyr-runtime" # compiler = zephyr.ZephyrCompiler( -# project_dir=project_dir, -# board="nucleo_f746zg" if "stm32f746" in str(TARGET) else "qemu_x86", -# zephyr_toolchain_variant="zephyr", -# ) +# project_dir=project_dir, +# board=BOARD if "stm32f746" in str(TARGET) else "qemu_x86", +# zephyr_toolchain_variant="zephyr", +# ) # -# opts = tvm.micro.default_options(os.path.join(tvm.micro.CRT_ROOT_DIR, "host")) +# opts = tvm.micro.default_options(f"{project_dir}/crt") workspace = tvm.micro.Workspace() micro_binary = tvm.micro.build_static_runtime(