A2L头文件解析(基于CCP协议)

tech2022-07-05  186

1.标定量如何分区(注意:标定量的地址在flash上,所以在初始化阶段应该讲flash搬到ram中去)

/begin MEMORY_SEGMENT _RAM "calibration_ram" DATA RAM INTERN 0x40004C00 // 标定量对应在RAM的区域(需将FLASH的标定量复制到这个区) 0x00002000 // 标定量的大小 -1 -1 -1 -1 -1 /end MEMORY_SEGMENT /begin MEMORY_SEGMENT _ROM "calibration_rom" DATA FLASH INTERN 0x00008000 // 标定量对应在RAM的区域(需将FLASH的标定量复制到这个区) 0x00002000 // 标定量的大小 -1 -1 -1 -1 -1

2.将标定数据对应的FLASH和RAM项链接

/begin IF_DATA ASAP1B_CCP ADDRESS_MAPPING /*orig_adr:*/ 0x00008000 /*mapping_adr:*/ 0x40004C00 /*length:*/ 0x2000 // 标 定量空间的映射(flash--> ram) /end IF_DATA

3.定义好参考页和工作页

2 "calibration_ram" 0 0x40004C00 // 标定量在RAM ---> 参考区 0x00002000 RAM RAM_INIT_BY_TOOL /end DEFINED_PAGES /begin DEFINED_PAGES 1 "calibration_rom" // 标定量在FLASH ---> 参考区 0 0x00008000 0x00002000 FLASH /end DEFINED_PAGES

下面是某个A2L的头部分,观测量和标定量的信息可通过MATLAB生成。

