diff --git a/boards/common/cc26xx_cc13xx/Makefile.include b/boards/common/cc26xx_cc13xx/Makefile.include index f365cc17c5..4296ef3c8b 100644 --- a/boards/common/cc26xx_cc13xx/Makefile.include +++ b/boards/common/cc26xx_cc13xx/Makefile.include @@ -16,6 +16,13 @@ TTY_BOARD_FILTER := --model XDS110 --iface-num 0 UNIFLASH_CONFIG ?= $(RIOTBOARD)/common/cc26xx_cc13xx/dist 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))) DEFAULT_OPENOCD_CONFIG := $(RIOTBASE)/boards/common/cc26xx_cc13xx/dist/openocd_cc13x0.cfg diff --git a/cpu/cc26xx_cc13xx/doc.txt b/cpu/cc26xx_cc13xx/doc.txt index 07751192a9..55970e5e18 100644 --- a/cpu/cc26xx_cc13xx/doc.txt +++ b/cpu/cc26xx_cc13xx/doc.txt @@ -68,11 +68,29 @@ that provides programming, flashing and debugging capabilities. 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 made by TI (upstream version is not _yet_ compatible). You can -clone and compile it from source: +OpenOCD is the default programmer and debugger. Hence, flashing can be done +by navigating to the application directory and running: + +``` +make flash 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 @@ -87,17 +105,25 @@ make sudo make install ``` -@note Sometimes OpenOCD may stop working when the firmware on the XDS110 -is updated (when using Uniflash, happens without user intervention). With that -in mind, it's encouraged to either enable the ROM bootloader backdoor to enable -serial programming or the installation of TI Uniflash as a fallback. See -[Using Uniflash](#cc26xx_cc13xx_uniflash) +@warning Sometimes OpenOCD may stop working when the firmware on the XDS110 + is updated (when using Uniflash, happens without user intervention). + With that in mind, it's encouraged to either enable the ROM + bootloader backdoor to enable serial programming or the + 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` -environment variable directly in the make command line or in your shell -nitialization +Otherwise, usage is identical with the upstream version of OpenOCD. + +### 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