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 17422df537fe4c3be859244111baf3a08e0c33ca
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed Nov 27 14:16:27 2024 +0100

    hw/bsp/nordic_pca10059: Switch to use common download script
    
    With this change it's possible to flash USB dongle with
    nrfutil without connected debugger (dongle does not have
    SWD connector).
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/bsp/nordic_pca10059/bsp.yml                     | 34 +++++++++++++++++-
 hw/bsp/nordic_pca10059/nordic_pca10059_download.sh | 40 ----------------------
 hw/bsp/nordic_pca10059/pkg.yml                     |  1 +
 hw/bsp/nordic_pca10059/syscfg.yml                  | 18 +++++++++-
 4 files changed, 51 insertions(+), 42 deletions(-)

diff --git a/hw/bsp/nordic_pca10059/bsp.yml b/hw/bsp/nordic_pca10059/bsp.yml
index f8158e40e..78d73e116 100644
--- a/hw/bsp/nordic_pca10059/bsp.yml
+++ b/hw/bsp/nordic_pca10059/bsp.yml
@@ -24,7 +24,7 @@ bsp.arch: cortex_m4
 bsp.compiler: compiler/arm-none-eabi-m4
 bsp.linkerscript: autogenerated
 bsp.part2linkerscript: "hw/bsp/nordic_pca10059/split-nordic_pca10059.ld"
-bsp.downloadscript: "hw/bsp/nordic_pca10059/nordic_pca10059_download.sh"
+bsp.downloadscript: "hw/scripts/download.sh"
 bsp.debugscript: "hw/bsp/nordic_pca10059/nordic_pca10059_debug.sh"
 
 bsp.flash_map:
@@ -58,3 +58,35 @@ bsp.flash_map:
             device: 0
             offset: 0x000fc000
             size: 16kB
+
+bsp.flash_map.BSP_NRF_SDK_FLASH_LAYOUT:
+    areas:
+        # NRF52 MBR area.
+        FLASH_AREA_MBR:
+            user_id: 20
+            device: 0
+            offset: 0x00000000
+            size: 4kB
+        # NRF52 bootloader ara.
+        FLASH_AREA_NRF52_BOOTLOADER:
+            user_id: 21
+            device: 0
+            offset: 0x000E0000
+            size: 128kB
+        # mynewt image
+        FLASH_AREA_IMAGE_0:
+            device: 0
+            offset: 0x00001000
+            size: 396kB
+
+        # User areas.
+        FLASH_AREA_REBOOT_LOG:
+            user_id: 0
+            device: 0
+            offset: 0x000C8000
+            size: 16kB
+        FLASH_AREA_NFFS:
+            user_id: 1
+            device: 0
+            offset: 0x000CC000
+            size: 16kB
diff --git a/hw/bsp/nordic_pca10059/nordic_pca10059_download.sh 
b/hw/bsp/nordic_pca10059/nordic_pca10059_download.sh
deleted file mode 100755
index 9f4fade92..000000000
--- a/hw/bsp/nordic_pca10059/nordic_pca10059_download.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-# 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.
-
-# Called with following variables set:
-#  - CORE_PATH is absolute path to @apache-mynewt-core
-#  - BSP_PATH is absolute path to hw/bsp/bsp_name
-#  - BIN_BASENAME is the path to prefix to target binary,
-#    .elf appended to name is the ELF file
-#  - IMAGE_SLOT is the image slot to download to (for non-mfg-image, non-boot)
-#  - FEATURES holds the target features string
-#  - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
-#  - MFG_IMAGE is "1" if this is a manufacturing image
-#  - FLASH_OFFSET contains the flash offset to download to
-#  - BOOT_LOADER is set if downloading a bootloader
-
-. $CORE_PATH/hw/scripts/jlink.sh
-
-if [ "$MFG_IMAGE" ]; then
-    FLASH_OFFSET=0x0
-fi
-
-JLINK_DEV="nrf52840_xxaa"
-
-common_file_to_load
-jlink_load
diff --git a/hw/bsp/nordic_pca10059/pkg.yml b/hw/bsp/nordic_pca10059/pkg.yml
index 59aae1b98..66b8225a8 100644
--- a/hw/bsp/nordic_pca10059/pkg.yml
+++ b/hw/bsp/nordic_pca10059/pkg.yml
@@ -38,6 +38,7 @@ pkg.deps:
     - "@apache-mynewt-core/libc"
     - "@apache-mynewt-core/sys/flash_map"
     - "@apache-mynewt-core/boot/startup"
+    - "@apache-mynewt-core/hw/scripts"
 
 pkg.deps.SOFT_PWM:
     - "@apache-mynewt-core/hw/drivers/pwm/soft_pwm"
diff --git a/hw/bsp/nordic_pca10059/syscfg.yml 
b/hw/bsp/nordic_pca10059/syscfg.yml
index 0b67b0885..6baacb3ad 100644
--- a/hw/bsp/nordic_pca10059/syscfg.yml
+++ b/hw/bsp/nordic_pca10059/syscfg.yml
@@ -23,9 +23,25 @@ syscfg.defs:
     SOFT_PWM:
         description: 'Enable soft PWM'
         value: 0
+    BSP_NRF_SDK_FLASH_LAYOUT:
+        description: >
+            Set this to 1 when device has Nordic SDK bootloader.
+            When this is used device can be flashed with nrfutil
+            tool without debugger.
+        value: 0
+
+syscfg.BSP_NRF_SDK_FLASH_LAYOUT:
+    # Change to use Nordic DFU bootloader which is likely to be used
+    # when device still has original bootloader
+    NRFUTIL_TRAITS: nordicDfu
 
 syscfg.vals:
-    # Enable nRF52840 MCU and common startup code
+    MYNEWT_DOWNLOADER: nrfutil
+    JLINK_TARGET: nRF52840_xxAA
+    PYOCD_TARGET: nrf52840
+    NRFUTIL_TRAITS: jlink
+
+# Enable nRF52840 MCU and common startup code
     MCU_TARGET: nRF52840
     MCU_COMMON_STARTUP: 1
 

Reply via email to