Memory Configuration API#
Module implementing managing the configuration option words for various memories used by BLHOST configure-memory command.
Memory Config API#
Module provides support for Memory configuration (known as a flash configuration option words).
- class spsdk.memcfg.memcfg.MemoryConfig(family, peripheral, revision='latest', interface=None)#
Bases:
BaseClass
General memory configuration class.
Initialize memory configuration class.
- Parameters:
family (
str
) – Chip familyperipheral (
str
) – Peripheral namerevision (
str
) – Chip revisioninterface (
Optional
[str
]) – Memory interface
-
PERIPHERALS:
List
[str
] = ['flexspi_nor', 'flexspi_nand', 'semc_nor', 'semc_nand', 'spi_nor', 'mmc', 'sd']#
- SUPPORTS_FCB_CREATION = [9]#
- create_blhost_batch_config(instance=None, fcb_output_name=None)#
Create BLHOST script that configure memory.
Optionally the script can force create of FCB on chip and read back it
- Parameters:
instance (
Optional
[int
]) – Optional peripheral instancefcb_output_name (
Optional
[str
]) – _description_, defaults to False
- Return type:
str
- Returns:
BLHOST batch file that configure the external memory
- export()#
Export option words to bytes.
- Return type:
bytes
- static get_all_known_option_words(peripheral=None)#
Get dictionary with all known supported memory configuration.
The organization is following:
{peripheral}:{manufacturer}:{chip_name}:{interface}: List of option words (ordered)- Parameters:
peripheral (
Optional
[str
]) – Restrict results just for this one peripheral if defined- Return type:
Dict
[str
,Dict
[str
,Dict
[str
,Dict
[str
,List
[int
]]]]]- Returns:
The mentioned dictionary.
- get_config()#
Get class configuration.
- Return type:
Dict
[str
,Any
]- Returns:
Dictionary with configuration of the class.
- static get_known_chip_option_words(peripheral, chip_name, interface)#
Get option words for one chip from database.
- Parameters:
peripheral (
str
) – Peripheral used to communicate with chipchip_name (
str
) – Chip name to look forinterface (
str
) – Chip communication interface
- Return type:
List
[int
]- Returns:
The List of option words.
- static get_known_chip_peripheral(chip_name)#
Get peripheral for one chip from database.
- Parameters:
chip_name (
str
) – Chip name to look for- Return type:
str
- Returns:
The peripheral name.
- static get_known_option_words(family, peripheral=None)#
Get dictionary with all known supported memory configuration.
The organization is following:
{peripheral}:{manufacturer}:{chip_name}:{interface}: List of option words (ordered)- Parameters:
family (
str
) – The chip familyperipheral (
Optional
[str
]) – Restrict results just for this one peripheral if defined
- Return type:
Dict
[str
,Dict
[str
,Dict
[str
,Dict
[str
,List
[int
]]]]]- Returns:
The mentioned dictionary.
- static get_option_words_string(option_words)#
Get option words in string format.
- Parameters:
option_words (
List
[int
]) – List of option words.- Return type:
str
- Returns:
Option words in string
- get_peripheral(peripheral)#
Get peripheral name, priority has from parameter as a backup is class member.
- Parameters:
peripheral (
Optional
[str
]) – Memory peripheral;- Raises:
SPSDKValueError – Peripheral is not defined
- Return type:
str
- Returns:
Peripheral name
- static get_peripheral_cnt(family, peripheral)#
Get count of peripheral instances.
- Return type:
int
- static get_peripheral_instances(family, peripheral)#
Get peripheral instances.
- Return type:
List
[int
]
- static get_supported_families()#
Get the list of supported families.
- Return type:
List
[str
]- Returns:
List of family names that support memory configuration.
- static get_supported_peripherals(family)#
Get list of supported peripherals by the family.
- Return type:
List
[str
]
- get_validation_schemas(peripheral=None)#
Create the validation schema for one peripheral.
- Parameters:
peripheral (
Optional
[str
]) – External memory peripheral.- Return type:
List
[Dict
[str
,Any
]]- Returns:
List of validation schemas.
- static get_validation_schemas_base()#
Create the validation schema for MemCfg class bases.
- Return type:
List
[Dict
[str
,Any
]]- Returns:
List of validation schemas.
- get_yaml()#
Parse the option words to YAML config file.
- Return type:
str
- Returns:
YAML file content with configuration.
- classmethod load_config(config)#
Load Yaml configuration and decode.
- Parameters:
config (
Dict
[str
,Any
]) – Memory configuration dictionary.- Return type:
Self
- property option_words: List[int]#
Get option words.
- property option_words_count: int#
Get current count of option words.
- static option_words_to_bytes(option_words)#
Convert option words to bytes.
- Parameters:
option_words (
List
[int
]) – Option words list- Return type:
bytes
- Returns:
Bytes with option words
- classmethod parse(data, family, peripheral, revision='latest', interface=None)#
Parse the option words to configuration.
- Parameters:
data (
bytes
) – Option words in bytesfamily (
str
) – Chip familyperipheral (
str
) – Peripheral namerevision (
str
) – Chip revisioninterface (
Optional
[str
]) – Memory interface
- Return type:
Self
- Returns:
Dictionary with parsed configuration.
- property peripheral: str#
Get used peripheral.
- peripheral_cnt(peripheral=None)#
Get count of peripheral instances.
- Return type:
int
- peripheral_instances(peripheral=None)#
Get peripheral instances.
- Return type:
List
[int
]