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

66 Commits

Author SHA1 Message Date
crasbe
5d7194a4ee makefiles: introduce OPENOCD_POST_INIT_CMDS 2024-11-08 16:03:17 +01:00
Marian Buschsieweke
4fc7700a0f
tools/openocd-rtt: also open GDB port
When using OpenOCD RTT (real-time transfer) for stdio with
`USEMODULE=stdio_rtt make ...`, it is no longer possible to debug
while being connected to stdio. By also opening gdb at RIOT's default
GDB port, `make debug-client` can be used to connect from GDB to the
OpenOCD instance providing stdio via RTT.
2024-01-13 12:47:37 +01:00
Fabian Hüßler
1b93025ab1 dist/tools/openocd: start debug-server in background and wait 2023-06-15 19:27:15 +02:00
bors[bot]
829af7c105
Merge #19703 #19724 #19735
19703: cpu/sam0_eth: interrupt based link detection/auto-negotiation r=benpicco a=benpicco



19724: dist/tools/openocd: add OPENOCD_SERVER_ADDRESS variable r=benpicco a=fabian18



19735: nrf5x_common: Clear I2C periph shorts r=benpicco a=bergzand

### Contribution description

The I2C peripheral's shortcuts are used with the read and write register to automatically stop the I2C transaction or to continue with the next stage.

With simple I2C read and write bytes these shorts are not used, but are also not cleared by the function in all cases, causing it to use the shortcut configuration set by a previous function call. This patch ensures that the shorts are always set by the read and write functions

### Testing procedure

Should be possible to spot with a logic analyzer and the I2C periph test. Maybe the HIL test can also detect it :)

### Issues/PRs references

None

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
2023-06-14 12:34:33 +00:00
bors[bot]
5e7c6c2ff7
Merge #19697 #19725
19697: drivers/sx127x: reduce use of floats r=benpicco a=maribu

### Contribution description

Convert the floating point arithmetic to integer arithmetic.


19725: buildsystem: add target debug-client r=benpicco a=fabian18



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
2023-06-13 19:08:40 +00:00
Fabian Hüßler
17d0e586c5 dist/tools/openocd: add OPENOCD_SERVER_ADDRESS variable 2023-06-13 21:04:27 +02:00
Fabian Hüßler
c76a192eb8 openocd: support target debug-client 2023-06-10 01:03:30 +02:00
Fabian Hüßler
dbfb0ea76a dist/tools/openocd: add RTT port variable 2023-06-09 23:49:35 +02:00
Marian Buschsieweke
47ec58dc9b
dist/tools/openocd: fix parsing of flash bank base
Since 80fc9fabc66a0bc767467fa14c703e5a9f340cd3 the format of the
`flash list` command changed to a more human readable multi-line
variant. Technically, the change is white-space only. Still, the
current approach of parsing them with awk, sed and cut doesn't like
the new multi-line format. The parsing is now delegated into a
python script that is compatible across OpenOCD versions.
2023-05-19 13:12:12 +02:00
Gunar Schorcht
43ac5d4c33 dist/tools/openocd: fix flash_addr function for openocd v0.12 2023-03-19 12:06:58 +01:00
Marian Buschsieweke
3e1dcf31cb
tools/openocd: Allow specifying a custom halt command
Typically, OpenOCD is already performing a reset on connect. A
`reset halt` to bring the target to a `halt` state for flashing will
result in the device going through a second reset cycle. This can be
problematic with some device, such as the CC26xx MCUs. For these
devices, an `OPENOCD_CMD_RESET_HALT := -c 'halt'` will avoid the second
reset that is causing the issues.
2023-01-10 21:59:56 +01:00
chrysn
62a6d3c128 makefiles: Add openocd-rtt
JLink presumably has information about the device's RAM available
internally. Not passing the precise symbol area (which would be
available in the ELF file) because a) that'd make the terminal break
when the flashed firmware does not equal the built one, and b) that
would introduce a dependency from `term` to the ELF file that other
terminals don't have.
2022-08-30 09:34:22 +02:00
68bfd8e257
tools/openocd: check OPENOCD_VERIFY after IMAGE_OFFSET is computed 2021-11-22 13:03:32 +01:00
Erik Ekman
1c6d7dcdaf tools/openocd: Make verifying flashed image optional
Checksumming flash is not supported on xtensa platform:

Warn : not implemented yet

make: *** [.../RIOT/examples/saul/../../Makefile.include:796: flash] Error 1
2021-10-15 10:13:25 +02:00
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