This is an automated email from the ASF dual-hosted git repository. kasjer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit c711a45a3aae0fb62bb98c9cabc223c2dfd787ba Author: Jerzy Kasenberg <[email protected]> AuthorDate: Sun Oct 18 20:59:13 2026 +0200 hw/bsp/olimex-pic32: Use common PIC32 download script olimex-pic32-hmz144 and olimex-pic32-emz64 now use hw/scripts/pic32_download.sh instead of BSP specific download.sh. Device name for programmers is provided with JLINK_TARGET, J-Link remains default downloader; PICkit/Snap/ICD can be used by setting MYNEWT_DOWNLOADER to mplab_ipe in target. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jerzy Kasenberg <[email protected]> --- hw/bsp/olimex-pic32-emz64/bsp.yml | 2 +- hw/bsp/olimex-pic32-emz64/download.sh | 67 ---------------------------------- hw/bsp/olimex-pic32-emz64/pkg.yml | 1 + hw/bsp/olimex-pic32-emz64/syscfg.yml | 3 ++ hw/bsp/olimex-pic32-hmz144/bsp.yml | 2 +- hw/bsp/olimex-pic32-hmz144/download.sh | 62 ------------------------------- hw/bsp/olimex-pic32-hmz144/pkg.yml | 1 + hw/bsp/olimex-pic32-hmz144/syscfg.yml | 3 ++ 8 files changed, 10 insertions(+), 131 deletions(-) diff --git a/hw/bsp/olimex-pic32-emz64/bsp.yml b/hw/bsp/olimex-pic32-emz64/bsp.yml index c60d740e3..669565f71 100644 --- a/hw/bsp/olimex-pic32-emz64/bsp.yml +++ b/hw/bsp/olimex-pic32-emz64/bsp.yml @@ -23,7 +23,7 @@ bsp.maker: "Olimex" bsp.arch: pic32 bsp.compiler: "@apache-mynewt-core/compiler/xc32" -bsp.downloadscript: "hw/bsp/olimex-pic32-emz64/download.sh" +bsp.downloadscript: "hw/scripts/pic32_download.sh" bsp.debugscript: "hw/bsp/olimex-pic32-emz64/debug.sh" bsp.linkerscript: - "@apache-mynewt-core/hw/mcu/microchip/pic32mz/p32mz_app.ld" diff --git a/hw/bsp/olimex-pic32-emz64/download.sh b/hw/bsp/olimex-pic32-emz64/download.sh deleted file mode 100755 index e1b5e2671..000000000 --- a/hw/bsp/olimex-pic32-emz64/download.sh +++ /dev/null @@ -1,67 +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 - -if [ "${HWTOOL}" = "pickit3" ]; then - . $CORE_PATH/hw/scripts/mplab_mdb.sh - - export DEVICE=PIC32MZ2048EFH064 - - mdb_load - -else - - echo "r" > script - echo "h" >> script - if [ "$BOOT_LOADER" -o "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" == "1" ]; then - xc32-objcopy -O ihex ${BIN_BASENAME}.elf ${BIN_BASENAME}.hex - echo "loadfile ${BIN_BASENAME}.hex" >> script - else - cp ${BIN_BASENAME}.img ${BIN_BASENAME}.bin - echo "loadfile ${BIN_BASENAME}.bin 0x1d000000" >> script - fi - if [ "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" != "1" ]; then - echo "r" >> script - echo "g" >> script - fi - echo "q" >> script - - JLink${COMSPEC:+.}Exe -AutoConnect 1 -Device PIC32MZ2048EFH064 -If ICSP -speed 12000 -CommandFile script - - if [ "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" == "1" ]; then - # Application started from boot flash by debugger reset and go does - # not run (first context switch never happens). Pulse MCLR without - # connecting to the target instead. - echo "r0" > script - echo "sleep 200" >> script - echo "r1" >> script - echo "q" >> script - JLink${COMSPEC:+.}Exe -Device PIC32MZ2048EFH064 -If ICSP -CommandFile script - fi -fi diff --git a/hw/bsp/olimex-pic32-emz64/pkg.yml b/hw/bsp/olimex-pic32-emz64/pkg.yml index bc8dc6699..c2146dd34 100644 --- a/hw/bsp/olimex-pic32-emz64/pkg.yml +++ b/hw/bsp/olimex-pic32-emz64/pkg.yml @@ -36,3 +36,4 @@ pkg.deps: - "@apache-mynewt-core/hw/mcu/microchip/pic32mz" - "@apache-mynewt-core/libc" - "@apache-mynewt-core/hw/drivers/flash/spiflash" + - "@apache-mynewt-core/hw/scripts" diff --git a/hw/bsp/olimex-pic32-emz64/syscfg.yml b/hw/bsp/olimex-pic32-emz64/syscfg.yml index 1f6572d24..28769bcf8 100644 --- a/hw/bsp/olimex-pic32-emz64/syscfg.yml +++ b/hw/bsp/olimex-pic32-emz64/syscfg.yml @@ -28,6 +28,9 @@ syscfg.defs: range: 8000000, 24000000, 50000000, 100000000, 200000000 syscfg.vals: + # Device name for programmers, J-Link or MPLAB IPE (MYNEWT_DOWNLOADER: mplab_ipe) + JLINK_TARGET: PIC32MZ2048EFH064 + MYNEWT_DOWNLOADER: jlink TIMER_0: 1 I2C_3: 1 I2C_3_FREQ_KHZ: 400 diff --git a/hw/bsp/olimex-pic32-hmz144/bsp.yml b/hw/bsp/olimex-pic32-hmz144/bsp.yml index 2399de433..e68e717a6 100644 --- a/hw/bsp/olimex-pic32-hmz144/bsp.yml +++ b/hw/bsp/olimex-pic32-hmz144/bsp.yml @@ -23,7 +23,7 @@ bsp.maker: "Olimex" bsp.arch: pic32 bsp.compiler: "@apache-mynewt-core/compiler/xc32" -bsp.downloadscript: "hw/bsp/olimex-pic32-hmz144/download.sh" +bsp.downloadscript: "hw/scripts/pic32_download.sh" bsp.debugscript: "hw/bsp/olimex-pic32-hmz144/debug.sh" bsp.linkerscript: - "@apache-mynewt-core/hw/mcu/microchip/pic32mz/p32mz_app.ld" diff --git a/hw/bsp/olimex-pic32-hmz144/download.sh b/hw/bsp/olimex-pic32-hmz144/download.sh deleted file mode 100755 index 597987ae1..000000000 --- a/hw/bsp/olimex-pic32-hmz144/download.sh +++ /dev/null @@ -1,62 +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 - -if [ "${HWTOOL}" = "pickit3" ]; then - echo "pickit3 not supported yet" -else - - echo "r" > script - echo "h" >> script - if [ "$BOOT_LOADER" -o "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" == "1" ]; then - xc32-objcopy -O ihex ${BIN_BASENAME}.elf ${BIN_BASENAME}.hex - echo "loadfile ${BIN_BASENAME}.hex" >> script - else - cp ${BIN_BASENAME}.img ${BIN_BASENAME}.bin - echo "loadfile ${BIN_BASENAME}.bin 0x1d000000" >> script - fi - if [ "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" != "1" ]; then - echo "r" >> script - echo "g" >> script - fi - echo "q" >> script - - JLink${COMSPEC:+.}Exe -AutoConnect 1 -Device PIC32MZ2048EFM144 -If ICSP -speed 12000 -CommandFile script - - if [ "$MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD" == "1" ]; then - # Application started from boot flash by debugger reset and go does - # not run (first context switch never happens). Pulse MCLR without - # connecting to the target instead. - echo "r0" > script - echo "sleep 200" >> script - echo "r1" >> script - echo "q" >> script - JLink${COMSPEC:+.}Exe -Device PIC32MZ2048EFM144 -If ICSP -CommandFile script - fi -fi diff --git a/hw/bsp/olimex-pic32-hmz144/pkg.yml b/hw/bsp/olimex-pic32-hmz144/pkg.yml index 9fcc5305c..d4c853223 100644 --- a/hw/bsp/olimex-pic32-hmz144/pkg.yml +++ b/hw/bsp/olimex-pic32-hmz144/pkg.yml @@ -36,3 +36,4 @@ pkg.deps: - "@apache-mynewt-core/hw/mcu/microchip/pic32mz" - "@apache-mynewt-core/libc" - "@apache-mynewt-core/hw/drivers/flash/spiflash" + - "@apache-mynewt-core/hw/scripts" diff --git a/hw/bsp/olimex-pic32-hmz144/syscfg.yml b/hw/bsp/olimex-pic32-hmz144/syscfg.yml index 9af0b0651..2cc4ac3f7 100644 --- a/hw/bsp/olimex-pic32-hmz144/syscfg.yml +++ b/hw/bsp/olimex-pic32-hmz144/syscfg.yml @@ -28,6 +28,9 @@ syscfg.defs: range: 8000000, 24000000, 50000000, 100000000, 200000000 syscfg.vals: + # Device name for programmers, J-Link or MPLAB IPE (MYNEWT_DOWNLOADER: mplab_ipe) + JLINK_TARGET: PIC32MZ2048EFM144 + MYNEWT_DOWNLOADER: jlink TIMER_0: 1 # UART_1 available on UEXT header
