MCUXpresso Community Articles

cancel
Showing results for 
Search instead for 
Did you mean: 

MCUXpresso Community Articles

NXP Employee
NXP Employee

New features update:

  •  SDKGEN-1390The SDK yml data schema and validation task[In Progress]

The aim of this task is to provide a solution(schema + validation) for SDK data annotation and validation. It is an integral part of SDK generator solution.

We expect that with this all developers should be able to

  • Figure out how to config yml data by referring schemas with some typical examples
  • Read out the error log for wrong data record and fix them accordingly(Easily check and find out typos in data record).
  • With correct data, there won’t be any “no xxx for nil class” related run abort.

After some research and experiment, we will use json schema. Here is https://json-schema.org/.

The json schema draft 07 version is used to do the work.

The SDK yml data schemas(70% completed) are here.

  • component_schema.yml                the component section schemas
  • component_support_schema.yml        the component support section schemas
  • configuration_schema.yml              the configuration section schemas
  • project_schema.yml                   the application section schemas
  • definitions_schema.yml                the definitions of sub properties(attributes) 

The validation codes are enabled in feature/SDKGEN-1390-sdk-yml-data-schema-and-validation-implementation-integratoin

Now the data validation will be the first and mandatory steps for any generator cmds run. Data record which violates the schemas will be reported as “errors”.

Generator also supports direct “data_validate” cmd that just validating the data.

For example, if you run ruby sdk_frdmk64.rb -c data_validation(Please comment the -c project in that rb), you will get error logs like

component.rtc:

               ERROR:

               - The property '#/component_info/common' did not contain a required property of 'full_name' in schema     D:/git_sdk2.x_featuretry/mcu-sdk-2.0/bin/generator/sdk_generator/data/sdk_data_schema/definitions_schema.yml#

               - The property '#/component_info/common' did not contain a required property of 'description' in schema D:/git_sdk2.x_featuretry/mcu-sdk-2.0/bin/generator/sdk_generator/data/sdk_data_schema/definitions_schema.yml#

 

The left work about the schemas:

  • Need “example” and “description” for all properties in the schemas to illustrate how to write ymls
  • Missing some properties
  • Update current SDK data to fix all the errors. 

When the schemas are 100 percent,detailed training and introduction to all SDK developers.

Some preconditions

  • About json schema, you can quickly learn from Getting started step by step, won’t consume you too much time. It is a mainstream and popular solution for json/yml data annotation and validation.
  • Please run “gem install json-schema” before you run. You can try “ruby sdk_frdmk64.rb -p hello_world” in the 1390 integration branch.

Generator has supported project generation for CodeWarrior Development Studio. This feature is mainly for Nevis3 SDK development and integration.
The yml prototype has been prepared in release/2.7.0_nevis3_ear branch, the generator branch is develop/mcu_sdk_generator.
Here is an validation demo hello_world. You can run batch command after putting source code into repo.
Here is an example:1.png

After project generated, you can import the project into your workspace, just a kinder reminder, do not select "Copy projects into workspace" option.

1.png

After building successfully please select correct debug configuration to debug your project.

1.png

  •  SDKGEN-1465 Support preinclude header file for mucx linked and project

When import a project into mcux, there are two kinds of preojects depends on whether "Copy Sources"  checkbox being cheked:

  • Linked project(no check)
  • Copied project(checked)

Preinclude files worked only with copied project in the past. Now both types can be supported at the same time.

The default setting is copy sources type. You can add an additional attribute "linked_support: true" for the file to enable the feature.

For example:

1.png

  •  SDKGEN-1485 FAQ about how to remove/replace single flag.

Sometimes you just want to remove single flag, "__remove__" tag can be used.
For example:

1.png

Further more, if single flag needs to be replaced, you can firstly use "__remove__" to remove them and then add a new one. Thus other flags will not be affected comparing with "__replace__".
For example:

1.png

Note: You must add flag node as "__remove__" 's sub-node first, then add the flag to be removed under the flag node. Don't try to remove an item as this way:

1.png

More
1 0 46
Labels