Portenta M4 ethernet compile error

Hello everyone

I am currently setting up my dev environment to program both cores of the Arduino Portenta H7. Compilation for the M7 core works fine.

But if I want to compile the code for the M4 core, I get the following error:

.pio\build\portenta_h7_m4\src\main.cpp.o: In function `BreakoutCarrierClass::BreakoutCarrierClass()':
main.cpp:(.text._ZN20BreakoutCarrierClassC2Ev[_ZN20BreakoutCarrierClassC5Ev]+0x14e): undefined reference to `EMAC::get_default_instance()'
.pio\build\portenta_h7_m4\lib9df\libEthernet.a(Ethernet.cpp.o): In function `_GLOBAL__sub_I__ZN7arduino13EthernetClass5beginEPhmm':
Ethernet.cpp:(.text.startup._GLOBAL__sub_I__ZN7arduino13EthernetClass5beginEPhmm+0x14): undefined reference to `EMAC::get_default_instance()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\portenta_h7_m4\firmware.elf] Error 1

I think the error occurs because the M4 core doesn’t have any Ethernet stuff but I can’t figure out how I can turn of this functionality so it doesn’t get compiled.

My env for the M4 core is:

[env:portenta_h7_m4]
platform = ststm32
board = portenta_h7_m4
framework = arduino
lib_deps =
    arduino-libraries/Arduino_PortentaBreakout@^1.0.1
build_flags=
    -I"C:\Users\user\.platformio\packages\framework-arduino-mbed\libraries\Portenta_Audio\src" ; pdm2pcm is not found therefore manually link it here

Can anyone help me?

Then you might be running into a technical limititation in which the M4 core cannot access all peripherals. You should open an issue in https://github.com/arduino/ArduinoCore-mbed/issues to let the developers help you.

I have started getting this error as well.

In my case it pertains to including
\

#include “Arduino_PortentaBreakout.h”

That header files includes Ethernet.h, and that is what results in the error.

My code worked well in the past, so it may be something with a recent update