5 Programming the Device
With the code written, the Devicetree set up, and KConfig configured, now the project needs to be built. If this is the first build of the project, the command below will force a clean rebuild:
west build -p always -b saml21_xpro samples/sensor/mtch9010 -- -DDTC_OVERLAY_FILE=conductive.overlay
If the project has already been built before, this command will let the toolchain decide whether a full rebuild is necessary:
west build -b saml21_xpro samples/sensor/mtch9010 -- -DDTC_OVERLAY_FILE=conductive.overlay
After compilation is complete, the board can be flashed using:
west flash
This command will automatically search for and program the SAM L21 XPlained Pro through the debug USB header.
If unable to program the board using West, the compiled binary can be passed to another program for programming, such as MPLAB X IPE or an equivalent tool.
