MBoot Module API#
Module implementing communication with the MCU Bootloader.
McuBoot Class#
Module for communication with the bootloader.
- class spsdk.mboot.mcuboot.McuBoot(interface, cmd_exception=False)#
Bases:
object
Class for communication with the bootloader.
Initialize the McuBoot object.
- Parameters:
interface (
MbootProtocolBase
) – The instance of communication interface classcmd_exception (
bool
) – True to throw McuBootCommandError on any error; False to set status code only Note: some operation might raise McuBootCommandError is all cases
- DEFAULT_MAX_PACKET_SIZE = 32#
- call(address, argument)#
Fill MCU memory with specified pattern.
- Parameters:
address (
int
) – Call address (must be word aligned)argument (
int
) – Function arguments address
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- close()#
Disconnect from the device.
- Return type:
None
- configure_memory(address, mem_id)#
Configure memory.
- Parameters:
address (
int
) – The address in memory where are locating configuration datamem_id (
int
) – Memory ID
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- dsc_hsm_create_session(oem_seed_input_addr, oem_seed_input_size, oem_share_output_addr, oem_share_output_size)#
Command used by OEM to provide it share to create the initial trust provisioning keys.
- Parameters:
oem_seed_input_addr (
int
) – address of 128-bit entropy seed value provided by the OEM.oem_seed_input_size (
int
) – OEM seed size in bytesoem_share_output_addr (
int
) – A 128-bit encrypted token.oem_share_output_size (
int
) – size in bytes
- Return type:
Optional
[int
]
- dsc_hsm_enc_blk(sbx_header_input_addr, sbx_header_input_size, block_num, block_data_addr, block_data_size)#
Command used to encrypt the given block sliced by the nxpimage.
This command is only supported after issuance of dsc_hsm_create_session.
- Parameters:
sbx_header_input_addr (
int
) – SBx header containing file size, Firmware version and Timestamp data. Except for hash digest of block 0, all other fields should be valid.sbx_header_input_size (
int
) – size of the header in bytesblock_num (
int
) – Number of blockblock_data_addr (
int
) – Address of data blockblock_data_size (
int
) – Size of data block
- Return type:
Optional
[int
]
- dsc_hsm_enc_sign(block_data_input_addr, block_data_input_size, signature_output_addr, signature_output_size)#
Command used for signing the data buffer provided.
This command is only supported after issuance of dsc_hsm_create_session.
- Parameters:
block_data_input_addr (
int
) – Address of data buffer to be signedblock_data_input_size (
int
) – Size of data buffer in bytessignature_output_addr (
int
) – Address to output signature datasignature_output_size (
int
) – Size of the output signature data in bytes
- Return type:
Optional
[int
]
- efuse_program_once(index, value, verify=False)#
Write into MCU once program region (OCOTP).
- Parameters:
index (
int
) – Start indexvalue (
int
) – Int value (4 bytes long)verify (
bool
) – Verify that data were written (by comparing value as bitmask)
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- efuse_read_once(index)#
Read from MCU flash program once region.
- Parameters:
index (
int
) – Start index- Return type:
Optional
[int
]- Returns:
read value (32-bit int); None if operation failed
- ele_message(cmdMsgAddr, cmdMsgCnt, respMsgAddr, respMsgCnt)#
Send EdgeLock Enclave message.
- Parameters:
cmdMsgAddr (
int
) – Address in RAM where is prepared the command message wordscmdMsgCnt (
int
) – Count of 32bits command wordsrespMsgAddr (
int
) – Address in RAM where the command store the responserespMsgCnt (
int
) – Count of 32bits response words
- Return type:
bool
- Returns:
False in case of any problems, True otherwise.
- execute(address, argument, sp)#
Execute program on a given address using the stack pointer.
- Parameters:
address (
int
) – Jump address (must be word aligned)argument (
int
) – Function arguments addresssp (
int
) – Stack pointer address
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- fill_memory(address, length, pattern=4294967295)#
Fill MCU memory with specified pattern.
- Parameters:
address (
int
) – Start address (must be word aligned)length (
int
) – Count of words (must be word aligned)pattern (
int
) – Count of wrote bytes
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- flash_erase_all(mem_id=0)#
Erase complete flash memory without recovering flash security section.
- Parameters:
mem_id (
int
) – Memory ID- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- flash_erase_all_unsecure()#
Erase complete flash memory and recover flash security section.
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- flash_erase_region(address, length, mem_id=0)#
Erase specified range of flash.
- Parameters:
address (
int
) – Start addresslength (
int
) – Count of bytesmem_id (
int
) – Memory ID
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- flash_program_once(index, data)#
Write into MCU flash program once region (max 8 bytes).
- Parameters:
index (
int
) – Start indexdata (
bytes
) – Input data aligned to 4 or 8 bytes
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- Raises:
SPSDKError – When invalid length of data. Must be aligned to 4 or 8 bytes
- flash_read_once(index, count=4)#
Read from MCU flash program once region (max 8 bytes).
- Parameters:
index (
int
) – Start indexcount (
int
) – Count of bytes
- Return type:
Optional
[bytes
]- Returns:
Data read; None in case of an failure
- Raises:
SPSDKError – When invalid count of bytes. Must be 4 or 8
- flash_read_resource(address, length, option=1)#
Read resource of flash module.
- Parameters:
address (
int
) – Start addresslength (
int
) – Number of bytesoption (
int
) – Area to be read. 0 means Flash IFR, 1 means Flash Firmware ID
- Raises:
McuBootError – when the length is not aligned to 4 bytes
- Return type:
Optional
[bytes
]- Returns:
Data from the resource; None in case of an failure
- flash_security_disable(backdoor_key)#
Disable flash security by using of backdoor key.
- Parameters:
backdoor_key (
bytes
) – The key value as array of 8 bytes- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- Raises:
McuBootError – If the backdoor_key is not 8 bytes long
- fuse_program(address, data, mem_id=0)#
Program fuse.
- Parameters:
address (
int
) – Start addressdata (
bytes
) – List of bytesmem_id (
int
) – Memory ID
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- fuse_read(address, length, mem_id=0)#
Read fuse.
- Parameters:
address (
int
) – Start addresslength (
int
) – Count of bytesmem_id (
int
) – Memory ID
- Return type:
Optional
[bytes
]- Returns:
Data read from the fuse; None in case of a failure
- generate_key_blob(dek_data, key_sel=0, count=72)#
Generate Key Blob.
- Parameters:
dek_data (
bytes
) – Data Encryption Key as byteskey_sel (
int
) – select the BKEK used to wrap the BK (default: OPTMK/FUSES)count (
int
) – Key blob count (default: 72 - AES128bit)
- Return type:
Optional
[bytes
]- Returns:
Key blob; None in case of an failure
- get_memory_list()#
Get list of embedded memories.
- Return type:
dict
- Returns:
dict, with the following keys: internal_flash (optional) - list , internal_ram (optional) - list, external_mems (optional) - list
- Raises:
McuBootCommandError – Error reading the memory list
- get_property(prop_tag, index=0)#
Get specified property value.
- Parameters:
prop_tag (
PropertyTag
) – Property TAG (see Properties Enum)index (
int
) – External memory ID or internal memory region index (depends on property type)
- Return type:
Optional
[List
[int
]]- Returns:
list integers representing the property; None in case no response from device
- Raises:
McuBootError – If received invalid get-property response
- get_property_list()#
Get a list of available properties.
- Return type:
List
[PropertyValueBase
]- Returns:
List of available properties.
- Raises:
McuBootCommandError – Failure to read properties list
- property is_opened: bool#
Return True if the device is open.
- kp_enroll()#
Key provisioning: Enroll Command (start PUF).
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- kp_read_key_store()#
Key provisioning: Read key data from key store area.
- Return type:
Optional
[bytes
]
- kp_read_nonvolatile(mem_id=0)#
Key provisioning: Load the key from a nonvolatile memory to bootloader.
- Parameters:
mem_id (
int
) – The memory ID (default: 0)- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- kp_set_intrinsic_key(key_type, key_size)#
Key provisioning: Generate Intrinsic Key.
- Parameters:
key_type (
int
) – Type of the keykey_size (
int
) – Size of the key
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- kp_set_user_key(key_type, key_data)#
Key provisioning: Send the user key specified by <key_type> to bootloader.
- Parameters:
key_type (
int
) – type of the user key, see enumeration for detailskey_data (
bytes
) – binary content of the user key
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- kp_write_key_store(key_data)#
Key provisioning: Write key data into key store area.
- Parameters:
key_data (
bytes
) – key store binary content to be written to processor- Return type:
bool
- Returns:
result of the operation; True means success
- kp_write_nonvolatile(mem_id=0)#
Key provisioning: Write the key to a nonvolatile memory.
- Parameters:
mem_id (
int
) – The memory ID (default: 0)- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- load_image(data, progress_callback=None)#
Load a boot image to the device.
- Parameters:
data (
bytes
) – boot imageprogress_callback (
Optional
[Callable
[[int
,int
],None
]]) – Callback for updating the caller about the progress
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- nxp_get_id(id_blob_addr, id_blob_size)#
Command used for harvesting device ID blob during wafer test as part of RTS flow.
- Parameters:
id_blob_addr (
int
) – address of ID blob defined by Round-trip trust provisioning specification.id_blob_size (
int
) – length of buffer in bytes
- Return type:
Optional
[int
]
- open()#
Connect to the device.
- Return type:
None
- read_memory(address, length, mem_id=0, progress_callback=None, fast_mode=False)#
Read data from MCU memory.
- Parameters:
address (
int
) – Start addresslength (
int
) – Count of bytesmem_id (
int
) – Memory IDfast_mode (
bool
) – Fast mode for USB-HID data transfer, not reliable !!!progress_callback (
Optional
[Callable
[[int
,int
],None
]]) – Callback for updating the caller about the progress
- Return type:
Optional
[bytes
]- Returns:
Data read from the memory; None in case of a failure
- receive_sb_file(data, progress_callback=None, check_errors=False)#
Receive SB file.
- Parameters:
data (
bytes
) – SB file dataprogress_callback (
Optional
[Callable
[[int
,int
],None
]]) – Callback for updating the caller about the progresscheck_errors (
bool
) – Check for ABORT_FRAME (and related errors) on USB interface between data packets. When this parameter is set to False significantly improves USB transfer speed (cca 20x) However, the final status code might be misleading (original root cause may get overridden) In case receive-sb-file fails, re-run the operation with this flag set to True
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- reliable_update(address)#
Reliable Update.
- Parameters:
address (
int
) – Address where new the firmware is stored- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- reset(timeout=2000, reopen=True)#
Reset MCU and reconnect if enabled.
- Parameters:
timeout (
int
) – The maximal waiting time in [ms] for reopen connectionreopen (
bool
) – True for reopen connection after HW reset else False
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- Raises:
McuBootError – if reopen is not supported
McuBootConnectionError – Failure to reopen the device
- set_property(prop_tag, value)#
Set value of specified property.
- Parameters:
prop_tag (
PropertyTag
) – Property TAG (see Property enumerator)value (
int
) – The value of selected property
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- property status_code: int#
Return status code of the last operation.
- property status_string: str#
Return status string.
- tp_hsm_enc_blk(mfg_cust_mk_sk_0_blob_input_addr, mfg_cust_mk_sk_0_blob_input_size, kek_id, sb3_header_input_addr, sb3_header_input_size, block_num, block_data_addr, block_data_size)#
Trust provisioning: Encrypt the given SB3 data block.
- Parameters:
mfg_cust_mk_sk_0_blob_input_addr (
int
) – The input buffer address where the CKDF Master Key Blob locates atmfg_cust_mk_sk_0_blob_input_size (
int
) – The byte count of the CKDF Master Key Blobkek_id (
int
) – The CKDF Master Key Encryption Key ID (0x10: NXP_CUST_KEK_INT_SK, 0x11: NXP_CUST_KEK_EXT_SK)sb3_header_input_addr (
int
) – The input buffer address, where the SB3 Header(block0) locates atsb3_header_input_size (
int
) – The byte count of the SB3 Headerblock_num (
int
) – The index of the block. Due to SB3 Header(block 0) is always unencrypted, the index starts from block1block_data_addr (
int
) – The buffer address where the SB3 data block locates atblock_data_size (
int
) – The byte count of the SB3 data block
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- tp_hsm_enc_sign(key_blob_input_addr, key_blob_input_size, block_data_input_addr, block_data_input_size, signature_output_addr, signature_output_size)#
Signs the given data.
- Parameters:
key_blob_input_addr (
int
) – The input buffer address where signing key blob locates atkey_blob_input_size (
int
) – The byte count of the signing key blobblock_data_input_addr (
int
) – The input buffer address where the data locates atblock_data_input_size (
int
) – The byte count of the datasignature_output_addr (
int
) – The output buffer address where ROM writes the signature tosignature_output_size (
int
) – The output buffer size in byte
- Return type:
Optional
[int
]- Returns:
Return signature size; None in case of an failure
- tp_hsm_gen_key(key_type, reserved, key_blob_output_addr, key_blob_output_size, ecdsa_puk_output_addr, ecdsa_puk_output_size)#
Trust provisioning: OEM generate common keys.
- Parameters:
key_type (
int
) – Key to generate (MFW_ISK, MFW_ENCK, GEN_SIGNK, GET_CUST_MK_SK)reserved (
int
) – Reserved, must be zerokey_blob_output_addr (
int
) – The output buffer address where ROM writes the key blob tokey_blob_output_size (
int
) – The output buffer size in byteecdsa_puk_output_addr (
int
) – The output buffer address where ROM writes the public key toecdsa_puk_output_size (
int
) – The output buffer size in byte
- Return type:
Optional
[List
[int
]]- Returns:
Return byte count of the key blob + byte count of the public key from the device; None in case of an failure
- tp_hsm_store_key(key_type, key_property, key_input_addr, key_input_size, key_blob_output_addr, key_blob_output_size)#
Trust provisioning: OEM generate common keys.
- Parameters:
key_type (
int
) – Key to generate (CKDFK, HKDFK, HMACK, CMACK, AESK, KUOK)key_property (
int
) – Bit 0: Key Size, 0 for 128bit, 1 for 256bit. Bits 30-31: set key protection CSS mode.key_input_addr (
int
) – The input buffer address where the key locates atkey_input_size (
int
) – The byte count of the keykey_blob_output_addr (
int
) – The output buffer address where ROM writes the key blob tokey_blob_output_size (
int
) – The output buffer size in byte
- Return type:
Optional
[List
[int
]]- Returns:
Return header of the key blob + byte count of the key blob (header is not included) from the device; None in case of an failure
Takes the entropy seed provided by the OEM as input.
- Parameters:
oem_share_input_addr (
int
) – The input buffer address where the OEM Share(entropy seed) locates atoem_share_input_size (
int
) – The byte count of the OEM Shareoem_enc_share_output_addr (
int
) – The output buffer address where ROM writes the Encrypted OEM Share tooem_enc_share_output_size (
int
) – The output buffer size in byteoem_enc_master_share_output_addr (
int
) – The output buffer address where ROM writes the Encrypted OEM Master Share tooem_enc_master_share_output_size (
int
) – The output buffer size in byte.oem_cust_cert_puk_output_addr (
int
) – The output buffer address where ROM writes the OEM Customer Certificate Public Key tooem_cust_cert_puk_output_size (
int
) – The output buffer size in byte
- Return type:
Optional
[List
[int
]]- Returns:
Sizes of two encrypted blobs(the Encrypted OEM Share and the Encrypted OEM Master Share) and a public key(the OEM Customer Certificate Public Key).
- tp_oem_get_cust_cert_dice_puk(oem_rkth_input_addr, oem_rkth_input_size, oem_cust_cert_dice_puk_output_addr, oem_cust_cert_dice_puk_output_size)#
Creates the initial trust provisioning keys.
- Parameters:
oem_rkth_input_addr (
int
) – The input buffer address where the OEM RKTH locates atoem_rkth_input_size (
int
) – The byte count of the OEM RKTHoem_cust_cert_dice_puk_output_addr (
int
) – The output buffer address where ROM writes the OEM Customer Certificate Public Key for DICE tooem_cust_cert_dice_puk_output_size (
int
) – The output buffer size in byte
- Return type:
Optional
[int
]- Returns:
The byte count of the OEM Customer Certificate Public Key for DICE
Takes the entropy seed and the Encrypted OEM Master Share.
- Parameters:
oem_share_input_addr (
int
) – The input buffer address where the OEM Share(entropy seed) locates atoem_share_input_size (
int
) – The byte count of the OEM Shareoem_enc_master_share_input_addr (
int
) – The input buffer address where the Encrypted OEM Master Share locates atoem_enc_master_share_input_size (
int
) – The byte count of the Encrypted OEM Master Share
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
- tp_prove_genuinity(address, buffer_size)#
Start the process of proving genuinity.
- Parameters:
address (
int
) – Address where to prove genuinity request (challenge) containerbuffer_size (
int
) – Maximum size of the response package (limit 0xFFFF)
- Raises:
McuBootError – Invalid input parameters
- Return type:
Optional
[int
]- Returns:
True if prove_genuinity operation is successfully completed
- tp_set_wrapped_data(address, stage=75, control=1)#
Start the process of setting OEM data.
- Parameters:
address (
int
) – Address where the wrapped data container on targetcontrol (
int
) – 1 - use the address, 2 - use container within the firmware, defaults to 1stage (
int
) – Stage of TrustProvisioning flow, defaults to 0x4B
- Return type:
bool
- Returns:
True if set_wrapped_data operation is successfully completed
- update_life_cycle(life_cycle)#
Update device life cycle.
- Parameters:
life_cycle (
int
) – New life cycle value.- Return type:
bool
- Returns:
False in case of any problems, True otherwise.
- wpc_get_id(wpc_id_blob_addr, wpc_id_blob_size)#
Command used for harvesting device ID blob.
- Parameters:
wpc_id_blob_addr (
int
) – Buffer addresswpc_id_blob_size (
int
) – Buffer size
- Return type:
Optional
[int
]
- wpc_insert_cert(wpc_cert_addr, wpc_cert_len, ec_id_offset, wpc_puk_offset)#
Command used for certificate validation before it is written into flash.
- This command does following things:
Extracts ECID and WPC PUK from certificate Validates ECID and WPC PUK. If both are OK it returns success. Otherwise returns fail
- Parameters:
wpc_cert_addr (
int
) – address of inserted certificatewpc_cert_len (
int
) – length in bytes of inserted certificateec_id_offset (
int
) – offset to 72-bit ECIDwpc_puk_offset (
int
) – WPC PUK offset from beginning of inserted certificate
- Return type:
Optional
[int
]
- wpc_sign_csr(csr_tbs_addr, csr_tbs_len, signature_addr, signature_len)#
Command used sign CSR data (TBS portion).
- Parameters:
csr_tbs_addr (
int
) – address of CSR-TBS datacsr_tbs_len (
int
) – length in bytes of CSR-TBS datasignature_addr (
int
) – address where to store signaturesignature_len (
int
) – expected length of signature
- Return type:
Optional
[int
]- Returns:
actual signature length
- write_memory(address, data, mem_id=0, progress_callback=None)#
Write data into MCU memory.
- Parameters:
address (
int
) – Start addressdata (
bytes
) – List of bytesprogress_callback (
Optional
[Callable
[[int
,int
],None
]]) – Callback for updating the caller about the progressmem_id (
int
) – Memory ID, see ExtMemId; additionally use 0 for internal memory
- Return type:
bool
- Returns:
False in case of any problem; True otherwise
MBoot Commands#
Commands and responses used by MBOOT module.
- class spsdk.mboot.commands.CmdHeader(tag, flags, reserved, params_count)#
Bases:
object
McuBoot command/response header.
Initialize the Command Header.
- Parameters:
tag (
int
) – Tag indicating the command, see: CommandTag classflags (
int
) – Flags for the commandreserved (
int
) – Reserved?params_count (
int
) – Number of parameter for the command
- SIZE = 4#
- classmethod from_bytes(data, offset=0)#
Deserialize header from bytes.
- Parameters:
data (
bytes
) – Input data in bytesoffset (
int
) – The offset of input data
- Return type:
- Returns:
De-serialized CmdHeader object
- Raises:
McuBootError – Invalid data format
- to_bytes()#
Serialize header into bytes.
- Return type:
bytes
- class spsdk.mboot.commands.CmdPacket(tag, flags, *args, data=None)#
Bases:
CmdPacketBase
McuBoot command packet format class.
Initialize the Command Packet object.
- Parameters:
tag (
CommandTag
) – Tag identifying the commandflags (
int
) – Flags used by the commandargs (
int
) – Arguments used by the commanddata (
Optional
[bytes
]) – Additional data, defaults to None
- EMPTY_VALUE = 0#
- SIZE = 32#
- to_bytes(padding=True)#
Serialize CmdPacket into bytes.
- Parameters:
padding (
bool
) – If True, add padding to specific size- Return type:
bytes
- Returns:
Serialized object into bytes
- class spsdk.mboot.commands.CmdResponse(header, raw_data)#
Bases:
CmdResponseBase
McuBoot response base format class.
Initialize the Command Response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- property value: int#
Return a integer representation of the response.
- class spsdk.mboot.commands.CommandFlag(tag, label, description=None)#
Bases:
SpsdkEnum
Flags for McuBoot commands.
- HAS_DATA_PHASE = (1, 'DataPhase', 'Command has a data phase')#
- NONE = (0, 'NoFlags', 'No flags specified')#
- class spsdk.mboot.commands.CommandTag(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot Commands.
- CALL = (10, 'Call', 'Call')#
- CONFIGURE_CAN = (195, 'ConfigureCan', 'Configure CAN')#
- CONFIGURE_I2C = (193, 'ConfigureI2c', 'Configure I2C')#
- CONFIGURE_MEMORY = (17, 'ConfigureMemory', 'Configure Quad-SPI Memory')#
- CONFIGURE_SPI = (194, 'ConfigureSpi', 'Configure SPI')#
- ELE_MESSAGE = (25, 'EleMessage', 'Send EdgeLock Enclave Message')#
- EXECUTE = (9, 'Execute', 'Execute')#
- FILL_MEMORY = (5, 'FillMemory', 'Fill Memory')#
- FLASH_ERASE_ALL = (1, 'FlashEraseAll', 'Erase Complete Flash')#
- FLASH_ERASE_ALL_UNSECURE = (13, 'FlashEraseAllUnsecure', 'Erase Complete Flash and Unlock')#
- FLASH_ERASE_REGION = (2, 'FlashEraseRegion', 'Erase Flash Region')#
- FLASH_PROGRAM_ONCE = (14, 'FlashProgramOnce', 'Flash Program Once')#
- FLASH_READ_ONCE = (15, 'FlashReadOnce', 'Flash Read Once')#
- FLASH_READ_RESOURCE = (16, 'FlashReadResource', 'Flash Read Resource')#
- FLASH_SECURITY_DISABLE = (6, 'FlashSecurityDisable', 'Disable Flash Security')#
- FUSE_PROGRAM = (20, 'ProgramFuse', 'Program Fuse')#
- FUSE_READ = (23, 'ReadFuse', 'Read Fuse')#
- GENERATE_KEY_BLOB = (19, 'GenerateKeyBlob', 'Generate Key Blob')#
- GET_PROPERTY = (7, 'GetProperty', 'Get Property')#
- KEY_PROVISIONING = (21, 'KeyProvisioning', 'Key Provisioning')#
- NO_COMMAND = (0, 'NoCommand', 'No Command')#
- READ_MEMORY = (3, 'ReadMemory', 'Read Memory')#
- RECEIVE_SB_FILE = (8, 'ReceiveSBFile', 'Receive SB File')#
- RELIABLE_UPDATE = (18, 'ReliableUpdate', 'Reliable Update')#
- RESET = (11, 'Reset', 'Reset MCU')#
- SET_PROPERTY = (12, 'SetProperty', 'Set Property')#
- TRUST_PROVISIONING = (22, 'TrustProvisioning', 'Trust Provisioning')#
- UPDATE_LIFE_CYCLE = (24, 'UpdateLifeCycle', 'Update Life Cycle')#
- WRITE_MEMORY = (4, 'WriteMemory', 'Write Memory')#
- class spsdk.mboot.commands.FlashReadOnceResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot flash read once response format class.
Initialize the Flash-Read-Once response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.FlashReadResourceResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot flash read resource response format class.
Initialize the Flash-Read-Resource response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.GenerateKeyBlobSelect(tag, label, description=None)#
Bases:
SpsdkEnum
Key selector for the generate-key-blob function.
For devices with SNVS, valid options of [key_sel] are 0, 1 or OTPMK: OTPMK from FUSE or OTP(default), 2 or ZMK: ZMK from SNVS, 3 or CMK: CMK from SNVS, For devices without SNVS, this option will be ignored.
- CMK = (3, 'CMK', 'CMK from SNVS')#
- OPTMK = (0, 'OPTMK', 'OTPMK from FUSE or OTP(default)')#
- ZMK = (2, 'ZMK', 'ZMK from SNVS')#
- class spsdk.mboot.commands.GenericResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot generic response format class.
Initialize the Generic response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.GetPropertyResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot get property response format class.
Initialize the Get-Property response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.KeyProvOperation(tag, label, description=None)#
Bases:
SpsdkEnum
Type of key provisioning operation.
- ENROLL = (0, 'Enroll', 'Enroll Operation')#
- READ_KEY_STORE = (6, 'ReadKeyStore', 'Read Key Store Operation')#
- READ_NON_VOLATILE = (4, 'ReadNonVolatile', 'Read Non Volatile Operation')#
- SET_INTRINSIC_KEY = (2, 'SetIntrinsicKey', 'Set Intrinsic Key Operation')#
- SET_USER_KEY = (1, 'SetUserKey', 'Set User Key Operation')#
- WRITE_KEY_STORE = (5, 'WriteKeyStore', 'Write Key Store Operation')#
- WRITE_NON_VOLATILE = (3, 'WriteNonVolatile', 'Write Non Volatile Operation')#
- class spsdk.mboot.commands.KeyProvUserKeyType(tag, label, description=None)#
Bases:
SpsdkEnum
Enumeration of supported user keys in PUF. Keys are SoC specific, not all will be supported for the processor.
- OTFADKEK = (2, 'OTFADKEK', 'Key for OTFAD encryption')#
- PRINCE_REGION_0 = (7, 'PRINCE0', 'Key for Prince region 0')#
- PRINCE_REGION_1 = (8, 'PRINCE1', 'Key for Prince region 1')#
- PRINCE_REGION_2 = (9, 'PRINCE2', 'Key for Prince region 2')#
- PRINCE_REGION_3 = (10, 'PRINCE3', 'Key for Prince region 3')#
- SBKEK = (3, 'SBKEK', 'Key for SB file encryption')#
- UDS = (12, 'UDS', 'Universal Device Secret for DICE')#
- USERKEK = (11, 'USERKEK', 'Encrypted boot image key')#
- class spsdk.mboot.commands.KeyProvisioningResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot Key Provisioning response format class.
Initialize the Key-Provisioning response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.NoResponse(cmd_tag)#
Bases:
CmdResponse
Special internal case when no response is provided by the target.
Create a NoResponse to an command that was issued, indicated by its tag.
- Parameters:
cmd_tag (
int
) – Tag of the command that preceded the no-response from target
- class spsdk.mboot.commands.ReadMemoryResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot read memory response format class.
Initialize the Read-Memory response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- class spsdk.mboot.commands.ResponseTag(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot Responses to Commands.
- FLASH_READ_ONCE = (175, 'FlashReadOnceResponse', 'Flash Read Once Response')#
- FLASH_READ_RESOURCE = (176, 'FlashReadResourceResponse', 'Flash Read Resource Response')#
- GENERIC = (160, 'GenericResponse', 'Generic Response')#
- GET_PROPERTY = (167, 'GetPropertyResponse', 'Get Property Response')#
- KEY_BLOB_RESPONSE = (179, 'CreateKeyBlobResponse', 'Create Key Blob')#
- KEY_PROVISIONING_RESPONSE = (181, 'KeyProvisioningResponse', 'Key Provisioning Response')#
- READ_MEMORY = (163, 'ReadMemoryResponse', 'Read Memory Response')#
- TRUST_PROVISIONING_RESPONSE = (182, 'TrustProvisioningResponse', 'Trust Provisioning Response')#
- class spsdk.mboot.commands.TrustProvDevHsmDsc(tag, label, description=None)#
Bases:
SpsdkEnum
Type of DSC Device HSM.
- DSC_HSM_CREATE_SESSION = (100663296, 'dsc_hsm_create_session', 'DSC HSM create session')#
- DSC_HSM_ENC_BLK = (100663297, 'dsc_hsm_enc_blk', 'DSC HSM encrypt bulk')#
- DSC_HSM_ENC_SIGN = (100663298, 'dsc_hsm_enc_sign', 'DSC HSM sign')#
- class spsdk.mboot.commands.TrustProvKeyType(tag, label, description=None)#
Bases:
SpsdkEnum
Type of key type definition.
- AESK = (5, 'AESK', 'AES Key')#
- CKDFK = (1, 'CKDFK', 'CKDF Master Key')#
- CMACK = (4, 'CMACK', 'CMAC Key')#
- HKDFK = (2, 'HKDFK', 'HKDF Master Key')#
- HMACK = (3, 'HMACK', 'HMAC Key')#
- KUOK = (6, 'KUOK', 'Key Unwrap Only Key')#
- class spsdk.mboot.commands.TrustProvOemKeyType(tag, label, description=None)#
Bases:
SpsdkEnum
Type of oem key type definition.
- GENSIGNK = (23100, 'GENSIGNK', 'Generic ECDSA Signing Key')#
- GETCUSTMKSK = (15450, 'GETCUSTMKSK', 'CKDF Master Key for Production Firmware Encryption Key')#
- MFWENCK = (42435, 'MFWENCK', 'CKDF Master Key for Manufacturing Firmware Encryption Key')#
- MFWISK = (50085, 'MFWISK', 'ECDSA Manufacturing Firmware Signing Key')#
- class spsdk.mboot.commands.TrustProvOperation(tag, label, description=None)#
Bases:
SpsdkEnum
Operations supported by Trust Provisioning flow.
- HSM_ENC_BLOCK = (5, 'HsmEncBlock', 'HSM Enc block')#
- HSM_ENC_SIGN = (6, 'HsnEncSign', 'HSM enc sign')#
- HSM_GEN_KEY = (3, 'HsmGenKey', 'HSM gen key')#
- HSM_STORE_KEY = (4, 'HsmStoreKey', 'HSM store key')#
- ISP_SET_WRAPPED_DATA = (240, 'SetWrappedData', 'Start processing Wrapped data')#
Type of trust provisioning operation.
- OEM_GEN_MASTER_SHARE = (0, 'OemGenMasterShare', 'Enroll Operation')#
- OEM_GET_CUST_CERT_DICE_PUK = (2, 'SetIntrinsicKey', 'Set Intrinsic Key Operation')#
- OEM_SET_MASTER_SHARE = (1, 'SetUserKey', 'Set User Key Operation')#
- PROVE_GENUINITY = (244, 'ProveGenuinity', 'Start the proving genuinity process')#
- class spsdk.mboot.commands.TrustProvWpc(tag, label, description=None)#
Bases:
SpsdkEnum
Type of WPC trusted facility commands for DSC.
- NXP_GET_ID = (83886081, 'nxp_get_id', 'NXP get ID')#
- WPC_GET_ID = (83886080, 'wpc_get_id', 'WPC get ID')#
- WPC_INSERT_CERT = (83886082, 'wpc_insert_cert', 'WPC insert certificate')#
- WPC_SIGN_CSR = (83886083, 'wpc_sign_csr', 'WPC sign CSR')#
- class spsdk.mboot.commands.TrustProvWrappingKeyType(tag, label, description=None)#
Bases:
SpsdkEnum
Type of wrapping key type definition.
- EXT_SK = (17, 'EXT_SK', 'The wrapping key for wrapping of MFG_CUST_MK_SK0_BLOB')#
- INT_SK = (16, 'INT_SK', 'The wrapping key for wrapping of MFG_CUST_MK_SK0_BLOB')#
- class spsdk.mboot.commands.TrustProvisioningResponse(header, raw_data)#
Bases:
CmdResponse
McuBoot Trust Provisioning response format class.
Initialize the Trust-Provisioning response object.
- Parameters:
header (
CmdHeader
) – Header for the responseraw_data (
bytes
) – Response data
- spsdk.mboot.commands.parse_cmd_response(data, offset=0)#
Parse command response.
- Parameters:
data (
bytes
) – Input data in bytesoffset (
int
) – The offset of input data
- Return type:
- Returns:
De-serialized object from data
MBoot Properties#
Helper module for more human-friendly interpretation of the target device properties.
- class spsdk.mboot.properties.AvailableCommandsValue(tag, raw_values)#
Bases:
PropertyValueBase
Available commands property.
Initialize the AvailableCommands-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
- property tags: List[str]#
List of tags representing Available commands.
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.AvailablePeripheralsValue(tag, raw_values)#
Bases:
PropertyValueBase
Available Peripherals property.
Initialize the AvailablePeripherals-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
- to_int()#
Get the raw integer portion of the property.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.BoolValue(tag, raw_values, true_values=(1,), true_string='YES', false_values=(0,), false_string='NO')#
Bases:
PropertyValueBase
Boolean-based value property.
Initialize the Boolean-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the propertytrue_values (
Tuple
[int
]) – Values representing ‘True’, defaults to (1,)true_string (
str
) – String representing ‘True, defaults to ‘YES’false_values (
Tuple
[int
]) – Values representing ‘False’, defaults to (0,)false_string (
str
) – String representing ‘False, defaults to ‘NO’
- to_int()#
Get the raw integer portion of the property.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.DeviceUidValue(tag, raw_values)#
Bases:
PropertyValueBase
Device UID value property.
Initialize the Version-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
- to_int()#
Get the raw integer portion of the property.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.EnumValue(tag, raw_values, enum, na_msg='Unknown Item')#
Bases:
PropertyValueBase
Enumeration value property.
Initialize the enumeration-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the propertyenum (
Type
[SpsdkEnum
]) – Enumeration to pick fromna_msg (
str
) – Message to display if an item is not found in the enum
- enum#
- to_int()#
Get the raw integer portion of the property.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.ExternalMemoryAttributesValue(tag, raw_values, mem_id=0)#
Bases:
PropertyValueBase
Attributes for external memories.
Initialize the ExternalMemoryAttributes-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the propertymem_id (
int
) – ID of the external memory
- block_size#
- mem_id#
- page_size#
- sector_size#
- start_address#
- to_str()#
Get stringified property representation.
- Return type:
str
- total_size#
- value#
- class spsdk.mboot.properties.FlashReadMargin(tag, label, description=None)#
Bases:
SpsdkEnum
Scopes for flash read.
- FACTORY = (2, 'FACTORY')#
- NORMAL = (0, 'NORMAL')#
- USER = (1, 'USER')#
- class spsdk.mboot.properties.FuseLock(index, locked)#
Bases:
object
Fuse Lock.
Initialize object representing information about fuse lock.
- Parameters:
index (
int
) – value of OTP indexlocked (
bool
) – status of the lock, true if locked
- class spsdk.mboot.properties.FuseLockRegister(value, index, start=0)#
Bases:
object
Fuse Lock Register.
Initialize object representing the OTP Controller Program Locked Status.
- Parameters:
value (
int
) – value of the registerindex (
int
) – index of the fusestart (
int
) – shift to the start of the register
- class spsdk.mboot.properties.FuseLockedStatus(tag, raw_values)#
Bases:
PropertyValueBase
Class representing FuseLocked registers.
Initialize the FuseLockedStatus property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
-
fuses:
List
[FuseLockRegister
]#
- get_fuses()#
Get list of fuses bitfield objects.
- Return type:
List
[FuseLock
]- Returns:
list of FuseLockBitfield objects
- to_str()#
Get stringified property representation.
- Return type:
str
- class spsdk.mboot.properties.IntValue(tag, raw_values, str_format='dec')#
Bases:
PropertyValueBase
Integer-based value property.
Initialize the integer-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the propertystr_format (
str
) – Format to display the value (‘dec’, ‘hex’, ‘size’)
- to_int()#
Get the raw integer property representation.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.IrqNotifierPinValue(tag, raw_values)#
Bases:
PropertyValueBase
IRQ notifier pin property.
Initialize the IrqNotifierPin-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
- property enabled: bool#
Indicates whether IRQ reporting is enabled.
- property pin: int#
Number of the pin used for reporting IRQ.
- property port: int#
Number of the port used for reporting IRQ.
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- class spsdk.mboot.properties.PeripheryTag(tag, label, description=None)#
Bases:
SpsdkEnum
Tags representing peripherals.
- CAN = (8, 'CAN', 'CAN Interface')#
- I2C_SLAVE = (2, 'I2C-Slave', 'I2C Slave Interface')#
- LIN = (128, 'LIN', 'LIN Interface')#
- SPI_SLAVE = (4, 'SPI-Slave', 'SPI Slave Interface')#
- UART = (1, 'UART', 'UART Interface')#
- USB_CDC = (32, 'USB-CDC', 'USB CDC-Class Interface')#
- USB_DFU = (64, 'USB-DFU', 'USB DFU-Class Interface')#
- USB_HID = (16, 'USB-HID', 'USB HID-Class Interface')#
- class spsdk.mboot.properties.PfrKeystoreUpdateOpt(tag, label, description=None)#
Bases:
SpsdkEnum
Options for PFR updating.
- KEY_PROVISIONING = (0, 'KEY_PROVISIONING', 'KeyProvisioning')#
- WRITE_MEMORY = (1, 'WRITE_MEMORY', 'WriteMemory')#
- class spsdk.mboot.properties.PropertyTag(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot Properties.
- AVAILABLE_COMMANDS = (7, 'AvailableCommands', 'Available Commands')#
- AVAILABLE_PERIPHERALS = (2, 'AvailablePeripherals', 'Available Peripherals')#
- BYTE_WRITE_TIMEOUT_MS = (30, 'ByteWriteTimeoutMs', 'Byte Write Timeout in ms')#
- CRC_CHECK_STATUS = (8, 'CrcCheckStatus', 'CRC Check Status')#
- CURRENT_VERSION = (1, 'CurrentVersion', 'Current Version')#
- EXTERNAL_MEMORY_ATTRIBUTES = (25, 'ExternalMemoryAttributes', 'External Memory Attributes')#
- FLASH_ACCESS_SEGMENT_COUNT = (21, 'FlashAccessSegmentCount', 'Flash Access Segment Count')#
- FLASH_ACCESS_SEGMENT_SIZE = (20, 'FlashAccessSegmentSize', 'Flash Access Segment Size')#
- FLASH_BLOCK_COUNT = (6, 'FlashBlockCount', 'Flash Block Count')#
- FLASH_FAC_SUPPORT = (19, 'FlashFacSupport', 'Flash Fac. Support')#
- FLASH_PAGE_SIZE = (27, 'FlashPageSize', 'Flash Page Size')#
- FLASH_READ_MARGIN = (22, 'FlashReadMargin', 'Flash Read Margin')#
- FLASH_SECTOR_SIZE = (5, 'FlashSectorSize', 'Flash Sector Size')#
- FLASH_SECURITY_STATE = (17, 'FlashSecurityState', 'Security State')#
- FLASH_SIZE = (4, 'FlashSize', 'Flash Size')#
- FLASH_START_ADDRESS = (3, 'FlashStartAddress', 'Flash Start Address')#
- FUSE_LOCKED_STATUS = (31, 'FuseLockedStatus', 'Fuse Locked Status')#
- IRQ_NOTIFIER_PIN = (28, 'IrqNotifierPin', 'Irq Notifier Pin')#
- LAST_ERROR = (9, 'LastError', 'Last Error Value')#
- LIST_PROPERTIES = (0, 'ListProperties', 'List Properties')#
- MAX_PACKET_SIZE = (11, 'MaxPacketSize', 'Max Packet Size')#
- PFR_KEYSTORE_UPDATE_OPT = (29, 'PfrKeystoreUpdateOpt', 'PFR Keystore Update Opt')#
- QSPI_INIT_STATUS = (23, 'QspiInitStatus', 'QuadSPI Initialization Status')#
- RAM_SIZE = (15, 'RamSize', 'RAM Size')#
- RAM_START_ADDRESS = (14, 'RamStartAddress', 'RAM Start Address')#
- RELIABLE_UPDATE_STATUS = (26, 'ReliableUpdateStatus', 'Reliable Update Status')#
- RESERVED_REGIONS = (12, 'ReservedRegions', 'Reserved Regions')#
- SYSTEM_DEVICE_IDENT = (16, 'SystemDeviceIdent', 'System Device Identification')#
- TARGET_VERSION = (24, 'TargetVersion', 'Target Version')#
- UNIQUE_DEVICE_IDENT = (18, 'UniqueDeviceIdent', 'Unique Device Identification')#
- UNKNOWN = (255, 'Unknown', 'Unknown property')#
- VALIDATE_REGIONS = (13, 'ValidateRegions', 'Validate Regions')#
- VERIFY_WRITES = (10, 'VerifyWrites', 'Verify Writes')#
- class spsdk.mboot.properties.PropertyTagKw45xx(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot Properties.
- BOOT_STATUS_REGISTER = (20, 'BootStatusRegister', 'Boot Status Register')#
- FIRMWARE_VERSION = (21, 'FirmwareVersion', 'Firmware Version')#
- FUSE_PROGRAM_VOLTAGE = (22, 'FuseProgramVoltage', 'Fuse Program Voltage')#
- VERIFY_ERASE = (10, 'VerifyErase', 'Verify Erase')#
- class spsdk.mboot.properties.PropertyValueBase(tag, name=None, desc=None)#
Bases:
object
Base class for property value.
Initialize the base of property.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagname (
Optional
[str
]) – Optional name for the propertydesc (
Optional
[str
]) – Optional description for the property
- desc#
- name#
- tag#
- to_str()#
Stringified representation of a property.
Derived classes should implement this function.
- Return type:
str
- Returns:
String representation
- Raises:
NotImplementedError – Derived class has to implement this method
- class spsdk.mboot.properties.ReservedRegionsValue(tag, raw_values)#
Bases:
PropertyValueBase
Reserver Regions property.
Initialize the ReserverRegion-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
-
regions:
List
[MemoryRegion
]#
- to_str()#
Get stringified property representation.
- Return type:
str
- class spsdk.mboot.properties.Version(*args, **kwargs)#
Bases:
object
McuBoot current and target version type.
Initialize the Version object.
- Raises:
McuBootError – Argument passed the not str not int
- from_int(value)#
Parse version data from raw int value.
- Parameters:
value (
int
) – Raw integer input- Return type:
None
- from_str(value)#
Parse version data from string value.
- Parameters:
value (
str
) – String representation input- Return type:
None
- to_int(no_mark=False)#
Get version value in raw integer format.
- Parameters:
no_mark (
bool
) – If True, return value without mark- Return type:
int
- Returns:
Integer representation
- to_str(no_mark=False)#
Get version value in readable string format.
- Parameters:
no_mark (
bool
) – If True, return value without mark- Return type:
str
- Returns:
String representation
- class spsdk.mboot.properties.VersionValue(tag, raw_values)#
Bases:
PropertyValueBase
Version property class.
Initialize the Version-based property object.
- Parameters:
tag (
int
) – Property tag, see: PropertyTagraw_values (
List
[int
]) – List of integers representing the property
- to_int()#
Get the raw integer portion of the property.
- Return type:
int
- to_str()#
Get stringified property representation.
- Return type:
str
- value#
- spsdk.mboot.properties.parse_property_value(property_tag, raw_values, ext_mem_id=None, family=None)#
Parse the property value received from the device.
- Parameters:
property_tag (
int
) – Tag representing the propertyraw_values (
List
[int
]) – Data received from the deviceext_mem_id (
Optional
[int
]) – ID of the external memory used to read the property, defaults to Nonefamily (
Optional
[str
]) – supported family
- Return type:
Optional
[PropertyValueBase
]- Returns:
Object representing the property
- spsdk.mboot.properties.size_fmt(value, kibibyte=True)#
Convert size value into string format.
- Parameters:
value (
Union
[int
,float
]) – The raw valuekibibyte (
bool
) – True if 1024 Bytes represent 1kB or False if 1000 Bytes represent 1kB
- Return type:
str
- Returns:
Stringified value
External Memories#
Various types of memory identifiers used in the MBoot module.
- class spsdk.mboot.memories.ExtMemId(tag, label, description=None)#
Bases:
MemIdEnum
McuBoot External Memory Property Tags.
- FLASH_EXEC_ONLY = (16, 'FLASH-EXEC', 'Execute-Only region on internal Flash')#
- FLEX_SPI_NOR = (9, 'FLEX-SPI-NOR', 'Flex SPI NOR Memory')#
- FUSE = (4, 'FUSE', 'Nonvolatile information register 0 (only used by SB loader)')#
- I2C_NOR_EEPROM = (273, 'I2C-MEM', 'I2C NOR/EEPROM Memory')#
- IFR = (4, 'IFR0', 'Nonvolatile information register 0 (only used by SB loader)')#
- MMC_CARD = (289, 'MMC', 'MMC/eMMC Memory Card')#
- QUAD_SPI0 = (1, 'QSPI', 'Quad SPI Memory 0')#
- SD_CARD = (288, 'SD', 'eSD/SD/SDHC/SDXC Memory Card')#
- SEMC_NAND = (256, 'SEMC-NAND', 'SEMC NAND Memory')#
- SEMC_NOR = (8, 'SEMC-NOR', 'SEMC NOR Memory')#
- SPIFI_NOR = (10, 'SPIFI-NOR', 'SPIFI NOR Memory')#
- SPI_NAND = (257, 'SPI-NAND', 'SPI NAND Memory')#
- SPI_NOR_EEPROM = (272, 'SPI-MEM', 'SPI NOR/EEPROM Memory')#
- class spsdk.mboot.memories.ExtMemPropTags(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot External Memory Property Tags.
- BLOCK_SIZE = (16, 'BLOCK_SIZE')#
- INIT_STATUS = (0, 'INIT_STATUS')#
- PAGE_SIZE = (4, 'PAGE_SIZE')#
- SECTOR_SIZE = (8, 'SECTOR_SIZE')#
- SIZE_IN_KBYTES = (2, 'SIZE_IN_KBYTES')#
- START_ADDRESS = (1, 'START_ADDRESS')#
- class spsdk.mboot.memories.ExtMemRegion(mem_id, raw_values=None)#
Bases:
MemoryRegion
External memory regions.
Initialize the external memory region object.
- Parameters:
mem_id (
int
) – ID of the external memoryraw_values (
Optional
[List
[int
]]) – List of integers representing the property
- property name: str#
Get the name of external memory for given memory ID.
- class spsdk.mboot.memories.FlashRegion(index, start, size, sector_size)#
Bases:
MemoryRegion
Flash memory regions.
Initialize the Flash memory region object.
- Parameters:
index (
int
) – number of regionstart (
int
) – start address of regionsize (
int
) – size of regionsector_size (
int
) – size of sector
- class spsdk.mboot.memories.MemId(tag, label, description=None)#
Bases:
MemIdEnum
McuBoot Internal/External Memory Property Tags.
- FLASH_EXEC_ONLY = (16, 'FLASH-EXEC', 'Execute-Only region on internal Flash')#
- FLEX_SPI_NOR = (9, 'FLEX-SPI-NOR', 'Flex SPI NOR Memory')#
- FUSE = (4, 'FUSE', 'Nonvolatile information register 0 (only used by SB loader)')#
- I2C_NOR_EEPROM = (273, 'I2C-MEM', 'I2C NOR/EEPROM Memory')#
- IFR = (4, 'IFR0', 'Nonvolatile information register 0 (only used by SB loader)')#
- INTERNAL_MEMORY = (0, 'RAM/FLASH', 'Internal RAM/FLASH (Used for the PRINCE configuration)')#
- MMC_CARD = (289, 'MMC', 'MMC/eMMC Memory Card')#
- QUAD_SPI0 = (1, 'QSPI', 'Quad SPI Memory 0')#
- SD_CARD = (288, 'SD', 'eSD/SD/SDHC/SDXC Memory Card')#
- SEMC_NAND = (256, 'SEMC-NAND', 'SEMC NAND Memory')#
- SEMC_NOR = (8, 'SEMC-NOR', 'SEMC NOR Memory')#
- SPIFI_NOR = (10, 'SPIFI-NOR', 'SPIFI NOR Memory')#
- SPI_NAND = (257, 'SPI-NAND', 'SPI NAND Memory')#
- SPI_NOR_EEPROM = (272, 'SPI-MEM', 'SPI NOR/EEPROM Memory')#
- class spsdk.mboot.memories.MemIdEnum(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot Memory Base class.
- classmethod get_legacy_int(key)#
Converts legacy int to new enum key.
- Parameters:
key (
int
) – int value of legacy enum- Return type:
Optional
[str
]- Returns:
new enum value
- classmethod get_legacy_str(key)#
Converts legacy str to new enum key.
- Parameters:
key (
str
) – str value of legacy enum- Return type:
Optional
[int
]- Returns:
new enum value
- class spsdk.mboot.memories.MemoryRegion(start, end)#
Bases:
object
Base class for memory regions.
Initialize the memory region object.
- Parameters:
start (
int
) – start address of regionend (
int
) – end address of region
- class spsdk.mboot.memories.RamRegion(index, start, size)#
Bases:
MemoryRegion
RAM memory regions.
Initialize the RAM memory region object.
- Parameters:
index (
int
) – number of regionstart (
int
) – start address of regionsize (
int
) – size of region
MBoot ErrorCodes#
Status and error codes used by the MBoot protocol.
- class spsdk.mboot.error_codes.StatusCode(tag, label, description=None)#
Bases:
SpsdkEnum
McuBoot status codes.
- ABORT_DATA_PHASE = (10002, 'AbortDataPhase', 'Abort Data Phase')#
- APP_CRC_CHECK_FAILED = (10401, 'AppCrcCheckFailed', 'Application: CRC Check: Failed')#
- APP_CRC_CHECK_INACTIVE = (10402, 'AppCrcCheckInactive', 'Application CRC Check: Inactive')#
- APP_CRC_CHECK_INVALID = (10403, 'AppCrcCheckInvalid', 'Application CRC Check: Invalid')#
- APP_CRC_CHECK_OUT_OF_RANGE = (10404, 'AppCrcCheckOutOfRange', 'Application CRC Check: Out Of Range')#
- APP_CRC_CHECK_PASSED = (10400, 'AppCrcCheckPassed', 'Application CRC Check: Passed')#
- EDGELOCK_ABORT = (30002, 'EDGELOCK_Abort', 'EDGELOCK: Abort')#
- EDGELOCK_INVALID_LIFECYCLE = (30007, 'EDGELOCK_InvalidLifecycle', 'EDGELOCK: Invalid Lifecycle')#
- EDGELOCK_INVALID_RESPONSE = (30000, 'EDGELOCK_InvalidResponse', 'EDGELOCK: Invalid Response')#
- EDGELOCK_OPERATION_FAILED = (30003, 'EDGELOCK_OperationFailed', 'EDGELOCK: Operation Failed')#
- EDGELOCK_OTP_INVALID_IDX = (30006, 'EDGELOCK_OTPInvalidIDX', 'EDGELOCK: OTP Invalid IDX')#
- EDGELOCK_OTP_LOCKED = (30005, 'EDGELOCK_OTPLocked', 'EDGELOCK: OTP Locked')#
- EDGELOCK_OTP_PROGRAM_FAILURE = (30004, 'EDGELOCK_OTPProgramFailure', 'EDGELOCK: OTP Program Failure')#
- EDGELOCK_RESPONSE_ERROR = (30001, 'EDGELOCK_ResponseError', 'EDGELOCK: Response Error')#
- FAIL = (1, 'Fail', 'Fail')#
- FLASH_ACCESS_ERROR = (103, 'FlashAccessError', 'FLASH Driver: Access Error')#
- FLASH_ADDRESS_ERROR = (102, 'FlashAddressError', 'FLASH Driver: Address Error')#
- FLASH_ALIGNMENT_ERROR = (101, 'FlashAlignmentError', 'FLASH Driver: Alignment Error')#
- FLASH_BLANK_IFR_PAGE_DATA = (133, 'FlashBlankIfrPageData', 'FLASH Driver: Blank IFR Page Data')#
- FLASH_CFPA_SCRATCH_PAGE_INVALID = (148, 'FlashCfpaScratchPageInvalid', 'FLASH Driver: CFPA Scratch Page Invalid')#
- FLASH_CFPA_VERSION_ROLLBACK_DISALLOWED = (149, 'FlashCfpaVersionRollbackDisallowed', 'FLASH Driver: CFPA Version Rollback Disallowed')#
- FLASH_CMPA_CFG_DIRECT_ERASE_NOT_ALLOWED = (140, 'FlashCmpaCfgDirectEraseNotAllowed', 'FLASH Driver: CMPA Cfg Direct Erase Not Allowed')#
- FLASH_COMMAND_FAILURE = (105, 'FlashCommandFailure', 'FLASH Driver: Command Failure')#
- FLASH_COMMAND_NOT_SUPPORTED = (111, 'FlashCommandNotSupported', 'FLASH Driver: Command Not Supported')#
- FLASH_COMMAND_OPERATION_IN_PROGRESS = (152, 'FlashCommandOperationInProgress', 'FLASH Driver: Flash Memory State Busy Flash Memory Command Is In Progress')#
- FLASH_COMPARE_ERROR = (117, 'FlashCompareError', 'FLASH Driver: Destination And Source Memory Contents Do Not Match')#
- FLASH_ECC_ERROR = (116, 'FlashEccError', 'FLASH Driver: ECC Error')#
- FLASH_ENCRYPTED_REGIONS_ERASE_NOT_DONE_AT_ONCE = (134, 'FlashEncryptedRegionsEraseNotDoneAtOnce', 'FLASH Driver: Encrypted Regions Erase Not Done At Once')#
- FLASH_ERASE_KEY_ERROR = (107, 'FlashEraseKeyError', 'FLASH Driver: Provided Key Does Not Match Programmed Flash Memory Key')#
- FLASH_EXEC_IN_RAM_NOT_READY = (109, 'FlashExecuteInRamFunctionNotReady', 'FLASH Driver: Execute In RAM Function Not Ready')#
- FLASH_HASH_CHECK_ERROR = (136, 'FlashHashCheckError', 'FLASH Driver: Hash Check Error')#
- FLASH_INVALID_PROPERTY_VALUE = (113, 'FlashInvalidPropertyValue', 'FLASH Driver: Flash Memory Property Value Out Of Range')#
- FLASH_INVALID_SPECULATION_OPTION = (114, 'FlashInvalidSpeculationOption', 'FLASH Driver: Flash Memory Prefetch Speculation Option Is Invalid')#
- FLASH_INVALID_WAIT_STATE_CYCLES = (119, 'FlashInvalidWaitStateCycles', 'FLASH Driver: Wait State Cycle Set To Read/Write Mode Is Invalid')#
- FLASH_MODIFY_PROTECTED_AREA_DISALLOWED = (151, 'FlashModifyProtectedAreaDisallowed', 'FLASH Driver: Flash Firewall Page Locked Erase And Program Are Not Allowed')#
- FLASH_NMPA_UPDATE_NOT_ALLOWED = (139, 'FlashNmpaUpdateNotAllowed', 'FLASH Driver: NMPA Update Not Allowed')#
- FLASH_OUT_OF_DATE_CFPA_PAGE = (132, 'FlashOutOfDateCfpaPage', 'FLASH Driver: Out Of Date CFPA Page')#
- FLASH_PFR_BANK_IS_LOCKED = (141, 'FlashPfrBankIsLocked', 'FLASH Driver: PFR Bank Is Locked')#
- FLASH_PFR_REGION_WRITE_BROKEN = (138, 'FlashPfrRegionWriteBroken', 'FLASH Driver: PFR Region Write Broken')#
- FLASH_PROGRAM_VERIFICATION_NOT_ALLOWED = (135, 'FlashProgramVerificationNotAllowed', 'FLASH Driver: Program Verification Not Allowed')#
- FLASH_PROTECTION_VIOLATION = (104, 'FlashProtectionViolation', 'FLASH Driver: Protection Violation')#
- FLASH_READ_HIDING_AREA_DISALLOWED = (150, 'FlashReadHidingAreaDisallowed', 'FLASH Driver: Flash Memory Hiding Read Not Allowed')#
- FLASH_READ_ONLY_PROPERTY = (112, 'FlashReadOnlyProperty', 'FLASH Driver: Flash Memory Property Is Read-Only')#
- FLASH_REGION_EXECUTE_ONLY = (108, 'FlashRegionExecuteOnly', 'FLASH Driver: Region Execute Only')#
- FLASH_REGULATION_LOSS = (118, 'FlashRegulationLoss', 'FLASH Driver: Loss Of Regulation During Read')#
- FLASH_SEALED_PFR_REGION = (137, 'FlashSealedPfrRegion', 'FLASH Driver: Sealed PFR Region')#
- FLASH_SIZE_ERROR = (100, 'FlashSizeError', 'FLASH Driver: Size Error')#
- FLASH_UNKNOWN_PROPERTY = (106, 'FlashUnknownProperty', 'FLASH Driver: Unknown Property')#
- FLEXSPINAND_ECC_CHECK_FAIL = (20002, 'FlexSPINANDEccCheckFail', 'FlexSPINAND: Ecc Check Fail')#
- FLEXSPINAND_ERASE_BLOCK_FAIL = (20005, 'FlexSPINANDEraseBlockFail', 'FlexSPINAND: Erase Block Fail')#
- FLEXSPINAND_NOT_FOUND = (20011, 'FlexSPINANDNotFound', 'FlexSPINAND: Not Found')#
- FLEXSPINAND_PAGE_EXECUTE_FAIL = (20004, 'FlexSPINANDPageExecuteFail', 'FlexSPINAND: Page Execute Fail')#
- FLEXSPINAND_PAGE_LOAD_FAIL = (20003, 'FlexSPINANDPageLoadFail', 'FlexSPINAND: Page Load Fail')#
- FLEXSPINAND_READ_CACHE_FAIL = (20001, 'FlexSPINANDReadCacheFail', 'FlexSPINAND: Read Cache Fail')#
- FLEXSPINAND_READ_PAGE_FAIL = (20000, 'FlexSPINANDReadPageFail', 'FlexSPINAND: Read Page Fail')#
- FLEXSPINAND_WAIT_TIMEOUT = (20006, 'FlexSPINANDWaitTimeout', 'FlexSPINAND: Wait Timeout')#
- FLEXSPINAND_WRITEALIGNMENTERROR = (20010, 'FlexSPINANDWriteAlignmentError', 'FlexSPINAND: Write Alignment Error')#
- FLEXSPINOR_COMMANDFAILURE = (20106, 'FlexSPINORCommandFailure', 'FlexSPINOR: Command Failure')#
- FLEXSPINOR_DTR_READ_DUMMYPROBEFAILED = (20110, 'FLEXSPINORDTRReadDummyProbeFailed', 'FLEXSPINOR: DTR Read Dummy Probe Failed')#
- FLEXSPINOR_ERASE_ALL_FAIL = (20102, 'FLEXSPINOREraseAllFail', 'FLEXSPINOR: Erase All Fail')#
- FLEXSPINOR_ERASE_SECTOR_FAIL = (20101, 'FLEXSPINOREraseSectorFail', 'FLEXSPINOR: Erase Sector Fail')#
- FLEXSPINOR_FLASH_NOTFOUND = (20109, 'FLEXSPINORFlashNotFound', 'FLEXSPINOR Flash Not Found')#
- FLEXSPINOR_NOT_SUPPORTED = (20104, 'FLEXSPINORPageSizeOverTheMaxSupportedSize', 'FlexSPINOR: PageSize over the max supported size')#
- FLEXSPINOR_PROGRAM_FAIL = (20100, 'FLEXSPINORProgramFail', 'FLEXSPINOR: Program Fail')#
- FLEXSPINOR_SFDP_NOTFOUND = (20107, 'FlexSPINORSFDPNotFound', 'FlexSPINOR: SFDP Not Found')#
- FLEXSPINOR_UNSUPPORTED_SFDP_VERSION = (20108, 'FLEXSPINORUnsupportedSFDPVersion', 'FLEXSPINOR: Unsupported SFDP Version')#
- FLEXSPINOR_WAIT_TIMEOUT = (20103, 'FLEXSPINORWaitTimeout', 'FLEXSPINOR:Wait Timeout')#
- FLEXSPINOR_WRITE_ALIGNMENT_ERROR = (20105, 'FlexSPINORWriteAlignmentError', 'FlexSPINOR:Write Alignment Error')#
- FLEXSPI_DEVICE_TIMEOUT = (7002, 'FLEXSPI_DeviceTimeout', 'FLEXSPI: Device Timeout')#
- FLEXSPI_DEVICE_TIMEOUT_RT5xx = (6002, 'FLEXSPI_DeviceTimeout_RT5xx', 'FLEXSPI: Device Timeout')#
- FLEXSPI_INVALID_SEQUENCE = (7001, 'FLEXSPI_InvalidSequence', 'FLEXSPI: Invalid Sequence')#
- FLEXSPI_INVALID_SEQUENCE_RT5xx = (6001, 'FLEXSPI_InvalidSequence_RT5xx', 'FLEXSPI: Invalid Sequence')#
- FLEXSPI_SEQUENCE_EXECUTION_TIMEOUT = (7000, 'FLEXSPI_SequenceExecutionTimeout', 'FLEXSPI: Sequence Execution Timeout')#
- FLEXSPI_SEQUENCE_EXECUTION_TIMEOUT_RT5xx = (6000, 'FLEXSPI_SequenceExecutionTimeout_RT5xx', 'FLEXSPI: Sequence Execution Timeout')#
- FlexSPINAND_DBBT_UPDATE_FAIL = (20009, 'Failed to update discovered bad block table to SPI NAND', 'SPI NAND: Failed to update discovered bad block table to SPI NAND')#
- FlexSPINAND_FCB_UPDATE_FAIL = (20008, 'FailedToUpdateFlashConfigBlockToSPINAND', 'SPI NAND: Failed to update Flash config block to SPI NAND')#
- FlexSPINAND_NOT_SUPPORTED = (20007, 'SPINANDPageSizeOverTheMaxSupportedSize', 'SPI NAND: PageSize over the max supported size')#
- I2C_ARBITRATION_LOST = (202, 'I2cArbitrationLost', 'I2C Driver: Arbitration Lost')#
- I2C_SLAVE_RX_OVERRUN = (201, 'I2cSlaveRxOverrun', 'I2C Driver: Slave Rx Overrun')#
- I2C_SLAVE_TX_UNDERRUN = (200, 'I2cSlaveTxUnderrun', 'I2C Driver: Slave Tx Underrun')#
- IAP_COMMAND_NOT_SUPPORTED = (100006, 'IAP_CommandNotSupported', 'IAP: Specific Command Not Supported')#
- IAP_CUMULATIVE_WRITE = (100004, 'IAP_CumulativeWrite', 'IAP: Flash Memory Region To Be Programmed Is Not Empty')#
- IAP_ERASE_FAILUIRE = (100005, 'IAP_EraseFailuire', 'IAP: Erase Operation Failed')#
- IAP_INVALID_ARGUMENT = (100001, 'IAP_InvalidArgument', 'IAP: Invalid Argument Detected During API Execution')#
- IAP_MEMORY_ACCESS_DISABLED = (100007, 'IAP_MemoryAccessDisabled', 'IAP: Memory Access Disabled')#
- IAP_OUT_OF_MEMORY = (100002, 'IAP_OutOfMemory', 'IAP: Heap Size Not Large Enough During API Execution')#
- IAP_READ_DISALLOWED = (100003, 'IAP_ReadDisallowed ', 'IAP: Read Memory Operation Disallowed During API Execution')#
- INVALID_ARGUMENT = (4, 'InvalidArgument', 'Invalid Argument Error')#
- INVALID_PROPERTY_VALUE = (10302, 'InvalidPropertyValue', 'Invalid Property Value')#
- MEMORY_ADDRESS_ERROR = (10209, 'MemoryAddressError', 'Memory Address Error')#
- MEMORY_ALIGNMENT_ERROR = (10206, 'MemoryAlignmentError', 'Memory Alignment Error')#
- MEMORY_APP_OVERLAP_WITH_EXECUTE_ONLY_REGION = (10204, 'MemoryAppOverlapWithExecuteOnlyRegion', 'Memory App Overlap with exec region')#
- MEMORY_BLANK_CHECK_FAILED = (10210, 'MemoryBlankCheckFailed', 'Memory Black Check Failed')#
- MEMORY_BLANK_PAGE_READ_DISALLOWED = (10211, 'MemoryBlankPageReadDisallowed', 'Memory Blank Page Read Disallowed')#
- MEMORY_CUMULATIVE_WRITE = (10203, 'MemoryCumulativeWrite', 'Memory Cumulative Write')#
- MEMORY_NOT_CONFIGURED = (10205, 'MemoryNotConfigured', 'Memory Not Configured')#
- MEMORY_PFR_SPEC_REGION_WRITE_BROKEN = (10213, 'MemoryPfrSpecRegionWriteBroken', 'Memory PFR Spec Region Write Broken')#
- MEMORY_PROTECTED_PAGE_READ_DISALLOWED = (10212, 'MemoryProtectedPageReadDisallowed', 'Memory Protected Page Read Disallowed')#
- MEMORY_RANGE_INVALID = (10200, 'MemoryRangeInvalid', 'Memory Range Invalid')#
- MEMORY_READ_FAILED = (10201, 'MemoryReadFailed', 'Memory Read Failed')#
- MEMORY_UNSUPPORTED_COMMAND = (10214, 'MemoryUnsupportedCommand', 'Memory Unsupported Command')#
- MEMORY_VERIFY_FAILED = (10207, 'MemoryVerifyFailed', 'Memory Verify Failed')#
- MEMORY_WRITE_FAILED = (10202, 'MemoryWriteFailed', 'Memory Write Failed')#
- MEMORY_WRITE_PROTECTED = (10208, 'MemoryWriteProtected', 'Memory Write Protected')#
- NO_RESPONSE = (10004, 'NoResponse', 'No response packet from target device')#
- NO_RESPONSE_EXPECTED = (10005, 'NoResponseExpected', 'No Response Expected')#
- NO_TRANSFER_IN_PROGRESS = (6, 'NoTransferInProgress', 'No Transfer In Progress Error')#
- OCOTP_PROGRAM_FAILURE = (20201, 'OCOTPProgramFailure', 'OCOTP: Program Failure')#
- OCOTP_READ_FAILURE = (20200, 'OCOTPReadFailure', 'OCOTP: Read Failure')#
- OCOTP_RELOAD_FAILURE = (20202, 'OCOTPReloadFailure', 'OCOTP: Reload Failure')#
- OCOTP_WAIT_TIMEOUT = (20203, 'OCOTPWaitTimeout', 'OCOTP: Wait Timeout')#
- OTFAD_INVALID_KEY = (502, 'OtfadInvalidKey', 'OTFAD Driver: Invalid Key')#
- OTFAD_INVALID_KEY_BLOB = (503, 'OtfadInvalidKeyBlob', 'OTFAD Driver: Invalid Key Blob')#
- OTFAD_LOGICALLY_DISABLED = (501, 'OtfadLogicallyDisabled', 'OTFAD Driver: Logically Disabled')#
- OTFAD_SECURITY_VIOLATION = (500, 'OtfadSecurityViolation', 'OTFAD Driver: Security Violation')#
- OTP_CRC_CHECK_PASS = (52808, 'OTP_CRCCheckPass', 'OTP: CRC check passed')#
- OTP_CRC_FAIL = (52803, 'OTP_CRCFail', 'OTP: CRC check failed')#
- OTP_ECC_CRC_FAIL = (52805, 'OTP_EccCheckFail', 'OTP: ECC check failed during OTP operation')#
- OTP_ERROR = (52804, 'OTP_Error', 'OTP: Error happened during OTP operation')#
- OTP_INVALID_ADDRESS = (52801, 'OTP_InvalidAddress', 'OTD: Invalid OTP address')#
- OTP_LOCKED = (52806, 'OTP_FieldLocked', 'OTP: Field is locked when programming')#
- OTP_PROGRAM_FAIL = (52802, 'OTP_ProgrammingFail', 'OTD: Programming failed')#
- OTP_TIMEOUT = (52807, 'OTP_Timeout', 'OTP: Operation timed out')#
- OTP_VERIFY_FAIL = (52009, 'OPT_VerifyFail', 'OTP: Failed to verify OTP write')#
- OUT_OF_RANGE = (3, 'OutOfRange', 'Out Of Range Error')#
- PACKETIZER_INVALID_CRC = (10502, 'InvalidCRC', 'Packetizer Error: Invalid packet type')#
- PACKETIZER_INVALID_PACKET_TYPE = (10501, 'InvalidPacketType', 'Packetizer Error: No response received for ping command')#
- PACKETIZER_NO_COMMAND_RESPONSE = (10503, 'NoCommandResponse', 'Packetizer Error: No response received for command')#
- PACKETIZER_NO_PING_RESPONSE = (10500, 'NoPingResponse', 'Packetizer Error: No Ping Response')#
- PING_ERROR = (10003, 'PingError', 'Ping Error')#
- QSPI_COMMAND_NOT_SUPPORTED = (406, 'QspiCommandNotSupported', 'QSPI Driver: Command Not Supported')#
- QSPI_COMMAND_TIMEOUT = (407, 'QspiCommandTimeout', 'QSPI Driver: Command Timeout')#
- QSPI_FLASH_ADDRESS_ERROR = (402, 'QspiFlashAddressError', 'QSPI Driver: Flash Address Error')#
- QSPI_FLASH_ALIGNMENT_ERROR = (401, 'QspiFlashAlignmentError', 'QSPI Driver: Flash Alignment Error')#
- QSPI_FLASH_COMMAND_FAILURE = (403, 'QspiFlashCommandFailure', 'QSPI Driver: Flash Command Failure')#
- QSPI_FLASH_SIZE_ERROR = (400, 'QspiFlashSizeError', 'QSPI Driver: Flash Size Error')#
- QSPI_FLASH_UNKNOWN_PROPERTY = (404, 'QspiFlashUnknownProperty', 'QSPI Driver: Flash Unknown Property')#
- QSPI_NOT_CONFIGURED = (405, 'QspiNotConfigured', 'QSPI Driver: Not Configured')#
- QSPI_WRITE_FAILURE = (408, 'QspiWriteFailure', 'QSPI Driver: Write Failure')#
- READ_ONLY = (2, 'ReadOnly', 'Read Only Error')#
- READ_ONLY_PROPERTY = (10301, 'ReadOnlyProperty', 'Read Only Property')#
- RELIABLE_UPDATE_BACKUPAPPLICATIONINVALID = (10603, 'ReliableUpdateBackupApplicationInvalid', 'Reliable Update: Backup Application Invalid')#
- RELIABLE_UPDATE_BACKUPBOOTLOADERNOTREADY = (10606, 'ReliableUpdateBackupBootloaderNotReady', 'Reliable Update: Backup Bootloader Not Ready')#
- RELIABLE_UPDATE_FAIL = (10601, 'ReliableUpdateFail', 'Reliable Update: Fail')#
- RELIABLE_UPDATE_INACTIVE = (10602, 'ReliableUpdateInactive', 'Reliable Update: Inactive')#
- RELIABLE_UPDATE_STILLINMAINAPPLICATION = (10604, 'ReliableUpdateStillInMainApplication', 'Reliable Update: Still In Main Application')#
- RELIABLE_UPDATE_SUCCESS = (10600, 'ReliableUpdateSuccess', 'Reliable Update: Success')#
- RELIABLE_UPDATE_SWAPINDICATORADDRESSINVALID = (10607, 'ReliableUpdateSwapIndicatorAddressInvalid', 'Reliable Update: Swap Indicator Address Invalid')#
- RELIABLE_UPDATE_SWAPSYSTEMNOTAVAILABLE = (10608, 'ReliableUpdateSwapSystemNotAvailable', 'Reliable Update: Swap System Not Available')#
- RELIABLE_UPDATE_SWAPSYSTEMNOTREADY = (10605, 'ReliableUpdateSwapSystemNotReady', 'Reliable Update: Swap System Not Ready')#
- RELIABLE_UPDATE_SWAPTEST = (10609, 'ReliableUpdateSwapTest', 'Reliable Update: Swap Test')#
- ROMLDR_BAD_SBKEK = (10118, 'RomLdrBadSBKEK', 'ROM Loader: Bad SBKEK Detected')#
- ROMLDR_CALL_FAILED = (10111, 'RomLdrCallFailed', 'ROM Loader: Call Failed')#
- ROMLDR_CHECKSUM = (10105, 'RomLdrChecksum', 'ROM Loader: Checksum Error')#
- ROMLDR_CRC32_ERROR = (10106, 'RomLdrCrc32Error', 'ROM Loader: CRC32 Error')#
- ROMLDR_DATA_UNDERRUN = (10109, 'RomLdrDataUnderrun', 'ROM Loader: Data Underrun')#
- ROMLDR_EOF_REACHED = (10104, 'RomLdrEOFReached', 'ROM Loader: EOF Reached')#
- ROMLDR_ID_NOT_FOUND = (10108, 'RomLdrIdNotFound', 'ROM Loader: ID Not Found')#
- ROMLDR_INVALID_SECTION_MAC_COUNT = (10116, 'RomLdrInvalidSectionMacCount', 'ROM Loader: Invalid Section Mac Count')#
- ROMLDR_JUMP_RETURNED = (10110, 'RomLdrJumpReturned', 'ROM Loader: Jump Returned')#
- ROMLDR_KEY_NOT_FOUND = (10112, 'RomLdrKeyNotFound', 'ROM Loader: Key Not Found')#
- ROMLDR_PENDING_JUMP_COMMAND = (10119, 'RomLdrPendingJumpCommand', 'ROM Loader: Pending Jump Command')#
- ROMLDR_RESET_RETURNED = (10114, 'RomLdrResetReturned', 'ROM Loader: Reset Returned')#
- ROMLDR_ROLLBACK_BLOCKED = (10115, 'RomLdrRollbackBlocked', 'ROM Loader: Rollback Blocked')#
- ROMLDR_SECTION_LENGTH = (10102, 'RomLdrSectionLength', 'ROM Loader: Section Length Error')#
- ROMLDR_SECTION_OVERRUN = (10100, 'RomLdrSectionOverrun', 'ROM Loader: Section Overrun')#
- ROMLDR_SECURE_ONLY = (10113, 'RomLdrSecureOnly', 'ROM Loader: Secure Only')#
- ROMLDR_SIGNATURE = (10101, 'RomLdrSignature', 'ROM Loader: Signature Error')#
- ROMLDR_UNENCRYPTED_ONLY = (10103, 'RomLdrUnencryptedOnly', 'ROM Loader: Unencrypted Only')#
- ROMLDR_UNEXPECTED_COMMAND = (10117, 'RomLdrUnexpectedCommand', 'ROM Loader: Unexpected Command')#
- ROMLDR_UNKNOWN_COMMAND = (10107, 'RomLdrUnknownCommand', 'ROM Loader: Unknown Command')#
- ROM_API_BUFFER_SIZE_NOT_ENOUGH = (10801, 'RomApiBufferSizeNotEnough', 'RomApi: Buffer Size Not Enough')#
- ROM_API_INVALID_BUFFER = (10802, 'RomApiInvalidBuffer', 'RomApi: Invalid Buffer')#
- ROM_API_NEED_MORE_DATA = (10800, 'RomApiNeedMoreData', 'RomApi: Need More Data')#
- SECURITY_SUBSYSTEM_ERROR = (1515890085, 'SecuritySubSystemError', 'Security SubSystem Error')#
- SECURITY_VIOLATION = (10001, 'SecurityViolation', 'Security Violation')#
- SEMCNAND_CANNOT_ENABLE_DEVICE_ECC = (21206, 'SemcNAND_CannotEnableDeviceEcc', 'SemcNAND: Cannot Enable Device Ecc')#
- SEMCNAND_DEVICE_TIMEOUT = (21200, 'SemcNAND_DeviceTimeout', 'SemcNAND: Device Timeout')#
- SEMCNAND_DISALLOW_OVERWRITE_BCB = (21219, 'SemcNAND_DisallowOverwriteBcb', 'SemcNAND: Disallow Overwrite Bcb')#
- SEMCNAND_DISORDERED_IMAGE_COPIES = (21222, 'SemcNAND_DisorderedImageCopies', 'SemcNAND: Disordered Image Copies')#
- SEMCNAND_ECC_CHECK_FAIL = (21204, 'SemcNAND_EccCheckFail', 'SemcNAND: Ecc Check Fail')#
- SEMCNAND_ERASE_VERIFY_FAILURE = (21209, 'SemcNAND_EraseVerifyFailure', 'SemcNAND: Erase Verify Failure')#
- SEMCNAND_FAIL_TO_UPDATE_DBBT = (21218, 'SemcNAND_FailToUpdateDbbt', 'SemcNAND: Fail To Update Dbbt')#
- SEMCNAND_FAIL_TO_UPDATE_FCB = (21217, 'SemcNAND_FailToUpdateFcb', 'SemcNAND: Fail To Update Fcb')#
- SEMCNAND_INVALID_CFG_TAG = (21216, 'SemcNAND_InvalidCfgTag', 'SemcNAND: Invalid Cfg Tag')#
- SEMCNAND_INVALID_MEMORY_ADDRESS = (21201, 'SemcNAND_InvalidMemoryAddress', 'SemcNAND: Invalid Memory Address')#
- SEMCNAND_INVALID_ONFI_PARAMETER = (21205, 'SemcNAND_InvalidOnfiParameter', 'SemcNAND: Invalid Onfi Parameter')#
- SEMCNAND_INVALID_READBACK_BUFFER = (21210, 'SemcNAND_InvalidReadbackBuffer', 'SemcNAND: Invalid Readback Buffer')#
- SEMCNAND_MORE_THAN_MAX_IMAGE_COPY = (21221, 'SemcNAND_MoreThanMaxImageCopy', 'SemcNAND: More Than Max Image Copy')#
- SEMCNAND_MORE_THAN_ONE_PAGE_SIZE = (21203, 'SemcNAND_MoreThanOnePageSize', 'SemcNAND: More Than One Page Size')#
- SEMCNAND_NOT_EQUAL_TO_ONE_PAGE_SIZE = (21202, 'SemcNAND_NotEqualToOnePageSize', 'SemcNAND: Not Equal To One Page Size')#
- SEMCNAND_ONLY_SUPPORT_ONFI_DEVICE = (21220, 'SemcNAND_OnlySupportOnfiDevice', 'SemcNAND: Only Support Onfi Device')#
- SEMCNAND_PROGRAM_VERIFY_FAILURE = (21208, 'SemcNAND_ProgramVerifyFailure', 'SemcNAND: Program Verify Failure')#
- SEMCNAND_SWITCH_TIMING_MODE_FAILURE = (21207, 'SemcNAND_SwitchTimingModeFailure', 'SemcNAND: Switch Timing Mode Failure')#
- SEMCNOR_ADDRESS_ALIGNMENT_ERROR = (21103, 'SemcNOR_AddressAlignmentError', 'SemcNOR: Address Alignment Error')#
- SEMCNOR_BLOCK_ERASE_COMMAND_FAILURE = (21107, 'SemcNOR_BlockEraseCommandFailure', 'SemcNOR: Block Erase Command Failure')#
- SEMCNOR_BUFFER_PROGRAM_COMMAND_FAILURE = (21108, 'SemcNOR_BufferProgramCommandFailure', 'SemcNOR: Buffer Program Command Failure')#
- SEMCNOR_COMMAND_ERROR_NO_INFO_AVAILABLE = (21106, 'SemcNOR_CommandErrorNoInfoAvailable', 'SemcNOR: Command Error No Info Available')#
- SEMCNOR_COMMAND_ERROR_NO_OP_TO_SUSPEND = (21105, 'SemcNOR_CommandErrorNoOpToSuspend', 'SemcNOR: Command Error No Op To Suspend')#
- SEMCNOR_DEVICE_TIMEOUT = (21100, 'SemcNOR_DeviceTimeout', 'SemcNOR: Device Timeout')#
- SEMCNOR_ERASE_VERIFY_FAILURE = (21110, 'SemcNOR_EraseVerifyFailure', 'SemcNOR: Erase Verify Failure')#
- SEMCNOR_INVALID_CFG_TAG = (21116, 'SemcNOR_InvalidCfgTag', 'SemcNOR: Invalid Cfg Tag')#
- SEMCNOR_INVALID_CFI_SIGNATURE = (21104, 'SemcNOR_InvalidCfiSignature', 'SemcNOR: Invalid Cfi Signature')#
- SEMCNOR_INVALID_MEMORY_ADDRESS = (21101, 'SemcNOR_InvalidMemoryAddress', 'SemcNOR: Invalid Memory Address')#
- SEMCNOR_PROGRAM_VERIFY_FAILURE = (21109, 'SemcNOR_ProgramVerifyFailure', 'SemcNOR: Program Verify Failure')#
- SEMCNOR_UNMATCHED_COMMAND_SET = (21102, 'SemcNOR_unmatchedCommandSet', 'SemcNOR: unmatched Command Set')#
- SENDING_OPERATION_CONDITION_ERROR = (1812, 'SendOperationConditionError', 'Send Operation Condition failed')#
- SERIAL_NOR_EEPROM_ADDRESS_INVALID = (10700, 'SerialNorEepromAddressInvalid', 'SerialNorEeprom: Address Invalid')#
- SERIAL_NOR_EEPROM_COMMAND_INVALID = (10704, 'SerialNorEepromCommandInvalid', 'SerialNorEeprom: Command Invalid')#
- SERIAL_NOR_EEPROM_SIZE_INVALID = (10703, 'SerialNorEepromSizeInvalid', 'SerialNorEeprom: Size Invalid')#
- SERIAL_NOR_EEPROM_TRANSFER_ERROR = (10701, 'SerialNorEepromTransferError', 'SerialNorEeprom: Transfer Error')#
- SERIAL_NOR_EEPROM_TYPE_INVALID = (10702, 'SerialNorEepromTypeInvalid', 'SerialNorEeprom: Type Invalid')#
- SPIFINOR_COMMAND_FAILURE = (22006, 'SPIFINOR_CommandFailure', 'SPIFINOR: Command Failure')#
- SPIFINOR_ERASE_ALL_FAIL = (22002, 'SPIFINOR_EraseAllFail', 'SPIFINOR: Erase All Fail')#
- SPIFINOR_ERASE_SECTORFAIL = (22001, 'SPIFINOR_EraseSectorFail', 'SPIFINOR: Erase Sector Fail')#
- SPIFINOR_NOT_SUPPORTED = (22004, 'SPIFINOR_NotSupported', 'SPIFINOR: Not Supported')#
- SPIFINOR_PROGRAM_FAIL = (22000, 'SPIFINOR_ProgramFail', 'SPIFINOR: Program Fail')#
- SPIFINOR_SFDP_NOT_FOUND = (22007, 'SPIFINOR_SFDP_NotFound', 'SPIFINOR: SFDP Not Found')#
- SPIFINOR_WAIT_TIMEOUT = (22003, 'SPIFINOR_WaitTimeout', 'SPIFINOR: Wait Timeout')#
- SPIFINOR_WRITE_ALIGNMENTERROR = (22005, 'SPIFINOR_WriteAlignmentError', 'SPIFINOR: Write Alignment Error')#
- SPI_SLAVE_RX_OVERRUN = (301, 'SpiSlaveRxOverrun', 'SPI Driver: Slave Rx Overrun')#
- SPI_SLAVE_TX_UNDERRUN = (300, 'SpiSlaveTxUnderrun', 'SPI Driver: Slave Tx Underrun')#
- SUCCESS = (0, 'Success', 'Success')#
- TIMEOUT = (5, 'TimeoutError', 'Timeout Error')#
- TP_ADDRESS_ERROR = (80005, 'TP_ADDRESS_ERROR', 'TP: Address out of allowed range or buffer could not be allocated')#
- TP_ADDR_OUT_OF_RANGE = (80018, 'TP_ADDR_OUT_OF_RANGE', 'TP: Address is out of range')#
- TP_ALREADYINITIALIZED = (80003, 'TP_ALREADYINITIALIZED', 'TP: Already initialized')#
- TP_BUFFERSMALL = (80004, 'TP_BUFFERSMALL', 'TP: Buffer is too small')#
- TP_CERT_ADDR_ERROR = (80023, 'TP_CERT_ADDR_ERROR', 'TP: Destination address of OEM certificate is invalid')#
- TP_CERT_ADDR_UNALIGNED = (80024, 'TP_CERT_ADDR_UNALIGNED', 'TP: Destination address of certificate is unaligned')#
- TP_CERT_OVERLAPPING = (80025, 'TP_CERT_OVERLAPPING', 'TP: OEM certificates are overlapping due to wrong destination addresses')#
- TP_CFPA_ERROR = (80016, 'TP_CFPA_ERROR', 'TP: CFPA page cannot be stored')#
- TP_CMPA_ERROR = (80017, 'TP_CMPA_ERROR', 'TP: CMPA page cannot be stored or ROTKH or SECU registers are invalid')#
- TP_COMMAND_ERROR = (80010, 'TP_COMMAND_ERROR', 'TP: ISP command arguments are invalid')#
- TP_CONTAINERENTRYINVALID = (80007, 'TP_CONTAINERENTRYINVALID', 'TP: Container entry invalid')#
- TP_CONTAINERENTRYNOTFOUND = (80008, 'TP_CONTAINERENTRYNOTFOUND', 'TP: Container entry not found in container')#
- TP_CONTAINERINVALID = (80006, 'TP_CONTAINERINVALID', 'TP: Container header or size is invalid')#
- TP_CONTAINER_ADDR_ERROR = (80019, 'TP_CONTAINER_ADDR_ERROR', 'TP: Container address in write context is invalid or there is no memory for entry storage')#
- TP_CONTAINER_ADDR_UNALIGNED = (80020, 'TP_CONTAINER_ADDR_UNALIGNED', 'TP: Container address in read context is unaligned')#
- TP_CONTAINER_BUFF_SMALL = (80021, 'TP_CONTAINER_BUFF_SMALL', 'TP: There is not enough memory to store the container')#
- TP_CONTAINER_NO_ENTRY = (80022, 'TP_CONTAINER_NO_ENTRY', 'TP: Attempt to sign an empty container')#
- TP_CRYPTO_CRITICAL_ERROR = (80102, 'TP_CRYPTO_CRITICAL_ERROR', 'TP: Error of crypto module which prevents proper functionality')#
- TP_CRYPTO_ERROR = (80001, 'TP_CRYPTO_ERROR', 'TP: Error during cryptographic operation')#
- TP_FLASH_ERROR = (80012, 'TP_FLASH_ERROR', 'TP: Flash erase/program/verify_erase failed')#
- TP_GENERAL_CRITICAL_ERROR = (80101, 'TP_GENERAL_CRITICAL_ERROR', 'TP: Critical error')#
- TP_GENERAL_ERROR = (80000, 'TP_GENERAL_ERROR', 'TP: General error')#
- TP_INVALIDSTATEOPERATION = (80009, 'TP_INVALIDSTATEOPERATION', 'TP: Attempt to process command in disallowed state')#
- TP_NULLPTR_ERROR = (80002, 'TP_NULLPTR_ERROR', 'TP: NULL pointer dereference or when buffer could not be allocated')#
- TP_PACKET_DATA_ERROR = (80027, 'TP_PACKET_DATA_ERROR', 'TP: Data in packet handle are invalid')#
- TP_PACKET_ERROR = (80026, 'TP_PACKET_ERROR', 'TP: Error during packet sending/receiving')#
- TP_PERIPHERAL_CRITICAL_ERROR = (80105, 'TP_PERIPHERAL_CRITICAL_ERROR', 'TP: Peripheral failure')#
- TP_PFR_CRITICAL_ERROR = (80104, 'TP_PFR_CRITICAL_ERROR', 'TP: Initialization of PFR or reading of activation code failed')#
- TP_PFR_ERROR = (80014, 'TP_PFR_ERROR', 'TP: Protected Flash Region operation failed')#
- TP_PRINCE_CRITICAL_ERROR = (80106, 'TP_PRINCE_CRITICAL_ERROR', 'TP: Error during PRINCE encryption/decryption')#
- TP_PUF_CRITICAL_ERROR = (80103, 'TP_PUF_CRITICAL_ERROR', 'TP: Initialization or start of the PUF periphery failed')#
- TP_PUF_ERROR = (80011, 'TP_PUF_ERROR', 'TP: PUF operation error')#
- TP_SB3_FILE_ERROR = (80029, 'TP_SB3_FILE_ERROR', 'TP: Error during processing SB3 file')#
- TP_SECRETBOX_ERROR = (80013, 'TP_SECRETBOX_ERROR', 'TP: SBKEK or USER KEK cannot be stored in secret box')#
- TP_SHA_CHECK_CRITICAL_ERROR = (80107, 'TP_SHA_CHECK_CRITICAL_ERROR', 'TP: SHA check verification failed')#
- TP_SUCCESS = (0, 'TP_SUCCESS', 'TP: SUCCESS')#
- TP_UNKNOWN_COMMAND = (80028, 'TP_UNKNOWN_COMMAND', 'TP: Unknown command was received')#
- TP_VERIFICATION_ERROR = (80015, 'TP_VERIFICATION_ERROR', 'TP: Container signature verification failed')#
- UNKNOWN_COMMAND = (10000, 'UnknownCommand', 'Unknown Command')#
- UNKNOWN_PROPERTY = (10300, 'UnknownProperty', 'Unknown Property')#
- UNSUPPORTED_COMMAND = (10006, 'UnsupportedCommand', 'Unsupported Command')#
- spsdk.mboot.error_codes.stringify_status_code(status_code)#
Stringifies the MBoot status code.
- Return type:
str
MBoot Exceptions#
Exceptions used in the MBoot module.
- exception spsdk.mboot.exceptions.McuBootCommandError(cmd, value)#
Bases:
McuBootError
MBoot Module: Command Exception.
Initialize the Command Error exception.
- Parameters:
cmd (
str
) – Name of the command causing the exceptionvalue (
int
) – Response value causing the exception
- fmt = 'MBoot: {cmd_name} interrupted -> {description}'#
- exception spsdk.mboot.exceptions.McuBootConnectionError(desc=None)#
Bases:
McuBootError
MBoot Module: Connection Exception.
Initialize the base SPSDK Exception.
- fmt = 'MBoot: Connection issue -> {description}'#
- exception spsdk.mboot.exceptions.McuBootDataAbortError(desc=None)#
Bases:
McuBootError
MBoot Module: Data phase aborted by sender.
Initialize the base SPSDK Exception.
- fmt = 'Mboot: Data aborted by sender'#
- exception spsdk.mboot.exceptions.McuBootError(desc=None)#
Bases:
SPSDKError
MBoot Module: Base Exception.
Initialize the base SPSDK Exception.
- fmt = 'MBoot: {description}'#
MBoot Scanner#
Helper module used for scanning the existing devices.
- spsdk.mboot.scanner.get_mboot_interface(port=None, usb=None, sdio=None, buspal=None, lpcusbsio=None, plugin=None, timeout=5000)#
Get appropriate interface.
‘port’, ‘usb’, ‘sdio’, ‘lpcusbsio’ parameters are mutually exclusive; one of them is required.
- Parameters:
port (
Optional
[str
]) – name and speed of the serial port (format: name[,speed]), defaults to Noneusb (
Optional
[str
]) – PID,VID of the USB interface, defaults to Nonesdio (
Optional
[str
]) – SDIO path of the SDIO interface, defaults to Nonebuspal (
Optional
[str
]) – buspal interface settings, defaults to Nonetimeout (
int
) – timeout in millisecondslpcusbsio (
Optional
[str
]) – LPCUSBSIO spi or i2c config stringplugin (
Optional
[str
]) – Additional plugin to be used
- Return type:
- Returns:
Selected interface instance
- Raises:
SPSDKError – Only one of the appropriate interfaces must be specified
SPSDKError – When SPSDK-specific error occurs
MBoot Protocol#
MBoot protocol base.
MBoot Bulk#
Mboot bulk implementation.
- class spsdk.mboot.protocol.bulk_protocol.MbootBulkProtocol(device)#
Bases:
MbootProtocolBase
Mboot Bulk protocol.
Initialize the MbootSerialProtocol object.
- Parameters:
device (
DeviceBase
) – The device instance
- close()#
Close the interface.
- Return type:
None
- property is_opened: bool#
Indicates whether interface is open.
- open()#
Open the interface.
- Return type:
None
- read(length=None)#
Read data from device.
- Return type:
Union
[CmdResponse
,bytes
]- Returns:
read data
- Raises:
SPSDKTimeoutError – Timeout occurred
- write_command(packet)#
Encapsulate command into frames and send them to device.
- Parameters:
packet (
CmdPacketBase
) – Command packet object to be sent- Raises:
SPSDKAttributeError – Command packed contains no data to be sent
- Return type:
None
- write_data(data)#
Encapsulate data into frames and send them to device.
- Parameters:
data (
bytes
) – Data to be sent- Return type:
None
MBoot Serial#
Mboot serial implementation.
- class spsdk.mboot.protocol.serial_protocol.FPType(tag, label, description=None)#
Bases:
SpsdkEnum
Type of frames used in serial communication.
- ABORT = (163, 'ABORT')#
- ACK = (161, 'ACK')#
- CMD = (164, 'CMD')#
- DATA = (165, 'DATA')#
- NACK = (162, 'NACK')#
- PING = (166, 'PING')#
- PINGR = (167, 'PINGR')#
- class spsdk.mboot.protocol.serial_protocol.MbootSerialProtocol(device)#
Bases:
MbootProtocolBase
Mboot Serial protocol.
Initialize the MbootSerialProtocol object.
- Parameters:
device (
DeviceBase
) – The device instance
- FRAME_START_BYTE = 90#
- FRAME_START_NOT_READY_LIST = [0]#
- MAX_PING_RESPONSE_DUMMY_BYTES = 50#
- MAX_UART_OPEN_ATTEMPTS = 3#
- PING_TIMEOUT_MS = 500#
- close()#
Close the interface.
- Return type:
None
- property is_opened: bool#
Indicates whether interface is open.
- open()#
Open the interface.
- Raises:
McuBootConnectionError – In any case of fail of UART open operation.
- Return type:
None
-
options:
int
= 0#
- ping_timeout(timeout=500)#
Context manager for changing UART’s timeout.
- Parameters:
timeout (
int
) – New temporary timeout in milliseconds, defaults to PING_TIMEOUT_MS (500ms)- Return type:
Generator
[None
,None
,None
]- Returns:
Generator[None, None, None]
-
protocol_version:
int
= 0#
- read(length=None)#
Read data from device.
- Return type:
Union
[CmdResponse
,bytes
]- Returns:
read data
- Raises:
McuBootDataAbortError – Indicates data transmission abort
McuBootConnectionError – When received invalid CRC
- write_command(packet)#
Encapsulate command into frames and send them to device.
- Parameters:
packet (
CmdPacketBase
) – Command packet object to be sent- Raises:
SPSDKAttributeError – Command packed contains no data to be sent
- Return type:
None
- write_data(data)#
Encapsulate data into frames and send them to device.
- Parameters:
data (
bytes
) – Data to be sent- Return type:
None
- class spsdk.mboot.protocol.serial_protocol.PingResponse(version: int, options: int, crc: int)#
Bases:
NamedTuple
Special type of response for Ping Command.
Create new instance of PingResponse(version, options, crc)
-
crc:
int
# Alias for field number 2
-
options:
int
# Alias for field number 1
- classmethod parse(data)#
Parse raw data into PingResponse object.
- Parameters:
data (
bytes
) – bytes to be unpacked to PingResponse object 4B version, 2B data, 2B CRC16- Raises:
McuBootConnectionError – Received invalid ping response
- Return type:
Self
- Returns:
PingResponse
-
version:
int
# Alias for field number 0
-
crc:
- spsdk.mboot.protocol.serial_protocol.to_int(data, little_endian=True)#
Convert bytes into single integer.
- Parameters:
data (
bytes
) – bytes to convertlittle_endian (
bool
) – indicate byte ordering in data, defaults to True
- Return type:
int
- Returns:
integer