DanielT / a2ltool

A tool to edit, merge and update a2l files
Apache License 2.0
46 stars 15 forks source link

RFC/WIP: Support for inverted bitfields #28

Closed oleid closed 4 months ago

oleid commented 4 months ago

In reference to https://github.com/DanielT/a2ltool/issues/27

This seems to yield the same masks as CANape when using the INVERTED_BIT_FIELDS = 1 option.

grafik

https://cdn.vector.com/cms/content/products/asap2/Docs/ASAP2Tool-Set_Manual_EN.pdf

By the way, I had to modify the way type size was read due to the following debug information:

0x0002feee:     DW_TAG_member
                  DW_AT_name    ("reset_parser")
                  DW_AT_type    (0x0000000000033593 "unsigned char")
                  DW_AT_byte_size       (4)
                  DW_AT_bit_size        (0x01)
                  DW_AT_bit_offset      (0x10)
                  DW_AT_data_member_location    (DW_OP_plus_uconst 0x3c)

Aparrently, this is generated for the following structure (possibly due to padding on big endian):

/// PeriParam processing context
typedef struct {
    PParam_t apar;                      // buffer for current parameter
    PParam_CanData_t cd;                // can data to write
    PParam_Buf_t inp;                   // input command buffer
    PParam_Buf_t out;                   // output response buffer
    PParam_RespEvent_t resp_evt;        // response event to the current request
    int16_t get_param_idx;              // last table index during processing of "ALL" command
    uint8_t reset_parser : 1;           // reset parser
    uint8_t parser_finished : 1;        // is parser finished
    uint8_t parser_get_cmd : 1;         // flag read command received
    uint8_t parser_get_all : 1;         // flag read all parameters
    uint8_t continue_reading : 1;       // not finished yet with the response
    uint8_t reserved : 3;               // reserved
} PParam_ParserCtx_t;
oleid commented 4 months ago

Superseded by #29