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

Feature/support multiple clients #271

Merged

Conversation

Hadatko
Copy link
Member

@Hadatko Hadatko commented May 10, 2022

Pull request

Choose Correct

  • bug
  • feature

Describe the pull request

Better support of C++ usecases -> mainly multiple clients usage.

To Reproduce

Expected behavior

test_passing :D

Screenshots

Desktop (please complete the following information):

  • OS:
  • eRPC Version:

Steps you didn't forgot to do

  • [X I checked if other PR isn't solving this issue.
  • I read Contribution details and did appropriate actions.
  • PR code is tested.
  • PR code is formatted.

Additional context

@Hadatko Hadatko self-assigned this May 10, 2022
@Hadatko
Copy link
Member Author

Hadatko commented May 10, 2022

Currently WIP (alpha)

@Hadatko Hadatko marked this pull request as draft May 10, 2022 10:16
@Hadatko Hadatko force-pushed the feature/supportMultipleClients branch from 8651a89 to 436c92a Compare June 8, 2022 12:47
@Hadatko
Copy link
Member Author

Hadatko commented Jun 8, 2022

@MichalPrincNXP test_annotation can be compiled. I moved C related generated code into its own files. This way C++ code will be cleaner. Also more transparent for C develepors how the C++ code is wrapped.

@mnathieu
Copy link

Hi!
I am really interested in the feature (especially the C++ version). Great addition.
Are you still active on it? Any plan to add it to a future release?

@Hadatko
Copy link
Member Author

Hadatko commented Oct 11, 2022

HI @mnathieu , it is still my top priority. I had solution twice, but twice it was not complete due to issues with callbacks and c++. I am expecting that i will finish integration to the end of this year. Question is if documentation update will be part of it, or i will add documentation update next year. I guess release depend on that.

@Hadatko Hadatko force-pushed the feature/supportMultipleClients branch from 0f2edf3 to ae016fa Compare November 16, 2022 10:11
@Hadatko
Copy link
Member Author

Hadatko commented Nov 16, 2022

HI @MichalPrincNXP,
FYI: tests are passing. Errors which appear are due to pytest which need to be modified and some clang compiler incompatibility.
I need refactor code a bit , but that shouldn't be an huge change.

@tmordeko
Copy link

tmordeko commented Dec 5, 2022

Hi @Hadatko we are looking forward for this feature , when do you plan to release it ?

@Hadatko
Copy link
Member Author

Hadatko commented Dec 5, 2022

Hi @tmordeko , i think i will be able to release it here (to develop branch) before March 2023. It looks working well now, but code need be edited a bit (formatted/refactored). Maybe release it in small steps (i already created few smaller PRs).
Oficial release to master should be around June/July.

@Hadatko Hadatko added this to the 1.11.0 milestone Dec 5, 2022
@Hadatko Hadatko force-pushed the feature/supportMultipleClients branch from 9c66dd8 to f50951c Compare May 15, 2023 12:39
@Hadatko Hadatko modified the milestones: 1.11.0, 1.12.0 Jun 1, 2023
@Hadatko Hadatko force-pushed the feature/supportMultipleClients branch 3 times, most recently from 566c957 to b114965 Compare July 20, 2023 11:01
@Hadatko
Copy link
Member Author

Hadatko commented Jul 20, 2023

Hi @MichalPrincNXP could you take o look on this code? It should be ready more or less. If you would like it i would improve pytests and update documentation.

Hi @amgross i am curious about tour opinion too. Do you think you could review it as well?

One thing which i know is not good is generating common datatypes. I wanted to have two header files. One for c and one for c++. For c++ i wanted to hide them under namescope erpcShim. I had compilation issues which i think i would be able to solve (related const definition). But then i started to think if it is good idea and if i should rather use global namespace.

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko
Copy link
Member Author

Hadatko commented Sep 22, 2023

@MichalPrincNXP i made changes based on your PR. Let me know if they met your requests. Also i enabled in clang config to keep empty lines between includes, which will simplify keeping includes on some specific position...

This reverts commit d5acf06.

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko
Copy link
Member Author

Hadatko commented Sep 22, 2023

@MichalPrincNXP @PhilippHaefele for know i want finish this PR and we don't have much time so i reverted commit with enum classes support in shim code. And we can create new PR where we will solve that.

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@MichalPrincNXP
Copy link
Member

@MichalPrincNXP i made changes based on your PR. Let me know if they met your requests. Also i enabled in clang config to keep empty lines between includes, which will simplify keeping includes on some specific position...

Thank you, let me check it again on hw

@MichalPrincNXP
Copy link
Member

Hi Dusan,
I have successfully converted the NXP erpc_matrix_multipy example to use the latest generator and the erpc code. However, I am facing issues with the erpc_two_way_rpc example.
First, incorrect includes are generated in several shim code files:
#include "erpc_two_way_rpc_Core0Interface.h" -> #include "erpc_two_way_rpc_Core0Interface**_common**.h"
Second, incorrect generated code in erpc_two_way_rpc_Core0Interface_server.cpp / Core0Interface_interface_getNumberCallback_t_shim function:

        if ((serviceID == ) && (functionID == 4))
        {
            m_handler->getNumberFromCore1(param1);
        }
Error[Pe029]: expected an expression	C:\D\work\sdk_w\mcu-sdk-2.0\middleware\multicore\example\multicore_examples\erpc_common\erpc_two_way_rpc\service\erpc_two_way_rpc_Core0Interface_server.cpp	53	
Error[Pe167]: argument of type "uint32_t" is incompatible with parameter of type "uint32_t *"	C:\D\work\sdk_w\mcu-sdk-2.0\middleware\multicore\example\multicore_examples\erpc_common\erpc_two_way_rpc\service\erpc_two_way_rpc_Core0Interface_server.cpp	55	

Could you please help to address these issues?

@Hadatko
Copy link
Member Author

Hadatko commented Oct 2, 2023

Hi @MichalPrincNXP , thank you. I will take a look on these. I didn't expect issue as our tests are passing. Maybe we need updated tests...

@Hadatko
Copy link
Member Author

Hadatko commented Oct 2, 2023

@MichalPrincNXP Did you use newly compiled erpcgen from this branch (you need do it by yourself or download from CI). DId you update erpc file (current one is no longer supported. You can see in tests/test_callback).

@MichalPrincNXP
Copy link
Member

Yes, the newly compiled erpcgen has been used and the erpc file updated. Could you please review attached updated erpc first? Hope I did it correctly.
erpc_two_way_rpc.zip

@Hadatko
Copy link
Member Author

Hadatko commented Oct 3, 2023

So i took a look into your erpc file. Callback was defined as global now moved into two interfaces. This mean that the callback will be created twice (one for each interface) and it will be used only within interface where it is declared. If you take look into test_callback.erpc changes, the callback is created only in one interface and in second interface it is referenced trough "Interface::". This is enabling to us define from which interface callback should be used.

@MichalPrincNXP
Copy link
Member

I see, I am trying to use Core1Interface:: / Core0Interface:: but still facing issues ... may I ask you if you could provide the updated erpc_two_way_rpc.erpc?
Still, I afraid includes in shim code are not accurate (missing _common postfixes)
Thanks

@Hadatko
Copy link
Member Author

Hadatko commented Oct 10, 2023

@MichalPrincNXP I noticed that erpc file is using includes to non existing files. I woudl remove them. Anyway it looks like there is still an issue using callback type in return function. So i will investigate this part
erpc_two_way_rpc.erpc.zip

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko
Copy link
Member Author

Hadatko commented Oct 12, 2023

hi @MichalPrincNXP , i am struggling a bit with compiling provided example (i will try to do it). In a mean time i think i fixed both observated errors. Could you try newer erpcgen based on latest commit?

@MichalPrincNXP
Copy link
Member

hi @MichalPrincNXP , i am struggling a bit with compiling provided example (i will try to do it). In a mean time i think i fixed both observated errors. Could you try newer erpcgen based on latest commit?

sure

@MichalPrincNXP
Copy link
Member

Hi Dusan, still one build issue in erpc_two_way_rpc_Core0Interface_server.cpp/erpc_two_way_rpc_Core1Interface_server.cpp shim code:

erpc_status_t Core1Interface_service::getNumberFromCore0_shim(Codec * codec, MessageBufferFactory *messageFactory, uint32_t sequence)
{
    erpc_status_t err = kErpcStatus_Success;

    uint32_t number;

    // startReadMessage() was already called before this shim was invoked.

    err = codec->getStatus();
    if (err == kErpcStatus_Success)
    {
        // Invoke the actual served function.
#if ERPC_NESTED_CALLS_DETECTION
        nestingDetection = true;
#endif
        m_handler->getNumberFromCore0(&param1);
#if ERPC_NESTED_CALLS_DETECTION
        nestingDetection = false;
#endif

Error[Pe020]: identifier "param1" is undefined

@Hadatko
Copy link
Member Author

Hadatko commented Oct 12, 2023

So there is bug i should repair quickly. It can be ignored if definition is changed to: getNumberCallback2_t getNumberFromCore0;
But i will push fix one ready.

@Hadatko
Copy link
Member Author

Hadatko commented Oct 12, 2023

@MichalPrincNXP Fix was easy (actually modifying previous commit). I could do it before but i thought that i can break something. If i would do it we wouldn't have this error :DDD So i took a look on changes with this fix and it really changed only one line in generated shim code so i believe if this was the only error, that it will work properly.

Signed-off-by: Cervenka Dusan <cervenka@acrios.com>
@Hadatko Hadatko force-pushed the feature/supportMultipleClients branch from 098a051 to c7d80d6 Compare October 12, 2023 21:00
@Hadatko
Copy link
Member Author

Hadatko commented Oct 12, 2023

@MichalPrincNXP SO it broke something as i was affraid, but now fix everywhere ;) Still modifying previous config only...

@MichalPrincNXP
Copy link
Member

Thanks, build is ok now. I have to adjust the erpc_two_way example logic a little and once it is working again I could integrate this PR.

@MichalPrincNXP MichalPrincNXP merged commit 8616dbe into EmbeddedRPC:develop Oct 17, 2023
7 checks passed
@MichalPrincNXP
Copy link
Member

Finished, thank you Dusan for this new erpc feature.

@Hadatko Hadatko deleted the feature/supportMultipleClients branch October 17, 2023 16:20
@Hadatko
Copy link
Member Author

Hadatko commented Oct 17, 2023

;) Thank you for testing and finding bugs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants