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: spsdk.exceptions.SPSDKError

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

Initialize the base SPSDK Exception.

class spsdk.shadowregs.shadowregs.ShadowRegisters(debug_probe, config, device, revision='latest')

Bases: object

SPSDK support to control the shadow registers.

Initialization of Shadow register class.

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.

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.

create_yml_config(file_name, raw=False, diff=False)

The function creates the configuration YML file.

Parameters
  • file_name (str) – The file_name (without extension) of stored configuration.

  • raw (bool) – Raw output of configuration (including computed fields and anti-pole registers)

  • diff (bool) – Get only configuration with difference value to reset state.

Return type

None

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

load_yml_config(file_name, raw=False)

The function loads the configuration from YML file.

Parameters
  • file_name (str) – The file_name (without extension) of stored configuration.

  • raw (bool) – Raw input of configuration (including computed fields and anti-pole registers)

Raises

SPSDKError – When the configuration file not found.

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_register(reg)

Reload the value in requested register.

Parameters

reg (RegsRegister) – The register to reload from the HW.

Return type

None

reload_registers()

Reload all the values in managed registers.

Return type

None

set_register(reg_name, data)

The function sets the value of the specified register.

param reg: The register name. param data: The new data to be stored to shadow register. raises SPSDKDebugProbeError: The debug probe is not specified.

Return type

None

sets_all_registers()

Update all shadow registers in target by local values.

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.