1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

52 Commits

Author SHA1 Message Date
7e21f25779
make: namespace openocd PRE_FLASH_CHECK_SCRIPT variable 2021-02-23 21:22:55 +01:00
Gilles DOFFE
cca2d70808 tools/openocd: add stlink-dap adapter
stlink-dap adapter is based on stlink-dap.cfg and is used by
STM32MP1 family.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
8a35e114c0 tools/openocd: add GDB_PORT_CORE_OFFSET variable
In case of muticore CPU, openocd opens one debug port by core for gdb.
Thus add a GDB_PORT_CORE_OFFSET port offset to select the right port
for debugging.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
5424ef1dfe tools/openocd: add flashr action
As for debugr, boards like stm32mp157c-dk2 does not have flash memory.
The firmware could be flashed using the operating system (mainly Linux) or
the bootloader (mainly u-boot) of the dual architecture (cortex-A7 on
stm32mp157c-dk2). However in engineering mode (only cortex-M4), the
firmware has to be flashed using jtag once the board is powered up.
The flashr action do this using openocd only.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
4f3ea5c74c tools/openocd: select target core
For multi-arch SoC like STM32MP1, the right target core has
to be selected to avoid debugging the wrong default cpu.
This is done using openocd command 'targets ${OPENOCD_CORE}'.
OPENOCD_CORE has to be set in board Makefile.include file.
In case it is not set, the command just display available targets, thus it
has no effect on already existing boards using openocd.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Gilles DOFFE
e7b344983d tools/openocd: add debugr action
In case of STM32MP157c-dk2 board, there is no flash available. Thus,
the elf binary has to be flashed directly to SRAM before debugging.
To do so, the DBG_FLAGS variable has to be overrided to load the binary
using 'load' gdb command.
The START_ADDR variable is the entrypoint extracted from the elf binary
using objdump tool.
The do_debug function can now be used as usual.

Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
2020-11-13 10:43:08 +01:00
Jelle Haandrikman
f18d3f5663
dist/tools/openocd/stlink: handle new and old Openocd version 2020-08-31 17:34:25 +02:00
aff18b9599
tools/openocd: add OPENOCD_DBG_EXTRA_CMD 2020-06-09 10:14:57 +02:00
Karl Fessel
f00f1254ec tools/openocd: Fix Flash probing for nucleo-f747zi 2020-02-28 13:53:20 +01:00
Karl Fessel
979b4d5cf7 Revert "boards/nucleo-f767zi: add correct flash bank openocd config"
This reverts commits:
    - 1dec5ba61b
    - 53f60db66f
2020-02-28 13:51:58 +01:00
f451eb692c
Merge pull request #13452 from aabadie/pr/tools/openocd_config_export
tools/openocd: only export OPENOCD_CONFIG to required targets
2020-02-25 15:11:38 +01:00
bd081cd980
tools/openocd: remove default OPENOCD_CONFIG value
The default value is already set in openocd.inc.mk
2020-02-24 10:04:11 +01:00
chrysn
1dbf07f926 openocd: Add instructions for overriding OPENOCD 2020-02-14 09:42:20 +01:00
chrysn
ac8ed1eb13 openocd: Allow using OpenOCD-shipped configs
OpenOCD already ships config files for the EFM32 and EFR32 family, no
need to duplicate them in RIOT; this removes the "file exists" check for
files that are clearly OpenOCD-shipped board configurations, as the
script can't (and shouldn't) know OpenOCD's include paths.
2020-02-14 09:24:25 +01:00
Francisco Molina
53f60db66f dist/tools/openocd/openocd.sh: add FLASH_BANK
Allow specifying index of `flash bank` to read configuration from
in cases where the configuration provided in openocd is incorrect.

