8. cc_rtt_segger
8.1. Communication Channel Via segger j-link
- module
cc_rtt_segger
- synopsis
channel used to enable RTT communication using Segger J-Link debugger. Additionally, RTT logs can be captured by setting the rtt_log_path parameter on the specified channel.
- class pykiso.lib.connectors.cc_rtt_segger.CCRttSegger(serial_number=None, chip_name='STM32L562QE', speed=4000, block_address=537131008, verbose=False, tx_buffer_idx=3, rx_buffer_idx=0, rtt_log_path=None, rtt_log_buffer_idx=0, rtt_log_speed=1000, connection_timeout=5, **kwargs)[source]
Channel using RTT to communicate through Segger J-Link debugger.
Initialize attributes.
- Parameters
serial_number (
Optional
[int
]) – optional segger debugger serial number (required if many connected)chip_name (
str
) – microcontoller name (STM….)speed (
int
) – communication speed in Hzblock_address (
int
) – start address to start RTT communicationtx_buffer_idx (
int
) – buffer index used for transmissionrx_buffer_idx (
int
) – buffer index used for receptionverbose (
bool
) – boolean indicating if J-Link connection should be verbose in loggingrtt_log_path (
Optional
[str
]) – path to the folder where the RTT log file should be storedrtt_log_buffer_idx (
int
) – buffer index used for RTT loggingrtt_log_speed (
float
) – number of log per second to be pulled (manage the CPU load for logging) None value fetch log at the CPU’s speed. Default 1000 logs/sconnection_timeout (
int
) – available time (in seconds) to open the connection
- _cc_open()[source]
Connect debugger/microcontroller.
This method proceed to the following actions : - create a JLink class instance - connect to the debugger(using open method) - set debugger interface to SWD - connect debugger to the specified chip - start RTT communication - start RTT Logging the specified channel if activated
- Raises
JLinkRTTException – if connection timeout occurred.
- Return type
None
- _cc_receive(timeout=0.1, size=None, **kwargs)[source]
Read message from the corresponding RTT buffer.
- Parameters
timeout (
float
) – timeout applied on receive eventsize (
Optional
[int
]) – maximum amount of bytes to read
- Return type
Dict
[str
,Optional
[bytes
]]- Returns
dictionary containing the received bytes if successful, otherwise None
- _cc_send(msg)[source]
Send message using the corresponding RTT buffer.
- Parameters
msg (
bytes
) – message to send, should be bytes.- Return type
None
- read_target_memory(addr, num_units, zone=None, nbits=32)[source]
Read the given target’s memory units and the given address.
Note
The optional
zone
specifies a memory zone to access to read from, e.g.IDATA
,DDATA
, orCODE
.Warning
The given number of bits, if provided, must be either
8
,16
, or32
. If not provided, always reads 32 bits.- Parameters
addr (
int
) – start address to read fromnum_units (
int
) – number of units to readzone (
Optional
[str
]) – optional memory zone name to accessnbits (
int
) – number of bits to use for each unit
- Return type
Optional
[list
]- Returns
List of units read from the target.