ASAP2_VERSION 1 31 /* Version 1.31 */ /begin PROJECT ProjectName "Project Comment Goes Here" /begin HEADER "Header Comments go here" /end HEADER /begin MODULE ModuleName "Module Comment Goes Here" /begin A2ML /****************************************************************************/ /* */ /* ASAP2 Meta Language for CCP CAN Calibration Protocol V2.1 */ /* Assumes ASAP2 V1.3 or later */ /* */ /* AML Version V2.4, 27.04.1999 */ /* */ /* 仅供参考 */ /* */ /* */ /* */ /* */ /* Datatypes: */ /* */ /* A2ML ASAP2 Windows Erlaeuuterung */ /* ---------------------------------------------------------------- */ /* uchar UBYTE BYTE unsigned 8 Bit */ /* char SBYTE char signed 8 Bit */ /* uint UWORD WORD unsigned integer 16 Bit */ /* int SWORD int signed integer 16 Bit */ /* ulong ULONG DWORD unsigned integer 32 Bit */ /* long SLONG LONG signed integer 32 Bit */ /* float FLOAT32_IEEE float 32 Bit */ /* */ /****************************************************************************/ /*2012.9.12*/ block "IF_DATA" taggedunion if_data { /*lzf 2012.10.30*/ "ASAP1B_CCP" taggedstruct { /* Beschreibung der DAQ-Listen */ (block "SOURCE" struct { struct { char[101]; /* Name of the DAQ-List (data acquisition list), measurement source . */ /* If the DAQ-Liste only supports one fixed ECU sampling rate, it can be declared below to achieve compatibility with the ASAP2 standard. Otherwise description of the possible ECU sampling rates in QP_BLOB */ int; /* Period definition : Basic scaling unit in CSE defined in ASAP1b (CSE=Code for Scaling Unit) */ long; /* Period definition : Rate in Scaling Units */ }; taggedstruct { "DISPLAY_IDENTIFIER" char[32]; block "QP_BLOB" struct { uint; /* Number of the DAQ-List 0..n */ taggedstruct { "LENGTH" uint; /* Length of the DAQ-Liste, maximum number of the useable ODTs */ "CAN_ID_VARIABLE"; /* CAN-Message-ID is variable */ "CAN_ID_FIXED" ulong; /* CAN-Message-ID of the DTOs is fixed, Default DTO Bit31 = 1: extended Identifier Bit31 = 0: standard Identifier */ /* Not applied if the ECU uses the DTM-Id */ ("RASTER" uchar)*; /* Supported CCP Event Channel Names of this DAQ List */ ("EXCLUSIVE" int)*; /* Exclusion of other DAQ-Lists */ "REDUCTION_ALLOWED"; /* Data reduction possible */ "FIRST_PID" uchar; /* First Packet ID (PID) of the DAQ List */ }; }; }; })*; /* Description of the available ECU Sampling Rates (Event Channels) */ (block "RASTER" struct { char[101]; /* CCP Event Channel Name */ char[9]; /* Short Display Name of the Event Channel Name */ uchar; /* Event Channel No., used for CCP START_STOP) */ int; /* Period definition : basic scaling unit in CSE as defined in ASAP1b */ long; /* ECU sample rate of the event channel, period definition based on the basic scaling unit */ taggedstruct { ("EXCLUSIVE" uchar)*; /* Exclusion of other CCP Event Channels */ }; })*; /* Group several event channels to form one combined event */ /* e.g. group all cylinder synchronous events to one combined element */ (block "EVENT_GROUP" struct { char[101]; /* Event group name */ char[9]; /* Short name for the event group */ taggedstruct { ("RASTER" uchar)*; }; /* all event channels beloging to group (CCP Event Channel Numbers for START_STOP) */ })*; /* Description of the authentification process */ block "SEED_KEY" struct { char[256]; /* Name of the Seed&Key DLL for CAL Priviledge, including file-Extension without path */ char[256]; /* Name of the Seed&Key DLL for DAQ Priviledge, including file-Extension without path */ char[256]; /* Name of the Seed&Key DLL for PGM Priviledge, including file-Extension without path */ }; /* Description of the checksum calculation process */ block "CHECKSUM" struct { char[256]; /* Name of the Checksum DLL representing the ECU Algorithm, including file-Extension without path */ }; block "TP_BLOB" struct { uint; /* CCP Version, High Byte: Version Low Byte : subversion (dec.) */ uint; /* Blob-Version, High Byte: Version Low Byte : subversion (dec.) */ ulong; /* CAN-Message ID for 'Transmitting to ECU (CRM)' Bit31 = 1: extended Identifier Bit31 = 0: standard Identifier */ ulong; /* CAN-Message ID for 'Receiving from ECU (DTM)' Bit31 = 1: extended Identifier Bit31 = 0: standard Identifier */ uint; /* Logical CCP-Address of the (station address) */ uint; /* Byte order of Multiple-byte-items 1 = high Byte first, 2 = low byte first */ taggedstruct { block "CAN_PARAM" struct { uint; /* Quartz freq. of the elec. control unit */ uchar; /* BTR0 */ uchar; /* BTR1 */ }; "BAUDRATE" ulong; /* Baud rate in Hz. */ "SAMPLE_POINT" uchar; /* sampling point of time in percent */ "SAMPLE_RATE" uchar; /* number of samples per Bit (1 oder 3) */ "BTL_CYCLES" uchar; /* number of BTL-cycles */ "SJW" uchar; /* SJW-parameter in BTL-cycles */ "SYNC_EDGE" enum { "SINGLE" = 0, /* Synchronisation only on fallende edge */ "DUAL" = 1 /* Synchr. on falling and rising edge */ }; "DAQ_MODE" enum { /* mode of cylcic data acquisition */ "ALTERNATING" = 0, /* ECU is sending one ODT per cycle */ "BURST" = 1 /* ECU is sending a complete DAQ */ }; "BYTES_ONLY"; /* ECU supports max. elements of one Byte size */ /* otherwise ECU supports different dataTypes */ "RESUME_SUPPORTED"; /* ECU supports the Resume function */ "STORE_SUPPORTED"; /* ECU supports the Store function */ "CONSISTENCY" enum { "DAQ" = 0, /* consistency of a complete DAQ ist guaranteed */ "ODT" = 1 /* consistency of a complete ODT ist guaranteed */ }; "ADDRESS_EXTENSION" enum { /* address extension */ "DAQ" = 0, /* ECU supports only one Address extension within an DAQ */ "ODT" = 1 /* ECU supports only one Address extension within an ODT */ }; block "CHECKSUM_PARAM" struct { uint; /* checksum calculation procedure standard types not yet defined, if greater of equal 1000 : manufacturer specific */ ulong; /* Maximum block length used by an ASAP1a-CCP command, for checksum calculation procedure */ taggedstruct { "CHECKSUM_CALCULATION" enum { "ACTIVE_PAGE" = 0, "BIT_OR_WITH_OPT_PAGE" = 1 }; }; }; (block "DEFINED_PAGES" struct { struct { uint; /* Logical No. of the memory page (1,2,..) */ char[101]; /* Name of the memory page */ uint; /* Adress-Extension of the memory page (only Low Byte significant) */ ulong; /* Base address of the memory page */ ulong; /* Length of the memory page in Bytes */ }; taggedstruct { "RAM"; /* memory page in RAM */ "ROM"; /* memory page in ROM */ "FLASH"; /* memory page in FLASH */ "EEPROM"; /* memory page in EEPROM */ "RAM_INIT_BY_ECU"; /* memory page is initialised by ECU start-up */ "RAM_INIT_BY_TOOL"; /* RAM- memory page is initialised by the MCS */ "AUTO_FLASH_BACK"; /* RAM memory page is automatically flashed back */ "FLASH_BACK"; /* feature available to flash back the RAM memory page */ "DEFAULT"; /* memory page is standard (fallback mode) */ }; })*; ("OPTIONAL_CMD" uint)*; /* CCP-Code of the optional command available in the ECU. It is recommended to declare all non-standard ECU commands here */ }; }; /* for CHARACTERISTIC and AXIS_PTS and MEMORY_LAYOUT */ "DP_BLOB" struct { uint; /* Address extension of the calibration data (only Low Byte significant) */ ulong; /* Base address of the calibration data */ ulong; /* Number of Bytes belonging to the calibration data */ }; /* for MEASUREMENT */ "KP_BLOB" struct { uint; /* Address extension of the online data (only Low Byte significant) */ ulong; /* Base address of the online data */ ulong; /* Number of Bytes belonging to the online data (1,2 or 4) */ taggedstruct { ("RASTER" uchar)*; /* Array of event channel initialization values */ }; }; ("ADDRESS_MAPPING" struct /*lzf 2012.10.30*/ { long; long; long; })*; }; }; /**/ /end A2ML /begin MOD_PAR "_default_ModParComment" /begin MEMORY_SEGMENT _RAM "calibration_ram" DATA RAM INTERN 0x40004C00 // 标定量对应在RAM的区域(需将FLASH的标定量复制到这个区) 0x00002000 // 标定量的大小 -1 -1 -1 -1 -1 /end MEMORY_SEGMENT /begin MEMORY_SEGMENT _ROM "calibration_rom" DATA FLASH INTERN 0x00008000 // 标定量对应在RAM的区域(需将FLASH的标定量复制到这个区) 0x00002000 // 标定量的大小 -1 -1 -1 -1 -1 /begin IF_DATA ASAP1B_CCP ADDRESS_MAPPING /*orig_adr:*/ 0x00008000 /*mapping_adr:*/ 0x40004C00 /*length:*/ 0x2000 // 标定量空间的映射(flash--> ram) /end IF_DATA /end MEMORY_SEGMENT /begin MEMORY_SEGMENT _RAMCAL1 "measurement_ram" DATA RAM INTERN 0x40000000 //观测量所在的区域 0x00004C00 -1 -1 -1 -1 -1 /end MEMORY_SEGMENT /begin MEMORY_SEGMENT _ECU_CODE1 "" CODE FLASH INTERN 0x00020000 // APP的地址 0x00060000 -1 -1 -1 -1 -1 /end MEMORY_SEGMENT /end MOD_PAR /begin IF_DATA ASAP1B_CCP /* Specific definition for CCP */ /begin SOURCE /* Description of a DAQ */ /* (Data Acquisition List) */ "5ms" /* Name */ 3 /* Scaling Unit: 1 = 10 us */ 5 /* Rate in Scaling Unit: 1562 */ DISPLAY_IDENTIFIER DAQ0 /begin QP_BLOB /* The QP-BLOB specify the behavior of */ /* the corresponding DAQ-List */ 0 /* Number of DAQ-list */ LENGTH 0x3C /* Number of ODT's, which can be in- */ /* serted to this DAQ */ CAN_ID_FIXED 0x300 /* CAN-ID for measuring this DAQ */ RASTER 0 /* ECU event-number according to event- */ /* number by the keyword RASTER. */ REDUCTION_ALLOWED /* Data reduction possible */ FIRST_PID 0x0 /* First PID for this DAQ */ /end QP_BLOB /end SOURCE /begin SOURCE /* Description of a DAQ */ /* (Data Acquisition List) */ "10ms" /* Name */ 3 /* Scaling Unit: 103 = cylinder segment */ 10 /* Rate in Scaling Unit: 1 */ DISPLAY_IDENTIFIER DAQ1 /begin QP_BLOB /* The QP-BLOB specify the behavior of */ /* the corresponding DAQ-List */ 1 /* Number of DAQ-list */ LENGTH 0x3c /* Number of ODT's, which can be in- */ /* serted to this DAQ */ CAN_ID_FIXED *0x301* /* CAN-ID for measuring this DAQ */ RASTER 1 /* ECU event-number according to event- */ /* number by the keyword RASTER. */ REDUCTION_ALLOWED /* Data reduction possible */ FIRST_PID 60 /* First PID for this DAQ */ /end QP_BLOB /end SOURCE /begin RASTER /* ECU-event specification */ "5ms" /* Name of the ECU-event */ "5ms" /* Shortname */ 0 /* Number of ECU-event */ 3 /* Scaling Unit: 1 = 10 us */ 5 /* Rate in Scaling Unit: 1562 */ /* Refresh rate = 1562 * 10us = 15.62ms */ /* Codes for Scaling units (CSE) look at*/ /* ASAP1b Specification */ /end RASTER /begin RASTER /* ECU-event specification */ "10ms " /* Name of the ECU-event */ "10ms" /* Shortname */ 1 /* Number of ECU-event */ 3 /* Scaling Unit: 1 = 10 us */ 10 /* Rate in Scaling Unit: 391 */ /* Refresh rate = 391 * 10 us = 3.91ms */ /* Codes for Scaling units (CSE) look at*/ /* ASAP1b Specification */ /end RASTER /begin RASTER /* ECU-event specification */ "20ms" /* Name of the ECU-event */ "20ms" /* Shortname */ 2 /* Number of ECU-event */ 3 /* Scaling Unit: 3 = 1 ms */ 20 /* Rate in Scaling Unit: 125 */ /* Refresh rate = 1 * 125 ms = 125ms */ /* Codes for Scaling units (CSE) look at*/ /* ASAP1b Specification */ /end RASTER /begin RASTER /* ECU-event specification */ "100ms" /* Name of the ECU-event */ "100ms" /* Shortname */ 3 /* Number of ECU-event */ 3 /* Scaling Unit: 3 = 1 ms */ 100 /* Rate in Scaling Unit: 125 */ /* Refresh rate = 1 * 125 ms = 125ms */ /* Codes for Scaling units (CSE) look at*/ /* ASAP1b Specification */ /end RASTER /*/begin SEED_KEY "D:\seedms6.dll" "D:\seedms6.dll" "D:\seedms6.dll" /end SEED_KEY /begin CHECKSUM "CRC16.dll" /end CHECKSUM*/ /begin TP_BLOB 0x0201 0x0204 0x111 // 接收报文 0x112 // 发送报文 0x0413 1 BAUDRATE 500000 // 波特率 500 K SAMPLE_POINT 70 SAMPLE_RATE 1 BTL_CYCLES 10 SJW 1 SYNC_EDGE SINGLE DAQ_MODE 0 /* 1 = one DAQ per cycle */ CONSISTENCY 1 /* 1 = ODT consistant */ ADDRESS_EXTENSION 0 /* 0 = 1 extension per DAQ (not supported) */ RESUME_SUPPORTED /* necessary for ResumeBit support */ STORE_SUPPORTED /**/ /* Not supported */ /begin CHECKSUM_PARAM 0x9001 0xffffffff CHECKSUM_CALCULATION ACTIVE_PAGE /end CHECKSUM_PARAM /begin DEFINED_PAGES 2 "calibration_ram" 0 0x40004C00 // 标定量在RAM ---> 参考区 0x00002000 RAM RAM_INIT_BY_TOOL /end DEFINED_PAGES /begin DEFINED_PAGES 1 "calibration_rom" // 标定量在FLASH ---> 参考区 0 0x00008000 0x00002000 FLASH /end DEFINED_PAGES OPTIONAL_CMD 0X5 OPTIONAL_CMD 0X8 OPTIONAL_CMD 0X9 OPTIONAL_CMD 0XC OPTIONAL_CMD 0XD OPTIONAL_CMD 0XE /**/ OPTIONAL_CMD 0XF OPTIONAL_CMD 0X10 OPTIONAL_CMD 0X11 OPTIONAL_CMD 0X12 OPTIONAL_CMD 0X13 OPTIONAL_CMD 0X18 OPTIONAL_CMD 0X19 OPTIONAL_CMD 0X20 OPTIONAL_CMD 0X21 OPTIONAL_CMD 0X22 OPTIONAL_CMD 0X23 /end TP_BLOB /end IF_DATA /begin MOD_COMMON "" /* Comment */ ALIGNMENT_BYTE 1 ALIGNMENT_WORD 1 ALIGNMENT_LONG 1 ALIGNMENT_FLOAT32_IEEE 1 ALIGNMENT_FLOAT64_IEEE 1 BYTE_ORDER MSB_FIRST DEPOSIT ABSOLUTE /end MOD_COMMON /begin RECORD_LAYOUT Scalar_BOOLEAN FNC_VALUES 1 UBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_UBYTE FNC_VALUES 1 UBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_BYTE FNC_VALUES 1 SBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_UWORD FNC_VALUES 1 UWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_SWORD FNC_VALUES 1 SWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_ULONG FNC_VALUES 1 ULONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_LONG FNC_VALUES 1 SLONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_FLOAT32_IEEE FNC_VALUES 1 FLOAT32_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Scalar_FLOAT64_IEEE FNC_VALUES 1 FLOAT64_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_BYTE FNC_VALUES 1 SBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_BYTE AXIS_PTS_X 1 SBYTE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_UBYTE FNC_VALUES 1 UBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_UBYTE AXIS_PTS_X 1 UBYTE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_UWORD FNC_VALUES 1 UWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_UWORD AXIS_PTS_X 1 UWORD INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_WORD FNC_VALUES 1 SWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_WORD AXIS_PTS_X 1 SWORD INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_ULONG FNC_VALUES 1 ULONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_ULONG AXIS_PTS_X 1 ULONG INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_SLONG FNC_VALUES 1 SLONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_LONG AXIS_PTS_X 1 SLONG INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_FLOAT32_IEEE FNC_VALUES 1 FLOAT32_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_FLOAT32_IEEE AXIS_PTS_X 1 FLOAT32_IEEE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_FLOAT64_IEEE FNC_VALUES 1 FLOAT64_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup1D_X_FLOAT64_IEEE AXIS_PTS_X 1 FLOAT64_IEEE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_UBYTE FNC_VALUES 1 UBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_UBYTE AXIS_PTS_X 1 UBYTE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_BYTE FNC_VALUES 1 SBYTE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_BYTE AXIS_PTS_X 1 SBYTE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_UWORD FNC_VALUES 1 UWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_UWORD AXIS_PTS_X 1 UWORD INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_WORD FNC_VALUES 1 SWORD COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_WORD AXIS_PTS_X 1 SWORD INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_ULONG FNC_VALUES 1 ULONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_ULONG AXIS_PTS_X 1 ULONG INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_LONG FNC_VALUES 1 SLONG COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_LONG AXIS_PTS_X 1 SLONG INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_FLOAT32_IEEE FNC_VALUES 1 FLOAT32_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_FLOAT32_IEEE AXIS_PTS_X 1 FLOAT32_IEEE INDEX_INCR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_FLOAT64_IEEE FNC_VALUES 1 FLOAT64_IEEE COLUMN_DIR DIRECT /end RECORD_LAYOUT /begin RECORD_LAYOUT Lookup2D_X_FLOAT64_IEEE AXIS_PTS_X 1 FLOAT64_IEEE INDEX_INCR DIRECT /end RECORD_LAYOUT /end PROJECT
最新回复(0)