Used RCP.Call freeze the M4 core

hello
I try to have a simple example with RPC library. The goal is to passe the "boot button" state from m7 core to m4 core and the m4 core shall retrieved it and enable the LED
But when i call the function RPC.call on the M4, this core freeze. ( according the code, the led shall be blink but it's no the case).
To ensure it's this function who freeze the core, i have try to remove it and it's works ( LED blink)
Someone can help me to understand the problem?

set up:

  • arduino IDE 2.1.1
  • flash split "1MB M7 + 1MB M4"
  • lib: Arduino Mbed OS Giga board 4.0.4

M7 core:

/*Library use to start M4 core*/
#include <RPC.h>

const PinName eBOOTButtonPin = PC_13; // Pine mame where is the BOOT button on GIGA
int IntBOOTButtonState = 0;           // variable to store the boot button state
const int IntBluePin = LEDB; // Pin Number 88 for Arduino

void setup()
{

  pinMode(eBOOTButtonPin, INPUT);
  pinMode(IntBluePin, OUTPUT);

  /*blink to indicate boot is ok on M7*/

  digitalWrite(IntBluePin, LOW);
  delay(500);
  digitalWrite(IntBluePin, HIGH);
  delay(500);
  digitalWrite(IntBluePin, LOW);
  delay(500);
  digitalWrite(IntBluePin, HIGH);

  RPC.begin(); // boot M4 core
  // Bind the button state  on the M7
  RPC.bind("IntGetBootButtonState", IntGetBootButtonState);
}

void loop()
{

  IntBOOTButtonState = digitalRead(eBOOTButtonPin);
  IntGetBootButtonState(); //call to ensure le read button work. (LED ON/OFF when button is/is not push)
  delay(500);
}

int IntGetBootButtonState()
{
  if (HIGH == IntBOOTButtonState)
  {
    digitalWrite(IntBluePin, LOW);
  }
  else
  {
    digitalWrite(IntBluePin, HIGH);
  }

  return (int)IntBOOTButtonState;
}

M4 core:


#include "RPC.h"

/* constants won't change. They're used here to set pin numbers: */
const int IntGreenPin = LEDG; // Pin Number 87 for Arduino
const int IntRedPin = LEDR;   // Pin Number 86 for Arduino
const int IntBluePin = LEDB;  // Pin Number 88 for Arduino

int IntBOOTButtonStateRetrieved = 0; // variable to store the boot button state

void setup()
{
    pinMode(IntGreenPin, OUTPUT);
    pinMode(IntRedPin, OUTPUT);
    /*blink to indicate boot is ok on M7*/

    digitalWrite(IntRedPin, LOW);
    delay(500);
    digitalWrite(IntRedPin, HIGH);
    delay(500);
    digitalWrite(IntRedPin, LOW);
    delay(500);
    digitalWrite(IntRedPin, HIGH);
    RPC.begin();
}

void loop()
{
    digitalWrite(IntRedPin, LOW);
    delay(1000);
    digitalWrite(IntRedPin, HIGH);
    delay(1000);
    digitalWrite(IntRedPin, LOW);
    delay(1000);
    digitalWrite(IntRedPin, HIGH); 



    auto result = RPC.call("IntGetBootButtonState",IntBOOTButtonStateRetrieved).as<int>();
    
    if (0 == result)
    {
        digitalWrite(IntGreenPin, LOW);
    }
    else
    {
        digitalWrite(IntGreenPin, HIGH);
    }
    delay(500);
}

Thanks for your support