Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
9b5e05a7
Commit
9b5e05a7
authored
Mar 08, 2016
by
Christopher Arndt
Committed by
Damien George
Mar 09, 2016
Browse files
stmhal: Add makefile target and configuration to deploy via OpenOCD.
parent
ad725a66
Changes
3
Hide whitespace changes
Inline
Side-by-side
stmhal/Makefile
View file @
9b5e05a7
...
...
@@ -30,6 +30,8 @@ PYDFU ?= ../tools/pydfu.py
DFU_UTIL
?=
dfu-util
DEVICE
=
0483:df11
STFLASH
?=
st-flash
OPENOCD
?=
openocd
OPENOCD_CONFIG
?=
boards/openocd_stm32f4.cfg
CROSS_COMPILE
=
arm-none-eabi-
...
...
@@ -293,6 +295,10 @@ deploy-stlink: $(BUILD)/firmware.dfu
$(ECHO)
"Writing
$(BUILD)
/firmware1.bin to the board via ST-LINK"
$(Q)$(STFLASH)
--reset
write
$(BUILD)
/firmware1.bin 0x08020000
deploy-openocd
:
$(BUILD)/firmware.dfu
$(ECHO)
"Writing
$(BUILD)
/firmware{0,1}.bin to the board via ST-LINK using OpenOCD"
$(Q)$(OPENOCD)
-f
$(OPENOCD_CONFIG)
-c
"stm_flash
$(BUILD)
/firmware0.bin
$(BUILD)
/firmware1.bin"
$(BUILD)/firmware.dfu
:
$(BUILD)/firmware.elf
$(ECHO)
"Create
$@
"
$(Q)$(OBJCOPY)
-O
binary
-j
.isr_vector
$^
$(BUILD)
/firmware0.bin
...
...
stmhal/README.md
View file @
9b5e05a7
...
...
@@ -82,6 +82,21 @@ and set the `STLINK_DEVICE` environment variable accordingly, using the format
$ make BOARD=STM32F4DISC deploy-stlink
### Flashing the Firmware with OpenOCD
Another option to deploy the firmware on ST Discovery or Nucleo boards with a
ST-LINK interface uses
[
OpenOCD
](
http://openocd.org/
)
. Connect the board with
a mini USB cable to its ST-LINK USB port and then use the make target
`deploy-openocd`
. For example, if you have the STM32F4DISCOVERY board:
$ make BOARD=STM32F4DISC deploy-openocd
The
`openocd`
program, which writes the firmware to the target board's flash,
is configured via the file
`stmhal/boards/openocd_stm32f4.cfg`
. This
configuration should work for all boards based on a STM32F4xx MCU with a
ST-LINKv2 interface. You can override the path to this configuration by setting
`OPENOCD_CONFIG`
in your Makefile or on the command line.
Accessing the board
-------------------
...
...
stmhal/boards/openocd_stm32f4.cfg
0 → 100644
View file @
9b5e05a7
# This script configures OpenOCD for use with an ST-Link V2 programmer/debugger
# and an STM32F4 target microcontroller.
#
# To flash your firmware:
#
# $ openocd -f openocd_stm32f4.cfg \
# -c "stm_flash build-BOARD/firmware0.bin build-BOARD/firmware1.bin"
#
# For a gdb server on port 3333:
#
# $ openocd -f openocd_stm32f4.cfg
source [find interface/stlink-v2.cfg]
transport select hla_swd
source [find target/stm32f4x.cfg]
reset_config srst_only
init
proc stm_flash { BIN0 BIN1 } {
reset halt
sleep 100
wait_halt 2
flash write_image erase $BIN0 0x08000000
sleep 100
verify_image $BIN0 0x08000000
sleep 100
flash write_image erase $BIN1 0x08020000
sleep 100
verify_image $BIN1 0x08020000
sleep 100
reset run
shutdown
}
proc stm_erase {} {
reset halt
sleep 100
stm32f4x mass_erase 0
sleep 100
shutdown
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment