zephyr/boards/st/stm32h745i_disco/board.cmake
Abderrahmane Jarmouni e17e54c48f boards: stm32: add flashing with stm32cubeprog for all
Add STM32CubeProgrammer where it is not available, & make it
default flashing method by placing it 1st in board.cmake

Before this change, the west runner that's selected when calling
'westflash' without the '--runner ...' option is kind of arbitrary
& depends on which runner is 1st in board.cmake file.

Another reason this change is needed is that STM32CubeProg is the only
available way to check/modify Option Bytes, and to flash code to
external Flash on many STM32 boards.

This change does not affect 'west debug' behavior, which defaults to
the debugger (OpenOCD/JLink) that is included first in board.cmake

Signed-off-by: Abderrahmane Jarmouni <git@jarmouni.me>
2024-09-09 15:25:31 +03:00

23 lines
924 B
CMake

# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Alexander Kozhinov <AlexanderKozhinov@yandex.com>
# Copyright (c) 2024 Tomas Jurena <jurena@utb.cz>
# keep first
if(CONFIG_STM32_MEMMAP)
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(stm32cubeprogrammer "--extload=MT25TL01G_STM32H745I-DISCO.stldr")
else()
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
endif()
board_runner_args(jlink "--device=STM32H745XI" "--speed=4000")
if(CONFIG_BOARD_STM32H745I_DISCO_STM32H745XX_M7)
board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)
elseif(CONFIG_BOARD_STM32H745I_DISCO_STM32H745XX_M4)
board_runner_args(openocd --target-handle=_CHIPNAME.cpu1)
endif()
# keep first
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)