This is an automated email from the ASF dual-hosted git repository.

leandron pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 7e3f068  [microTVM] Add Nucleo stm32l4r5zi board to zephyr (#8386)
7e3f068 is described below

commit 7e3f068373937c0ae08d58f67b84030a027db1c9
Author: Mehrdad Hessar <[email protected]>
AuthorDate: Sat Jul 3 03:48:06 2021 -0700

    [microTVM] Add Nucleo stm32l4r5zi board to zephyr (#8386)
    
    * add stm32l4r5zi_nucleo
    
    * add parameter for test qemu
    
    * file type check
    
    * fix test
    
    * change order
    
    * revert
---
 .../zephyr/aot_demo/boards/nucleo_l4r5zi.conf      | 31 ++++++++++++++++++++++
 apps/microtvm/zephyr/aot_demo/src/zephyr_uart.c    |  6 +++++
 .../zephyr/host_driven/boards/nucleo_l4r5zi.conf   | 31 ++++++++++++++++++++++
 python/tvm/micro/contrib/zephyr.py                 |  1 +
 python/tvm/target/target.py                        |  5 ++--
 tests/lint/check_file_type.py                      |  2 ++
 tests/micro/zephyr/conftest.py                     |  7 ++---
 7 files changed, 78 insertions(+), 5 deletions(-)

diff --git a/apps/microtvm/zephyr/aot_demo/boards/nucleo_l4r5zi.conf 
b/apps/microtvm/zephyr/aot_demo/boards/nucleo_l4r5zi.conf
new file mode 100644
index 0000000..52a6753
--- /dev/null
+++ b/apps/microtvm/zephyr/aot_demo/boards/nucleo_l4r5zi.conf
@@ -0,0 +1,31 @@
+# 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.
+#
+# This file is specific to the STM32L4R5ZI Nucleo board.
+
+# For intrinsics used by generated optimized operators.
+CONFIG_CMSIS_DSP=y
+
+# For AOT runtime which requires lots of function call.
+CONFIG_MAIN_STACK_SIZE=3000
+
+# For random number generation.
+CONFIG_ENTROPY_GENERATOR=y
+CONFIG_TEST_RANDOM_GENERATOR=y
+
+# For debugging.
+CONFIG_LED=y
diff --git a/apps/microtvm/zephyr/aot_demo/src/zephyr_uart.c 
b/apps/microtvm/zephyr/aot_demo/src/zephyr_uart.c
index c9eec87..0240158 100644
--- a/apps/microtvm/zephyr/aot_demo/src/zephyr_uart.c
+++ b/apps/microtvm/zephyr/aot_demo/src/zephyr_uart.c
@@ -77,5 +77,11 @@ uint32_t TVMPlatformWriteSerial(const char* data, uint32_t 
size) {
 void TVMPlatformUARTInit() {
   // Claim console device.
   g_microtvm_uart = device_get_binding(DT_LABEL(DT_CHOSEN(zephyr_console)));
+  const struct uart_config config = {.baudrate = 115200,
+                                     .parity = UART_CFG_PARITY_NONE,
+                                     .stop_bits = UART_CFG_STOP_BITS_1,
+                                     .data_bits = UART_CFG_DATA_BITS_8,
+                                     .flow_ctrl = UART_CFG_FLOW_CTRL_NONE};
+  uart_configure(g_microtvm_uart, &config);
   uart_rx_init(&uart_rx_rbuf, g_microtvm_uart);
 }
diff --git a/apps/microtvm/zephyr/host_driven/boards/nucleo_l4r5zi.conf 
b/apps/microtvm/zephyr/host_driven/boards/nucleo_l4r5zi.conf
new file mode 100644
index 0000000..b872060
--- /dev/null
+++ b/apps/microtvm/zephyr/host_driven/boards/nucleo_l4r5zi.conf
@@ -0,0 +1,31 @@
+# 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.
+#
+# This file is specific to the STM32L4R5ZI Nucleo board.
+
+# For intrinsics used by generated optimized operators.
+CONFIG_CMSIS_DSP=y
+
+# For operations that stack allocates a large float array.
+CONFIG_MAIN_STACK_SIZE=1536
+
+# For random number generation.
+CONFIG_ENTROPY_GENERATOR=y
+CONFIG_TEST_RANDOM_GENERATOR=y
+
+# For debugging.
+CONFIG_LED=y
diff --git a/python/tvm/micro/contrib/zephyr.py 
b/python/tvm/micro/contrib/zephyr.py
index 3c79c20..77cfb8d 100644
--- a/python/tvm/micro/contrib/zephyr.py
+++ b/python/tvm/micro/contrib/zephyr.py
@@ -406,6 +406,7 @@ class ZephyrFlasher(tvm.micro.compiler.Flasher):
 
     # kwargs passed to usb.core.find to find attached boards for the openocd 
flash runner.
     BOARD_USB_FIND_KW = {
+        "nucleo_l4r5zi": {"idVendor": 0x0483, "idProduct": 0x374B},
         "nucleo_f746zg": {"idVendor": 0x0483, "idProduct": 0x374B},
         "stm32f746g_disco": {"idVendor": 0x0483, "idProduct": 0x374B},
     }
diff --git a/python/tvm/target/target.py b/python/tvm/target/target.py
index a9ff929..0d3feaa 100644
--- a/python/tvm/target/target.py
+++ b/python/tvm/target/target.py
@@ -281,9 +281,10 @@ def intel_graphics(model="unknown", options=None):
 
 MICRO_SUPPORTED_MODELS = {
     "host": [],
-    "stm32f746xx": ["-mcpu=cortex-m7", "-march=armv7e-m"],
-    "nrf5340dk": ["-mcpu=cortex-m33"],
     "mps2_an521": ["-mcpu=cortex-m33"],
+    "nrf5340dk": ["-mcpu=cortex-m33"],
+    "stm32f746xx": ["-mcpu=cortex-m7", "-march=armv7e-m"],
+    "stm32l4r5zi": ["-mcpu=cortex-m4"],
 }
 
 
diff --git a/tests/lint/check_file_type.py b/tests/lint/check_file_type.py
index a7fb76b..7250a3c 100644
--- a/tests/lint/check_file_type.py
+++ b/tests/lint/check_file_type.py
@@ -144,6 +144,7 @@ ALLOW_SPECIFIC_FILE = {
     "apps/microtvm/zephyr/host_driven/boards/nucleo_f746zg.conf",
     "apps/microtvm/zephyr/host_driven/boards/stm32f746g_disco.conf",
     "apps/microtvm/zephyr/host_driven/boards/mps2_an521.conf",
+    "apps/microtvm/zephyr/host_driven/boards/nucleo_l4r5zi.conf",
     "apps/microtvm/zephyr/host_driven/qemu-hack",
     "apps/microtvm/zephyr/aot_demo/prj.conf",
     "apps/microtvm/zephyr/aot_demo/boards/qemu_x86.conf",
@@ -153,6 +154,7 @@ ALLOW_SPECIFIC_FILE = {
     "apps/microtvm/zephyr/aot_demo/boards/nucleo_f746zg.conf",
     "apps/microtvm/zephyr/aot_demo/boards/stm32f746g_disco.conf",
     "apps/microtvm/zephyr/aot_demo/boards/mps2_an521.conf",
+    "apps/microtvm/zephyr/aot_demo/boards/nucleo_l4r5zi.conf",
     "apps/microtvm/zephyr/aot_demo/qemu-hack",
     # microTVM Virtual Machines
     "apps/microtvm/reference-vm/zephyr/Vagrantfile",
diff --git a/tests/micro/zephyr/conftest.py b/tests/micro/zephyr/conftest.py
index 6ca5a53..b1677e6 100644
--- a/tests/micro/zephyr/conftest.py
+++ b/tests/micro/zephyr/conftest.py
@@ -24,10 +24,11 @@ PLATFORMS = {
     "host": ("host", "qemu_x86"),
     "host_riscv32": ("host", "qemu_riscv32"),
     "host_riscv64": ("host", "qemu_riscv64"),
-    "stm32f746xx_nucleo": ("stm32f746xx", "nucleo_f746zg"),
-    "stm32f746xx_disco": ("stm32f746xx", "stm32f746g_disco"),
-    "nrf5340dk": ("nrf5340dk", "nrf5340dk_nrf5340_cpuapp"),
     "mps2_an521": ("mps2_an521", "mps2_an521-qemu"),
+    "nrf5340dk": ("nrf5340dk", "nrf5340dk_nrf5340_cpuapp"),
+    "stm32f746xx_disco": ("stm32f746xx", "stm32f746g_disco"),
+    "stm32f746xx_nucleo": ("stm32f746xx", "nucleo_f746zg"),
+    "stm32l4r5zi_nucleo": ("stm32l4r5zi", "nucleo_l4r5zi"),
 }
 
 

Reply via email to