This is the case for the majority of stm32 boards where it relies
on `flash probe` to get the correct value.
2020-01-27 22:32:00 +01:00
Gaëtan Harter
41a891f284
tools: use 'BOARDSDIR' for the boards directory
Replace uses of 'RIOTBOARD' by 'BOARDSDIR' for tools.
2019-12-16 15:35:04 +01:00
Sebastian Meiling
364c831bf3 tools: fix shebang in openocd.sh
Change shebang in script from `/bin/bash` to `/usr/bin/env bash`,
which fixed problems when `bash` is not available in standard location,
e.g., on non-Linux OSes such as FreeBSD.
2019-09-16 11:27:33 +02:00
9065f8358c
tools/openocd: correctly check reset_config variable value
This avoids the following warning message when running OpenOCD: 'openocd.sh: line 124: [: : integer expression expected'
2019-09-03 12:44:09 +02:00
Francisco Molina
900875c603 dist/tools/openocd: add OPENOCD_EXTRA_INIT_RESET
- Add a variable to add extra openocd commands before resetting
  a board. These will not be called when `debug`, in contrast
  to OPENOCD_CONFIG, OPENOCD_EXTRA_INIT and OPENOCD_ADAPTER_INIT.
- Add connect_assert_srst to reset config if
  OPENOCD_RESET_USE_CONNECT_ASSERT_SRST=1
2019-09-02 14:53:51 +02:00
Gaëtan Harter
468e4084f2
tools/openocd.sh: probe the board for real flash address on binary flash
Some boards have a configuration of the flash bank with an address of 0
when it actually starts as 0x08000000 but openocd relies on probing
the hardware at runtime.

This now allows to first probe the board to get the actual value.
If probing fail for any reason, return the value from the configuration.
This can happen when the board is unreachable so at least give a valid
output instead of an error.

This will allow correct flash detection on for example the `stm32f3` and
`stm32l4` which have a configured address of 0.

4a6f93c961/tcl/target/stm32f3x.cfg (L64)
4a6f93c961/tcl/target/stm32l4x.cfg (L51)
2019-05-17 18:28:27 +02:00
3583b00750 dist/tools/openocd: make "reset run" command configurable
Co-Authored-By: jcarrano <juan@carrano.com.ar>
2019-03-12 11:49:02 +01:00
Gaëtan Harter
a0b97ad737
openocd: get flash and debug files from cli
Get FLASH_FILE and ELFFILE from command line instead of environment variable.

The documentation was claiming ELFFILE was given as a command line argument
already, but is was not.
2018-12-05 16:21:03 +01:00
cladmi
a7779e24c5
openocd.sh: handle 'newline' on osx
https://stackoverflow.com/a/24276470

    In replacement strings used with the s command, assume that NO
    control-character escape sequences are supported (ex '\n')

Replace with an escaped newline character. Current form works in 'bash'.
2018-10-30 19:44:37 +01:00
cladmi
6f02568c84
openocd.sh: split 'sed' commands on different lines
https://stackoverflow.com/a/24276470

    Labels and branching commands (e.g., b) must be followed by an actual
    newline or continuation via a separate -e option.
2018-10-30 19:44:37 +01:00
cladmi
291a80c664
openocd.sh: refactor splitting banks in a separate function
Prepare for other refactoring.
2018-10-30 19:44:37 +01:00
cladmi
bc7e53f3d4
openocd.sh: include base address in IMAGE_OFFSET for binfiles
Add the rom base address to the flash address when flashing binaries.
This allows flashing binaries with the default openocd configuration.

It is an API change to IMAGE_OFFSET with binary files as it should now
only be an offset to the base address.

Force openocd type to '.bin' in case we want to flash hex/elf objects or
files not automatically recognized as bin.
2018-09-04 13:53:38 +02:00
cladmi
36b51467dd
openocd.sh: add functions to access board flash address
This allows getting the ROM base address.

It may not be available in the build system directly so better extract it from
openocd. Also openocd is board specific and this address is cpu specific
so would have definition order issue in the build system.
2018-09-04 13:50:46 +02:00
cladmi
5748d6a75f
openocd.sh: add a _is_binfile function
Returns 0 if it is true.

The test is based on the file extension, but also use the IMAGE_TYPE variable
to force setting to binary.
2018-09-04 13:49:45 +02:00
cladmi
60aac4a75b
openocd.sh: fix verify_image with IMAGE_OFFSET
When flashing with an IMAGE_OFFSET, it should also be passed to
verify_image. It is handling the base address in the image too.

