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.
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>
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.
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.
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.
Checksumming flash is not supported on xtensa platform:
Warn : not implemented yet
make: *** [.../RIOT/examples/saul/../../Makefile.include:796: flash] Error 1
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>
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>
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>
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>
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.
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.
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.
- 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
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)
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.
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'.
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.
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.
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.
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.
Attempt to decouple board configuration from debugger interface
configuration by specifying the DEBUG_IFACE variable for the debug
hardware interface to use.
- 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.