Shadow Registers API#

This module contains support for Shadow Registers.

Module with the shadow registers control DAT support file#

The shadow registers control DAT support file.

exception spsdk.shadowregs.shadowregs.IoVerificationError(desc=None)#

Bases: SPSDKError

The error during write verification - exception for use with SPSDK.

Initialize the base SPSDK Exception.

class spsdk.shadowregs.shadowregs.ShadowRegisters(debug_probe, config)#

Bases: object

SPSDK support to control the shadow registers.

Initialization of Shadow register class.

static comalg_dcfg_cc_socu_crc8(val)#

Function that creates the crc for DCFG_CC_SOCU.

Parameters:

val (int) – Input DCFG_CC_SOCU Value.

Return type:

int

Returns:

Returns the value of DCFG_CC_SOCU with computed CRC8 field.

comalg_dcfg_cc_socu_test_en(val)#

Function fill up the DCFG_CC_SOCU DEV_TEST_EN set to True to satisfy MCU needs.

Parameters:

val (int) – Input DCFG_CC_SOCU Value.

Return type:

int

Returns:

Returns the value of DCFG_CC_SOCU with optionally enabled test mode.

static comalg_do_nothing(val)#

Function that do nothing.

Parameters:

val (int) – Input Value.

Return type:

int

Returns:

Returns same value as it get.

static crc_update(data, crc=0, is_final=True)#

The function compute the CRC8 ITU method from given bytes.

Parameters:
  • data (bytes) – Input data to compute CRC.

  • crc (int) – The seed for CRC.

  • is_final (bool) – The flag the the function should return final result.

Return type:

int

Returns:

The CRC result.

create_fuse_blhost_script(reg_list)#

The function creates the BLHOST script to burn fuses.

Parameters:

reg_list (List[str]) – The list of register to be burned.

Raises:

SPSDKError – Exception in case of not existing register.

Return type:

str

Returns:

Content of BLHOST script file.

flush_func_handler()#

A function to determine and execute the flush-func handler.

Parameters:

self – Input Value.

Raises:

SPSDKError – Raises when the computing routine is not found.

Return type:

None

get_config(diff=False)#

The function creates the configuration.

Parameters:

diff (bool) – If sett only changed registers will be placed in configuration.

Return type:

Dict[str, Any]

get_register(reg_name)#

The function returns value of the requested register.

param reg: The register name. return: The value of requested register in bytes raises SPSDKDebugProbeError: The debug probe is not specified.

Return type:

bytes

static get_supported_families()#

Return list of supported families.

Return type:

List[str]

classmethod get_validation_schemas(family, revision='latest')#

Create the validation schema.

Parameters:
  • family (str) – Family description.

  • revision (str) – Chip revision specification, as default, latest is used.

Raises:

SPSDKError – Family or revision is not supported.

Return type:

List[Dict[str, Any]]

Returns:

List of validation schemas.

classmethod get_validation_schemas_family()#

Create the validation schema just for supported families.

Return type:

List[Dict[str, Any]]

Returns:

List of validation schemas for Shadow registers supported families.

load_config(config)#

The function loads the configuration.

Parameters:

config (Dict[str, Any]) – The configuration of shadow registers.

Return type:

None

static reg_antipolize_dst_handler(val, context)#

Keep same antipolized register value in computed register.

Parameters:
  • val (int) – Input register value.

  • context (Any) – The method context.

Return type:

int

Returns:

Antipolized value.

static reg_antipolize_src_handler(val, context)#

Antipolize given register value.

Parameters:
  • val (int) – Input register value.

  • context (Any) – The method context.

Return type:

int

Returns:

Antipolized value.

reg_computed_fields_handler(val, context)#

Recalculate all fields for given register value.

Parameters:
  • val (bytes) – Input register value.

  • context (Any) – The method context (fields).

Return type:

bytes

Returns:

recomputed value.

Raises:

SPSDKError – Raises when the computing routine is not found.

reload_registers()#

Reload all the values in managed registers.

Return type:

None

rw61x_update_scratch_reg()#

Function updates scratch register for RW61x, This enables the shadow register functionality.

Parameters:

self – Input Value.

Return type:

None

set_register(reg_name, data, verify=True, raw=True)#

The function sets the value of the specified register.

Parameters:
  • reg_name (str) – The register name.

  • data (Any) – The new data to be stored to shadow register.

  • verify (bool) – Verity write operation.

  • raw (bool) – Do not use any modification hooks.

Raises:
Return type:

None

sets_all_registers(verify=True)#

Update all shadow registers in target by local values.

Parameters:

verify (bool) – Verity write operation.

Return type:

None

spsdk.shadowregs.shadowregs.enable_debug(probe, ap_mem=0)#

Function that enables debug access ports on devices with debug mailbox.

Parameters:
  • probe (DebugProbe) – Initialized debug probe.

  • ap_mem (int) – Index of Debug access port for memory interface.

Return type:

bool

Returns:

True if debug port is enabled, False otherwise

Raises:

SPSDKError – Unlock method failed.