This works with both elf files and binaries with the base address added.
2018-09-04 13:48:16 +02:00
cladmi
09f0930f59
openocd.sh: add a debug message when flashing with an offset 2018-09-04 13:48:12 +02:00
cladmi
5bb9babfe0
openocd.sh: update to bash
Update to bash to have `local` variables and `=~` regex matching.
Will be used in upcoming commits.
2018-09-04 13:46:25 +02:00
2172074598 dist/tools/openocd: make reset before halt option in debug 2018-04-18 17:33:30 +02:00
Joakim Nohlgård
57de166ea1 makefiles: Refactor openocd tool handling
Attempt to decouple board configuration from debugger interface
configuration by specifying the DEBUG_IFACE variable for the debug
hardware interface to use.
2017-11-17 10:03:05 +01:00
Joakim Nohlgård
dd95f593a0 openocd: Run verify after write without intermediate reset
Fixes problems with the watchdog interfering on Kinetis K devices
when USE_OLD_OPENOCD=0.
2017-10-18 14:34:20 +02:00
Joakim Nohlgård
7713bede99 openocd: Refactor openocd.sh script
- Merge flash and flash-elf commands since they were identical except
  for the file name of the image
- Split GDB command from DBG environment variable to allow more easily
  configure front-ends for GDB via environment variables.
- Remove verbose tests of empty variables and replace by `: ${VAR:=default}`
- Remove passed command line arguments to sub-functions, they were
  unused in the functions anyway.
- Remove TUI variable, use `export DBG_EXTRA_FLAGS=-tui` to get the same
  result.
2017-10-18 14:34:20 +02:00
8601285b13 openocd: return error if flashing went wrong 2016-07-27 17:42:06 +02:00
Toon Stegen
cf431e696c make debug: start gdb quietly 2016-04-22 12:00:10 +02:00
Joakim Nohlgård
98c465008b all: Update @gebart family name, email 2015-09-20 13:47:39 +02:00
daniel-k
78b98b3b1c debugging: fix openocd closing when pressing Ctrl+C in GDB, fix #3427 2015-08-29 19:17:24 +02:00
daniel-k
03542161dd openocd: don't reset cpu for target 'debug' 2015-07-13 17:22:54 +02:00
Joakim Gebart
527750c496 dist: openocd.sh: Add PRE_FLASH_CHECK_SCRIPT 2015-05-27 10:30:33 +02:00
Johann Fischer
21141cd389 dist/tools/openocd/openocd.sh: Add flash-elf command 2015-05-27 10:30:33 +02:00
Joakim Gebart
f5c67ebe62 dist: openocd.sh: Refactor argument handling, add new hooks for extra commands 2015-05-27 10:30:33 +02:00
Oleg Hahm
96e6d2aee3 Merge pull request #2471 from haukepetersen/fix_openocd_shutdown
dist/openocd.sh: added shutdown to flash commands
2015-03-05 17:18:10 +01:00
Joakim Gebart
f10c1f94d8 dist/tools/openocd: Replace OPENOCD_EXTRA_INIT with command line arguments
OPENOCD_EXTRA_INIT did not work for quoted arguments or openocd commands which require arguments.
2015-02-23 10:57:24 +01:00
Hauke Petersen
34541a5e0e squash: work-around for wrong openocd return value 2015-02-19 16:59:03 +01:00
Hauke Petersen
8b17d0575e dist/openocd.sh: added shutdown to flash commands 2015-02-19 16:45:00 +01:00
Joakim Gebart
a519aaad3d dist/tools/openocd: Add documentation for newly introduced environment variables 2015-02-18 10:20:26 +01:00
Joakim Gebart
f4006cda2a dist/tools/openocd: Quote file names in shell arguments 2015-02-18 10:11:07 +01:00
Joakim Gebart
b4c3f0c565 dist/tools/openocd: Make openocd command configurable. 2015-02-18 10:11:06 +01:00