-
Notifications
You must be signed in to change notification settings - Fork 15
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
zcbor test cases not working #201
Comments
It's not our code that is giving the errors, but the CDDL parsing library we use. I see you already made an issue there (anweiss/cddl/issues/199). Could you provide your own CDDLs that are not working? That could be more helpful as they're probably more real-world and less edge cases (that file is called There are definitely things not supported by cddl-codegen though that would be able to parse with Some things look a bit weird in that CDDL though: For the line 64 one if you rewrite it a bit it should be accepted by us. e.g. change For line 34 I'm confused as it uses group choice syntax |
I appreciate the quick feedback. Here's a simpler CDDL based on what I'm trying to do:
And here's the error:
I welcome any feedback. Again, this is working with zcbor but not with, I guess, the CDDL parsing library in use. |
What do you want the output generated to look like for With these changes:
Those Unfortunately there are two unsupported things even after rewriting those:
e.g. after running the code I get after the fact:
|
The resulting C code for CommandIDs is this:
I don't see anything in the RFC about using "; @ label" but I do seem sentences like:
This less clean solution works and produces basically the same C code (there's an extra underscore '_' for some reason):
So, now I am running with this (removed all "labels")
and am getting a crash:
Any ideas? Can you share what you ran with to get your "Not generating..." output? |
@nslowell I got the array struct deserialization with optional fields working: #204 Note: regarding the let a = Ok(raw.unsigned_integer()? as u64)
.map_err(|e: DeserializeError| e.annotate("a"))?;
let b = Ok(raw.unsigned_integer()? as u64)
.map_err(|e: DeserializeError| e.annotate("b"))?;
let c = Ok(raw.unsigned_integer()? as u64)
.map_err(|e: DeserializeError| e.annotate("c"))?; without any checks. So now with the above change to the |
It's a non-standard thing. The RFC specifies comments as Here's the code I used using the default CLI options:
Note: obviously if you run using |
Yes, we do that in general. It's just that when you make a basic group like |
Sorry the delay. I ran with your exact CDDL and am getting a crash. See below. Any ideas?
|
cool, thanks. I was able to produce code with your sample you gave me. So, now I've got this CDDL that's causing a different crash:
backtrace:
|
@nslowell If you rewrite those enums as mentioned earlier in the issue it won't panic e.g.:
Unfortunately even with #204 we can't emit deserialization traits (serialization works though) because the optional array fields are ambiguous. Look here:
Let's say you're deserializing and you get two arrays of bytes. How will the code know if they should be |
I have successfully used https://github.com/NordicSemiconductor/zcbor for generating C code from CDDLs, but my CDDLs and their provided test cases are getting error messages when I try to run them through this tool.
Can you provide some clarification on why the errors are occurring? Is this tool missing support?
Example for https://github.com/NordicSemiconductor/zcbor/blob/main/tests/cases/corner_cases.cddl:
The text was updated successfully, but these errors were encountered: