The IIS2MDC magnetometer driver was added in January 2025 and requires Ardupilot version 4.6 or newer.
Use the Ardupilot Custom Firmware Builder to compile firmware for your autopilot with the IIS2MDC driver. Select IIS2MDC Compasses under Compass for your board.
This PR can be backported into previous releases of Ardupilot.