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

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 87bc74b318031b54c7c3f8198f08bc5b960ff844
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri May 19 14:05:47 2023 +0200

    hw/scripts: download: Add partial support for ezFlashCLI
    
    This change partial support for ezFlashCLI.
    It is not possible to flash program header yet so bootloader should
    not be flash this way (yet).
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/scripts/download.sh   |  5 +++++
 hw/scripts/ezflashcli.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 hw/scripts/syscfg.yml    |  2 ++
 3 files changed, 57 insertions(+)

diff --git a/hw/scripts/download.sh b/hw/scripts/download.sh
index 840a019c3..c5f6b1444 100644
--- a/hw/scripts/download.sh
+++ b/hw/scripts/download.sh
@@ -38,6 +38,11 @@ if [ "$MFG_IMAGE" ]; then
 fi
 
 case "${MYNEWT_VAL_MYNEWT_DOWNLOADER}" in
+  "ezflashcli")
+    . $CORE_PATH/hw/scripts/ezflashcli.sh
+    common_file_to_load
+    ezflashcli_load
+    ;;
   "jlink")
     . $CORE_PATH/hw/scripts/jlink.sh
     if [ -z "${MYNEWT_VAL_JLINK_TARGET}"] ; then
diff --git a/hw/scripts/ezflashcli.sh b/hw/scripts/ezflashcli.sh
new file mode 100644
index 000000000..f0b823da1
--- /dev/null
+++ b/hw/scripts/ezflashcli.sh
@@ -0,0 +1,50 @@
+# 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.
+#
+. $CORE_PATH/hw/scripts/common.sh
+
+#
+# FILE_NAME must contain the name of the file to load
+# FLASH_OFFSET must contain the offset in flash where to place it
+#
+ezflashcli_load () {
+    if [ -z ${FILE_NAME} ]; then
+        echo "Missing filename"
+        exit 1
+    fi
+    if [ ! -f "${FILE_NAME}" ]; then
+        # tries stripping current path for readability
+        FILE=${FILE_NAME##$(pwd)/}
+        echo "Cannot find file" $FILE
+        exit 1
+    fi
+    if [ -z ${FLASH_OFFSET} ]; then
+        echo "Missing flash offset"
+        exit 1
+    fi
+
+    echo "Downloading" $FILE "to" $FLASH_OFFSET
+
+    ezFlashCLI write_flash ${FLASH_OFFSET} ${FILE_NAME}
+    ezFlashCLI go
+
+    if [ $? -ne 0 ]; then
+        exit 1
+    fi
+
+    return 0
+}
diff --git a/hw/scripts/syscfg.yml b/hw/scripts/syscfg.yml
index f0ac27713..f21c72f28 100644
--- a/hw/scripts/syscfg.yml
+++ b/hw/scripts/syscfg.yml
@@ -32,6 +32,8 @@ syscfg.defs:
             - pyocd
             # Nordic Semiconductor tool for NRF5x devices
             - nrfjprog
+            # Renesas ezFlashCLI for DA146x devices
+            - ezflashcli
         value:
     MYNEWT_DEBUGGER:
         description: >

Reply via email to