Skip to content

Commit

Permalink
[µTVM] Add ST STM32F746 disco board to tflite tutorial script (apache…
Browse files Browse the repository at this point in the history
…#7254)

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 <gustavo.romero@linaro.org>
  • Loading branch information
gromero authored and trevor-m committed Jan 21, 2021
1 parent eca0011 commit ed004c5
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tutorials/micro/micro_tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ed004c5

Please sign in to comment.