takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Config Class Reference

Config Class Reference

Public Member Functions

def __init__
def add_config_files
def has_regions
def has_ram_regions
def sectors
def rom
def ram_regions
def regions
def get_target_config_data
def get_lib_config_data
def get_app_config_data
def get_config_data
def parameters_to_macros
def config_macros_to_macros
def config_to_macros
def get_config_data_macros
def get_features
def validate_config
def load_resources
def config_to_header
def get_config_data_header

Detailed Description

'Config' implements the mbed configuration mechanism

Definition at line 397 of file tools/config/__init__.py.


Constructor & Destructor Documentation

def __init__ (   self,
  tgt,
  top_level_dirs = None,
  app_config = None 
)
Construct a mbed configuration

Positional arguments:
target - the name of the mbed target used for this configuration
 instance

Keyword argumets:
top_level_dirs - a list of top level source directories (where
         mbed_app_config.json could be found)
app_config - location of a chosen mbed_app.json file

NOTE: Construction of a Config object will look for the application
configuration file in top_level_dirs. If found once, it'll parse it.
top_level_dirs may be None (in this case, the constructor will not
search for a configuration file).

Definition at line 430 of file tools/config/__init__.py.


Member Function Documentation

def add_config_files (   self,
  flist 
)
Add configuration files

Positional arguments:
flist - a list of files to add to this configuration

Definition at line 508 of file tools/config/__init__.py.

def config_macros_to_macros (   macros )
Return the macro definitions generated for a dictionary of
ConfigMacros (as returned by get_config_data).

Positional arguments:
params - a dictionary mapping a name to a ConfigMacro instance

Return: a list of strings that are the C pre-processor macros

Definition at line 1007 of file tools/config/__init__.py.

def config_to_header (   config,
  fname = None 
)
Convert the configuration data to the content of a C header file,
meant to be included to a C/C++ file. The content is returned as a
string.

Positional arguments:
config - configuration data as (ConfigParam instances, ConfigMacro
 instances) tuple (as returned by get_config_data())

Keyword arguments:
fname -  also write the content is to the file called "fname".
 WARNING: if 'fname' names an existing file, it will be
 overwritten!

Definition at line 1110 of file tools/config/__init__.py.

def config_to_macros (   config )
Convert the configuration data to a list of C macros

Positional arguments:
config - configuration data as (ConfigParam instances, ConfigMacro
 instances) tuple (as returned by get_config_data())

Definition at line 1019 of file tools/config/__init__.py.

def get_app_config_data (   self,
  params,
  macros 
)
Read and interpret the configuration data defined by the target. The
target can override any configuration parameter, as well as define its
own configuration data.

Positional arguments.
params - the dictionary with configuration parameters found so far (in
 the target and in libraries)
macros - the list of macros defined in the configuration

Definition at line 945 of file tools/config/__init__.py.

def get_config_data (   self )
Return the configuration data in two parts: (params, macros)
params - a dictionary with mapping a name to a ConfigParam
macros - the list of macros defined with "macros" in libraries and in
 the application (as ConfigMacro instances)

Arguments: None

Definition at line 964 of file tools/config/__init__.py.

def get_config_data_header (   self,
  fname = None 
)
Convert a Config instance to the content of a C header file, meant
to be included to a C/C++ file. The content is returned as a string.

Keyword arguments:
fname - also write the content to the file called "fname".
WARNING: if 'fname' names an existing file, it will be
overwritten!

Definition at line 1153 of file tools/config/__init__.py.

def get_config_data_macros (   self )
Convert a Config object to a list of C macros

Arguments: None

Definition at line 1031 of file tools/config/__init__.py.

def get_features (   self )
Extract any features from the configuration data

Arguments: None

Definition at line 1038 of file tools/config/__init__.py.

def get_lib_config_data (   self,
  target_data 
)
Read and interpret configuration data defined by libraries. It is
assumed that "add_config_files" above was already called and the library
configuration data exists in self.lib_config_data

Arguments: None

Definition at line 930 of file tools/config/__init__.py.

def get_target_config_data (   self )
Read and interpret configuration data defined by targets.

We consider the resolution order for our target and sort it by level
reversed, so that we first look at the top level target (the parent),
then its direct children, then the children of those children and so on,
until we reach self.target
TODO: this might not work so well in some multiple inheritance scenarios
At each step, look at two keys of the target data:
  - config_parameters: used to define new configuration parameters
  - config_overrides: used to override already defined configuration
              parameters

Arguments: None

Definition at line 884 of file tools/config/__init__.py.

def has_ram_regions (   self )
Does this config have regions defined?

Definition at line 568 of file tools/config/__init__.py.

def has_regions (   self )
Does this config have regions defined?

Definition at line 559 of file tools/config/__init__.py.

def load_resources (   self,
  resources 
)
Load configuration data from a Resources instance and expand it
based on defined features.

Positional arguments:
resources - the resources object to load from and expand

Definition at line 1078 of file tools/config/__init__.py.

def parameters_to_macros (   params )
Encode the configuration parameters as C macro definitions.

Positional arguments:
params - a dictionary mapping a name to a ConfigParameter

Return: a list of strings that encode the configuration parameters as
C pre-processor macros

Definition at line 994 of file tools/config/__init__.py.

def ram_regions (   self )
Generate a list of ram regions from the config

Definition at line 633 of file tools/config/__init__.py.

def regions (   self )
Generate a list of regions from the config

Definition at line 651 of file tools/config/__init__.py.

def rom (   self )
Get rom information as a pair of start_addr, size

Definition at line 614 of file tools/config/__init__.py.

def sectors (   self )
Return a list of tuples of sector start,size

Definition at line 577 of file tools/config/__init__.py.

def validate_config (   self )
Validate configuration settings. This either returns True or
raises an exception

Arguments: None

Definition at line 1055 of file tools/config/__init__.py.