-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Need Help #2
Comments
Sorry Mathis, I don't see anything wrong in this code (just by reading it), and to retest it myself I won't be able to do so until tomorrow (maybe even weekend). Are you sure that the error code was To help in debugging you may try to use the code of comms::processAllWithDispatch (and other functions in the same file) as reference and write your own processing loop with tighter control. Try just manual reading of your input buffer without loop and dispatching:
The comms::protocol::msgId() function may be used to pass the reference to a variable,which is going to be populated with detected message ID. Hope it helps |
Hey, thanks for the quick response.
And this is the output: Currently im using gcc7.2.1 with c++17 In the Evening i will try to use this with the Visual Studio 2019 compiler. Just to try it. |
I need to debug it myself, looks like a bug somewhere in the comms library
…On Thu, 8 Aug 2019, 18:06 Mathis Logemann ***@***.***> wrote:
Hey, thanks for the quick response.
Ive checked my Handlers and they seem to be fine.
Im using now this code to read in the message.
```
Frame::MsgPtr msgptr;
auto* readIter = &outputBuf[0];
auto iter = comms::readIteratorFor(msgptr, readIter);
std::size_t retrievedId = 0x99;/* some invalid value */
std::size_t len = outputBuf.size();
auto es = frame.read(msgptr, iter, len, comms::protocol::msgId(retrievedId));
LOG_DEBUG("Recv msgId: %i, es: %i", retrievedId, es);
And this is the output: `DEBUG | Application.cpp | task():136 | Recv msgId: 0, es: 5`
Es is 5 so it should map to ErrorStatus::InvalidMsgId.
Currently im using gcc7.2.1.
In the Evening i will try to use this with the Visual Studio 2019 compiler. Just to try it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASJKGWMYY4ZZIEYJTJUIK3QDPHZVANCNFSM4IKHBMIA>
.
|
Id was recognized correctly, but the correct object hasn't been created
…On Thu, 8 Aug 2019, 18:13 Alex Robenko ***@***.***> wrote:
I need to debug it myself, looks like a bug somewhere in the comms library
On Thu, 8 Aug 2019, 18:06 Mathis Logemann ***@***.***>
wrote:
> Hey, thanks for the quick response.
> Ive checked my Handlers and they seem to be fine.
> Im using now this code to read in the message.
> ```
> Frame::MsgPtr msgptr;
> auto* readIter = &outputBuf[0];
> auto iter = comms::readIteratorFor(msgptr, readIter);
>
> std::size_t retrievedId = 0x99;/* some invalid value */
> std::size_t len = outputBuf.size();
> auto es = frame.read(msgptr, iter, len, comms::protocol::msgId(retrievedId));
> LOG_DEBUG("Recv msgId: %i, es: %i", retrievedId, es);
>
> And this is the output: `DEBUG | Application.cpp | task():136 | Recv msgId: 0, es: 5`
> Es is 5 so it should map to ErrorStatus::InvalidMsgId.
>
> Currently im using gcc7.2.1.
>
> In the Evening i will try to use this with the Visual Studio 2019 compiler. Just to try it.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#2>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASJKGWMYY4ZZIEYJTJUIK3QDPHZVANCNFSM4IKHBMIA>
> .
>
|
Just added test37 to the "develop" branch to test the reported problem, and it all works fine (the message object is successfully created and dispatched to a handler), the test reports success. Could you please review it and see whether you see any significant difference with your code? |
To build the test37 do
To run the test do (from within the build directory)
The Another way to help me to help you is to fork one of the demo protocols, create new example application that fails for you and send me the link, so I could clone and check what's going on. |
Just noticed that you mentioned C++17. Actually I've never tested my work with C++17 enabled (only 11 and 14), and never used VS2019 also (only 2015 and 2017). Could you please try downgrade to C++11 and/or 14 and see whether the code works as expected? |
So i tested c++11, 14 and 17. For my test repo im using the Code Composer Studio with the gcc compiler. |
I have to mention, that the ubx implemention runs smoothly and one custom protocol also. |
Just tested the same code from the test repo in VisualStudio 19, with c++ 11,14,17. So I´m guessing it is something with the gcc compiler and embedded system? |
So i´ve now tried a couple of things:
Everything results in a not called Handler function. :/ These are my buildflags: I really dont know what is going on, simply because of the fact, that two implementations are working fine, but this doesnt. |
In general, I'd expect some specific compiler to fail compiling the code rather than compiling it in a wrong way. Because this is your particular compiler I won't be able to reproduce it. However, I might be able to guide your to find the reason and/or problematic location and probably you'll be able to workaround the problem (the COMMS library was designed with great flexibility to perform various compile time configurations) First of all, I think that your code bombs out on message object creation attempt here To verify my theory, please try to manually invoke the createMsg() member function of your frame:
If I'm wrong and the message object was successfully created, then there is a need to better understand what's going on in the loop I mentioned before, maybe you can also introduce retrieval of the "index" information.
If the value of If the message object cannot be created (most likely), then try playing with MsgFactory, which is used by the comms::protocol::MsgIdLayer class and reproduce the failure with it:
By default, the message factory uses comms::dispatchMsgType() to dispatch message id into the appropriate type. The function does compile time evaluation of the tuple with supported message types and their IDs and tries to choose between "polymorphic" and "static-bin-search' way of dispatching. If number of messages is small and/or not many gaps between message IDs (no more than 10% holes between the IDs), then "polymorphic" may is chosen. You can try to force it into using "static-bin-search" by passing comms::option::app::ForceDispatchStaticBinSearch option to the factory definition and see whether the failure still happens:
If such creation works now, here is your work around, you'll need to pass comms::option::app::ForceDispatchStaticBinSearch option to your "Id" layer of the frame, (just replace usage of default MyProtocol::options::DefaultOptions, with your class, that modifies appropriate type. For the sake of completion, you may also try to have multiple message IDs with their types (not only single "TestId" one) and see whether the message creation starts working. If it does, it may lead me to better understanding why wrong code has been generated and see how I can improve the code of the COMMS library by some refactoring and/or introducing more static_asserts to force compile time rather than runtime errors. |
Hey Alex, I can confirm, that it works, if I using this option:
Today i have to first move on with my work, but i will investigate this further on the weekend. |
Since the same code wont compile under the TI compiler v18 i have opened there a ticket to address those issues. The armopt.exe results in a segmentation fault. For tracking purposes here is the link : http://e2e.ti.com/support/tools/ccs/f/81/p/828521/3066091#3066091 |
Hey Alex, unfortunatly i didnt got so much time on the weekend.
And take A,B and K as my InputMessages, it will always call the If im choosing all messages as InMessages, it will call the correct handler or if im only using e.g. A and B. |
I'll do some extra testing myself. |
Just added some extra unit testing for type dispatching and message creation in the COMMS library (develop branch) and everything works as expected.
The results of Windows builds with testing should be here when complete and Linux builds with testing should be here. If builds and testing not failing, the chances are your cross-compiler is a problem. Maybe you can create simple test application that works for PC and fails for cross compiler and report the issue to the compiler developers. |
Hi Mathis, |
Hey Alex, Just to give short update on this:
i can resolve the issue with this. Additionally im waiting for Texas Instruments to fix the segmentation fault issue. Who knows how long that will be :D |
It looks like the TI-Team fixed the issue. So currently it isnt released but the bug tracker status is "fixed" |
I've forgotten to close this. The bug was fixed by Texas Instruments. It is available in the ti-compiler version 20+ Link to ti bug tracker: https://sir.ext.ti.com/jira/browse/EXT_EP-9476?jql=text%20~%20%22CODEGEN-6581%22 |
Hey sorry for interrupting you again, but i dont know how to proceed. I have already two custom protocols implemented but the third isnt working and i dont know why. Ive prepared a simple
demo:
Schema:
Definitions:
Test code:
The Error-Code is on "InvalidMsgId"
Ive inserted some DebugMessages but cant find the root cause:
Where is my mistake? I just cant see it.
The text was updated successfully, but these errors were encountered: