SDK Upgrade Manifest (.slcu)¶
The SDK upgrade manifest file has the .slcu extension. It describes transformations to be performed on projects to make them compatible with a later version of the SDK.
An upgrade manifest consists of an object with a single top-level property upgrade
. This property contains an array, where each item corresponds to a single upgrade transformation from one SDK version to another. The target SDK version is given by the sdk
property, while the source SDK version is implicit, and will vary depending on whether the previous SDK or any intermediate SDK required any upgrade rules to be defined.
Component upgrade¶
The "component" property contains a list of component upgrades. A declarative upgrade has the format
Property | Required | Type | Description |
---|---|---|---|
trigger | Yes | string | Rule is triggered if component with this ID is present in the project |
description | Yes | string | Description of the upgrade rule, to be shown to the user |
remove | No | list[string] | List of components to remove if rule is triggered. Typically includes the trigger component. |
add | No | list[string] | List of components to add if rule is triggered. |
A scripted upgrade has the format
Property | Required | Type | Description |
---|---|---|---|
script | Yes | string | Path to the upgrade script relative to the upgrade manifest file |
description | Yes | string | Description of the upgrade rule, to be shown to the user |
Configuration upgrade¶
The "configuration" property contains a list of configuration upgrades. A declarative upgrade has the format
Property | Required | Type | Description |
---|---|---|---|
name | Yes | string | Configuration option to replace |
replacement | Yes | string | New configuration option name |
value | No | map[string,string] | Map of replacement options where the key is the old configuration value and the value is the new configuration value |
A scripted upgrade has the format
Property | Required | Type | Description |
---|---|---|---|
script | Yes | string | Path to the upgrade script relative to the upgraded manifest file |
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
Upgrade Scripts¶
Scripted upgrades are performed by calling Lua scripts implementing component upgrades, configuration upgrades, or both. A Python binding is also supported for backwards compatibility for SDKs only, SDK Extensions must use Lua.
Namespaces¶
Global (SLC)¶
The SLC namespace provides functions to work on the project that is being upgraded. It has the following interface:
Method | Arguments | Return Type | Description |
---|---|---|---|
component |
id (string) ID of component |
Component | Returns a component object representing the component. |
config |
id (string) - ID of configuration option |
Configurable | Returns a Configurable object representing the configuration, or nil if not defined. |
component_selected |
id (string) ID of component |
bool | Returns true if the given component is selected in the project. Implementations should also allow is_selected as an alias for consistency with the Validation API. |
is_provided |
id (string) Name of provide |
bool | Returns true if the given feature is provided in the project. |
Component¶
The component object represents a component from the SDK. It has the following interface:
Member | Type | Description |
---|---|---|
id |
string | The ID of the component |
label |
string | The display name of the component |
instances |
list[string] | List of selected instances in the active project if the component is instantiable. |
is_instantiable |
bool | True if the given component is instantiable. |
Configurable¶
Member | Type | Description |
---|---|---|
id |
string | Returns the name of the configuration option, i.e. <id> from #define <id> if the option is a CMSIS annotated configuration macro |
value |
String | Returns the current value of the configuration option |
Component Upgrade Script¶
The component upgrade script is a Lua script. It returns a table of change actions to perform on the project.
A project change action is a table with the following data:
Key | Type | Mandatory | Description |
---|---|---|---|
component | string | Yes | ID of the component whose state should be modified in the project. |
action | string | Yes | One of "add" or "remove", to add or remove the component from the project. |
instance | list[string] | No | List of instance names to modify. If component is instantiable and this is not given for a "remove" action, all instances will be removed. |
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
Configuration Upgrade Script¶
The configuration upgrade script implements a function def configuration_upgrade(project)
, where project
is an instance of Project
representing the project being upgraded. The function returns a list of change actions to perform on the project.
A configuration change action is a map with the following data, containing keys from either A or B:
Key | Type | Mandatory | Description |
---|---|---|---|
option | string | Always | Configuration option to modify |
action | string | A | Value of "remove" to remove the configuration option from the project |
value | string | B | Set the value of the configuration option to this. |
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|