(Read only you are interested in)
Allows Trice over the debug probe without using a pin or UART.
- Prerequisite is a processor with memory background access support like ARM Cortex-M cores.
- If you can use a Segger J-Link or an STM ST-Link debug probe (ST Microelectronics eval boards have it) this is an easy and fast way to use trice without any UART or other port.
- Detailed description can be found in document UM08001_JLink.pdf in chapter 16 which is part of https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack.
- Following examples are for Windows, but should work similar also on Linux and Darwin (MacOS).
- The trice tool can use the Segger RTT protocol in different ways.
- Hardware paths:
- Use J-Link or J-Link OB (on-board). J-Link OB can be flashed to many ST Microelectronics evaluation boards (v2.0 link hardware) and for example also usable with NXP and Atmel. For that you can also use a spare STM32 evaluation board (10 EUR) with jumper changes and breakout wires.
- Use ST-Link with gostlink. It uses only one USB endpoint so debugging and trice output in parallel is not possible.
- Use some other Debug-Probe with target memory access (support welcome)
- RTT channel selection (on target and on host)
- RECOMMENDED:
trice l -p JLINKor shortertrice lfor STM32F030R8 (default port is JLINK) starts in background aJLinkRTTLogger.exewhich
connects to J-Link and writes to a logfile which in turn is read by the trice tool. On exit theJLinkRTTLogger.exeis killed automatically.
It expects a target sending messages over RTT channel 0 (other channels supported too).
It is possible to start several instances on different channels as well as on different targets.trice l -p STLINKstarts in background atrice/third_party/goST/stRttLogger.exewhich connects to J-Link and
writes to a logfile which in turn is read by the trice tool. On exit thestRttLogger.exeis killed automatically.
It expects a target sending messages over RTT channel 0 (other channels supported too).
It is possible to start several instances on different channels as well as on different targets.- If you have the choice, prefer J-Link. It allows parallel debugging and trice output.
- The full -args string is normally required and depends on the used device. Example:
trice l -args="-Device STM32F070RB -if SWD -Speed 4000 -RTTChannel 0 -RTTSearchRanges 0x20000000_0x1000". Entertrice h -logand read info for-argsswitch:
- RECOMMENDED:
- Hardware paths:
-args string
Use to pass port specific parameters. The "default" value depends on the used port:
port "COMn": default="", use "TARM" for a different driver. (For baud rate settings see -baud.)
port "J-LINK": default="-Device STM32F030R8 -if SWD -Speed 4000 -RTTChannel 0 -RTTSearchRanges 0x20000000_0x1000",
The -RTTSearchRanges "..." need to be written without extra "" and with _ instead of space.
For args options see JLinkRTTLogger in SEGGER UM08001_JLink.pdf.
port "ST-LINK": default="-Device STM32F030R8 -if SWD -Speed 4000 -RTTChannel 0 -RTTSearchRanges 0x20000000_0x1000",
The -RTTSearchRanges "..." need to be written without extra "" and with _ instead of space.
For args options see JLinkRTTLogger in SEGGER UM08001_JLink.pdf.
port "BUFFER": default="0 0 0 0", Option for args is any byte sequence.
(default "default")- Prerequisite is a SEGGER J-Link debug probe or a development board with an on-board J-Link option.
Following steps describe the needed action for a ST Microelectronics evaluation board and windows - adapt them to your environment.
- Get & install STM32 ST-LINK utility
- Run from default install location
"C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINKUtility\ST-LINK Utility\ST-LinkUpgrade.exe") - Enable checkbox
Change Typeand select radio buttonSTM32 Debug+Mass storage + VCP. TheSTM32Debug+ VCPwon´t be detected by Segger reflash utility.
- Check Converting ST-LINK On-Board Into a J-Link
- Use
STLinkReflash.exeto convert NUCLEO from ST-Link on-board to J-Link on-board.STM32 Debug+ VCPwon´t be detected by Segger reflash utility.
-
JLink.exeis the SEGGER J-Link commander. It starts the J-Link driver/server and thetricetool can connect to it:- Example:
-
Compile and flash
../test/MDK-ARM_LL_UART_RTT0_FLEX_STM32F030R8-NUCLEO-64project -
Open a commandline and run (for a different device add the
-argsswitch with configuration):trice log -p JLINK
-
trice output is visible
-
With
halt andgo inside the Jlink window the MCU can get haltes and released -
It is possible in parallel to debug-step with a debugger (tested with ARM-MDK)
-
- Example:
-
PLUS:
-
works reliable
-
trice can connect over TCP localhost:19021 and display logs over RTT channel 0
-
MINUS:
-
Uses RTT up-channel 0 and therefore RTT up-channel 0 is not usable differently
-
No down-channel usable
-
JLinkRTTLogger.exeis usable for writing RTT channel N data from target into a file. The trice tool can watch this file and display them.-
PLUS:
- Can use RTT up-channel 0,1,2,...
- Can run in several instances for the same target each on a different channel
-
MINUS:
- Needs a running J-Link driver/server
- Logs in a file, so
triceneeds to read from that file - ...
-
UNKNOWN:
- If several instances can watch on different RTT channels and all goes in parallel to debugging.
-
TESTED:
- Create file
/c/Program\ Files\ (x86)/SEGGER/JLink/JLinkRTTLogger.exe -Device STM32F030R8 -if SWD -Speed 4000 -RTTChannel 0 triceRaw.log
- Play file with -device RTTF
-
-
JLinkRTTClient.execan be used for simple text transmitting to the target, it also displays strings from target coming over channel 0. It is not used by the trice tool.- PLUS:
- target stimulation with proprietary protocol over RTT down-channel 0 possible
- MINUS:
- Unfortunately it cannot run separately parallel to stimulate the target with any proprietary protocol.
- PLUS:
- Build and flash
../test/MDK-ARM_LL_UART_RTT0_PACK_STM32F030R8-NUCLEO-64- Download J-Link Software and Documentation Pack and install.
- Run
trice log -port JLINKor in shorttrice l. - Now the trice output is visible.
- In the SeggerRTT example projects you see how to setup.
- The main advantage here is, that no
triceServe()nor any interrupt is needed in the background, because this job is automatically done by SeggerRTT. This way one can debug code as comfortable as withprintf()but with all the TRICE advantages. Have a look here:
-
Avoid trice buffering inside target and write with TRICE macro directly into the RTT buffer
-
Write the bytes per trace directly (little time & some space overhead on target, but no changes on host side) - this is implemented as test example.
- Segger offers a SeggerRTT SDK which allows to use more than just channel 0 and you can develop your own tooling with it.
- The
trice -port JLINKis ok for usage as is right now. However if you wish more comfort check here: - Question: How-to-access-multiple-RTT-channels
- "Developer pack used to write your own program for the J-Link. Please be sure you agree to the terms of the associated license found on the Licensing Information tab before purchasing this SDK. You will benefit from six months of free email support from the time that this product is ordered."
- https://www.segger.com/products/debug-probes/j-link/technology/j-link-sdk/
Downloading RTT target packagefrom https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/.- Read the manual
"C:\Program Files (x86)\SEGGER\JLink\Doc\Manuals\UM08001_JLink.pdf". - Extract
"C:\Program Files (x86)\SEGGER\JLink\Samples\RTT\SEGGER_RTT_V672b.zip"to target project. Check for an update @ SEGGER. - Add
SEGGER_RTTI.cto target project - Put into main():
char* s = "Hi5!\n"; SEGGER_RTT_Write(0, s, strlen(s));, compile & flash image - Start
"C:\Program Files (x86)\SEGGER\JLink\JLinkRTTViewer.exe"& connect. - Reset target &
Hi5!should be visible inside viewer window. - Now
Hi5!should be visible inside terminal window when resetting target board. - Instead of
"C:\Program Files (x86)\SEGGER\JLink\JLinkRTTViewer.exe"also"C:\Program Files (x86)\SEGGER\JLink\JLink.exe"could be started & thenhttps://github.com/stalehd/jlinklogviewer. - What also works:
"C:\Program Files (x86)\SEGGER\JLink\JLink.exe"followed by a terminal program like TeraTerm connected tolocalhost:19021. - https://github.com/stalehd/jlinklogviewer is integrated into the trice tool (
-port JLINKoption)
-
The GoST project offers a way around JLINK. Used -port STLINK instead.
-
Maybe
libusbtogether withlibjaylinkoffer some options too. -
Checkout https://github.com/deadsy/jaylink.
-
"C:\Program Files (x86)\SEGGER\JLink\JMem.exe"shows a memory dump. -
Go to https://libusb.info/
- -> Downloads -> Latest Windows Binaries
- extract
libusb-1.0.23(or later version)
libusb-1.0.23\examples\bin64> .\listdevs.exe
2109:2811 (bus 2, device 8) path: 6
1022:145f (bus 1, device 0)
1022:43d5 (bus 2, device 0)
0a12:0001 (bus 2, device 1) path: 13
1366:0105 (bus 2, device 10) path: 5- Repeat without connected Segger JLink
libusb-1.0.23\examples\bin64> .\listdevs.exe
2109:2811 (bus 2, device 8) path: 6
1022:145f (bus 1, device 0)
1022:43d5 (bus 2, device 0)
0a12:0001 (bus 2, device 1) path: 13- In this case
1366:0105 (bus 2, device 10) path: 5is missing, sovid=1366,did=0105as example - On Windows install WSL2. The real Linux kernel is needed for full USB access.