Automatically create A2L files from C/C++ source code and ELF

A typical flowchart for UeA2lCreator is shown below.

UeA2lCreator is integrated in the build just like a compiler. This approach makes for completely automated creation of A2L files.

Highlights

  • A unique algorithm analyses the build products. The A2L information is derived from this analysis hence minimizing the information which the developer needs to provide. 
  • Handles structs, arrays, enums and and combination thereof.
  • Full support for C++ including inheritance and templates.
  • Which variables shall be made available in the A2L file is written as comments in the code by the developer.  A2L information and source code is kept tightly together which makes for high quality and fast development.
  • Required information which cannot be derived from build products is written as tagged information in source code comments.
  • Can co-exist seamless with other documentation tools such as doxygen.

Example

Consider the following code:

typedef enum {State_1, State_2} StateType;

typedef struct
{
   StateType enumArray[3];
   uint8 scalarArray[4];
   uint32 plainScalar;
} StructType;

StructType aStruct;

And the corresponding A2L:

      /begin CHARACTERISTIC aStruct.enumArray "Test aStructArray"
         VAL_BLK 0x0 UEA2LCREATOR_SLONG 0 COMPUMETHOD_StateType -2147483648 2147483647
         MATRIX_DIM 3 1 1
      /end CHARACTERISTIC

      /begin CHARACTERISTIC aStruct.scalarArray "Test aStructArray"
         VAL_BLK 0x0 UEA2LCREATOR_UBYTE 0 NO_COMPU_METHOD 0 255
         MATRIX_DIM 4 1 1
      /end CHARACTERISTIC

      /begin CHARACTERISTIC aStruct.plainScalar "Test aStructArray"
         VALUE 0x0 UEA2LCREATOR_ULONG 0 NO_COMPU_METHOD 0 4294967295
      /end CHARACTERISTIC

      /begin COMPU_METHOD COMPUMETHOD_StateType "StateType"
         TAB_VERB
         "%.0"
         ""
         COMPU_TAB_REF COMPU_VTAB_StateType
      /end COMPU_METHOD

      /begin COMPU_VTAB COMPU_VTAB_StateType "StateType"
         2
         0 "State_1"
         1 "State_2"
      /end COMPU_VTAB

      /begin RECORD_LAYOUT UEA2LCREATOR_ULONG
         FNC_VALUES 1 ULONG COLUMN_DIR DIRECT
      /end RECORD_LAYOUT

As we see the A2L contains just as much information as the C-code. It means that whenever the C-code is updated the A2L needs to be updated as well.  This is a slow and error-prone process which is easily automated with UeA2lCreator.

Imagine the entire code and A2L replaced by

typedef enum {State_1, State_2} StateType;

typedef struct
{
   StateType enumArray[3];
   uint8 scalarArray[4];
   uint32 plainScalar;
} StructType;

/**
 * @a2l on
 */
StructType aStructArray[2];

Note the @a2l on tag in the comment. That lets UeA2lCreator know that A2L shall be generated for the variable.

UeA2lCreator eliminates all issues which might arise from A2L file mistakes by automate the creation of A2L files. The core is a unique algorithm which analyzes the build products and derives the A2L information from this analysis. This approach, to automate the A2L creation to as far as possible, eliminates human mistakes and lets developers focus on developing their applications instead of writing, maintaining and securing A2L information. The result is fast development and an A2L file without bugs.

Calibration mistakes might cause all kinds of ECU performance issues. In many applications it might even cause hazards and hence compromise safety. A common source of error is the calibration label value itself but the A2L file is just as important. A simple datatype error might result in serious malfunction. Consider for example if the software uses float for a PID gain and the A2L file specifies an integer type. The gain will not be rounded to the nearest integer, it will be interpreted as a floating point number which might cause almost any value to be used by the microcontroller. Using UeA2lCreator eliminates this risk.

Additional information can be added as tags in source code comments

Not all A2L information can be derived from the build products simply because the build products doesn’t contain this information, for example the limits for number of cylinders in an engine. Such information is entered by the developer as tags in source code comments.

Some examples of tagged A2L information in comment blocks follows below. Complete documentation of UeA2lCreator comment tags is found in the UeA2lTools user guideline.

  
/** 
 * This first line will be the description in the A2L file. 
 *
 * @a2l on 
 * @a2l-min 0 
 * @a2l-max 20 
 */ 
 float32 vehicle_length; 
 
// A description of bar. 
// @a2l on uint8 bar; 

///////////////////////////////////////////////////////////// 
// A description of foobar
//
// Only the first line of the comment becomes the A2L
// one-line description so additional comments documenting
// the variable can be written here.
//
// Note that this is an example of putting the documentation
// of the variable at the exern declaration in a header file. 
// 
// @a2l on
// ///////////////////////////////////////////////////////////// 
extern float32 foobar;

Need more information? contact us, read the user guideline or download UeA2lTools and request evaluation license.