From fb21f62b34d311b96c0726c4540dc80170b5865a Mon Sep 17 00:00:00 2001 From: Niklas Hauser Date: Thu, 19 Dec 2019 21:28:35 +0100 Subject: [PATCH] [board] Add OpenOCD script for Nucleo-G0 boards --- src/modm/board/nucleo_g071rb/module.lb | 15 ++++++++++----- tools/openocd/modm/st_nucleo_g0.cfg | 11 +++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 tools/openocd/modm/st_nucleo_g0.cfg diff --git a/src/modm/board/nucleo_g071rb/module.lb b/src/modm/board/nucleo_g071rb/module.lb index 3ee036008d..da40bcefa1 100644 --- a/src/modm/board/nucleo_g071rb/module.lb +++ b/src/modm/board/nucleo_g071rb/module.lb @@ -23,7 +23,7 @@ def prepare(module, options): return False module.depends(":platform:core", ":platform:gpio", ":platform:clock", ":platform:uart:2", - ":debug", ":architecture:clock", ":architecture:clock") + ":debug", ":architecture:clock") return True def build(env): @@ -32,7 +32,12 @@ def build(env): env.template("../board.cpp.in", "board.cpp") env.copy('.') - # Waiting on this patch to OpenOCD http://openocd.zylin.com/#/c/4807 - # env.outbasepath = "modm/openocd/modm/board/" - # env.copy(repopath("tools/openocd/modm/st_nucleo_g0.cfg"), "st_nucleo_g0.cfg") - # env.collect(":build:openocd.source", "modm/board/st_nucleo_g0.cfg") + # Waiting on OpenOCD to add support for STM32G0 + env.log.warning("\nUploading firmware and debugging for STM32G0 via OpenOCD requires this patch: http://openocd.zylin.com/#/c/4807" + "\nAlternatively you may copy the compiled binary onto the Nucleo USB Mass-Storage Device manually:" + "\n $ scons bin && cp path/to/build/release/project.bin /Volumes/NODE_G071RB") + + # The patch doesn't include board config file though + env.outbasepath = "modm/openocd/modm/board/" + env.copy(repopath("tools/openocd/modm/st_nucleo_g0.cfg"), "st_nucleo_g0.cfg") + env.collect(":build:openocd.source", "modm/board/st_nucleo_g0.cfg") diff --git a/tools/openocd/modm/st_nucleo_g0.cfg b/tools/openocd/modm/st_nucleo_g0.cfg new file mode 100644 index 0000000000..fd063fddb2 --- /dev/null +++ b/tools/openocd/modm/st_nucleo_g0.cfg @@ -0,0 +1,11 @@ +# Should work with all STM32G0 Nucleo Dev Boards. +# http://www.st.com/en/evaluation-tools/stm32-mcu-nucleo.html + +source [find interface/stlink.cfg] + +transport select hla_swd + +source [find target/stm32g0x.cfg] + +# use hardware reset +reset_config srst_only srst_nogate