Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong code generated for dynamic array of bools #135

Closed
mprymek opened this issue Sep 3, 2019 · 2 comments

Comments

@mprymek
Copy link

commented Sep 3, 2019

When I compile this DSDL file:

#
# DigitalInputsValues
#

uint8 start_input_id

bool[<=32] values

I got illegal decode code generated:

uint32_t automation_DigitalInputsValues_encode_internal(automation_DigitalInputsValues* source,
  void* msg_buf,
  uint32_t offset,
  uint8_t CANARD_MAYBE_UNUSED(root_item))
{
    uint32_t c = 0;

    canardEncodeScalar(msg_buf, offset, 8, (void*)&source->start_input_id); // 255
    offset += 8;

    // Dynamic Array (values)
    6
    //  - Add array length, last item, but bitlen < 8.
    canardEncodeScalar(msg_buf, offset, 6, (void*)&source->values.len);
    offset += 6;

    // - Add array items
    for (c = 0; c < source->values.len; c++)
    {
        canardEncodeScalar(msg_buf,
                           offset,
                           1,
                           (void*)(source->values.data + c));// 1
        offset += 1;
    }

    return offset;
}

Note the strange 6 in Dynamic Array (values). Static array works ok.

I'm sorry, I'm not familiar enough with the compiler code to make a PR.

@pavel-kirienko

This comment has been minimized.

Copy link
Member

commented Sep 6, 2019

Sorry, the compiler is currently broken. We have added the following warning to the README to make sure people are aware of it:

WARNING: this code generation tool is not production-ready; do not use it unless you are feeling adventurous and willing to contribute. In a production setting consider writing the serialization code manually instead.

We should be working on a new compiler in the UAVCAN-v1.0 branch. If you need code generation, please use libuavcan instead.

@mprymek

This comment has been minimized.

Copy link
Author

commented Sep 6, 2019

Ok, thanks.

@mprymek mprymek closed this Sep 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.