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

boards/common/cc26xx_cc13xx: Fix flashing with upstream OpenOCD

This adds a work around that allows flashing with upstream OpenOCD,
most of the time.
This commit is contained in:
Marian Buschsieweke 2022-12-21 23:19:50 +01:00
parent 3e1dcf31cb
commit c78c0056ea
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94
2 changed files with 46 additions and 13 deletions

View File

@ -16,6 +16,13 @@ TTY_BOARD_FILTER := --model XDS110 --iface-num 0
UNIFLASH_CONFIG ?= $(RIOTBOARD)/common/cc26xx_cc13xx/dist UNIFLASH_CONFIG ?= $(RIOTBOARD)/common/cc26xx_cc13xx/dist
OPENOCD_DEBUG_ADAPTER ?= xds110 OPENOCD_DEBUG_ADAPTER ?= xds110
# Work around a bug in the CC26xx / CC13xx that is triggered by 'reset halt'.
# This results in the CC26xx / CC13xx being flash-able again, but it may race
# against the target firmware installing IRQ handlers that may trigger while
# the device is being flashed, which is bound to cause unpleasantness. But
# flashing working fine most of the time is better than flashing working not
# at all...
OPENOCD_CMD_RESET_HALT ?= -c 'halt'
ifneq (,$(filter cc13x0%,$(CPU_MODEL))) ifneq (,$(filter cc13x0%,$(CPU_MODEL)))
DEFAULT_OPENOCD_CONFIG := $(RIOTBASE)/boards/common/cc26xx_cc13xx/dist/openocd_cc13x0.cfg DEFAULT_OPENOCD_CONFIG := $(RIOTBASE)/boards/common/cc26xx_cc13xx/dist/openocd_cc13x0.cfg

View File

@ -68,11 +68,29 @@ that provides programming, flashing and debugging capabilities.
It can either use proprietary Texas Instruments tools for programming, or OpenOCD. It can either use proprietary Texas Instruments tools for programming, or OpenOCD.
### Using OpenOCD ### Using Upstream OpenOCD
To use OpenOCD with the XDS110 you need to use the an special version of OpenOCD is the default programmer and debugger. Hence, flashing can be done
OpenOCD made by TI (upstream version is not _yet_ compatible). You can by navigating to the application directory and running:
clone and compile it from source:
```
make flash BOARD=<CC26xx-or-CC13xx-based-board>
```
@warning A reliable and robust sequence to reset the CC26xx / CC13xx from
upstream OpenOCD is not yet implemented. As a result, OpenOCD will
halt the MCU for flashing without reset. This may result in IRQ
handlers being already set up and responding to IRQs that trigger
while flashing. Hence, flashing is likely not 100% reliable.
@note By default the XDS110 debug adapter is used, which is the debugger
TI integrates into is developments boards. This can be overwritten
by setting `OPENOCD_DEBUG_ADAPTER` to a different debugger.
### Using TI's OpenOCD Fork
TI maintains an outdated fork of OpenOCD that contains patches and special
handling that have not upstreamed yet. It can be build using:
``` ```
# Clone into the openocd-ti folder # Clone into the openocd-ti folder
@ -87,17 +105,25 @@ make
sudo make install sudo make install
``` ```
@note Sometimes OpenOCD may stop working when the firmware on the XDS110 @warning Sometimes OpenOCD may stop working when the firmware on the XDS110
is updated (when using Uniflash, happens without user intervention). With that is updated (when using Uniflash, happens without user intervention).
in mind, it's encouraged to either enable the ROM bootloader backdoor to enable With that in mind, it's encouraged to either enable the ROM
serial programming or the installation of TI Uniflash as a fallback. See bootloader backdoor to enable serial programming or the
[Using Uniflash](#cc26xx_cc13xx_uniflash) installation of TI Uniflash as a fallback. See
[Using Uniflash](#cc26xx_cc13xx_uniflash)
#### Setting up the environment @note With `OPENOCD_CMD_RESET_HALT="-c 'reset halt'"` the default reset
sequence can be restored. This may work with TI's OpenOCD fork.
To flash a board using OpenOCD you can use do it so by setting the `PROGRAMMER` Otherwise, usage is identical with the upstream version of OpenOCD.
environment variable directly in the make command line or in your shell
nitialization ### using J-Link
By passing (or exporting) `PROGRAMMER=jlink` J-Link can be used to flash the
board. This requires a J-Link compatible programmer / debugger. Since the
XDS110 that TI's development boards use is not compatible, an external
programmer has to be used. The upside is that flashing appears to be reliable
with that.
### Using Uniflash ### Using Uniflash