Hi @ashnak
Yes that's right, the Arduino code code configures and prepares the board during start-up before running the sketch and contains the Arduino specific functions.
The Arduino core code for the Arduino SAMD21 boards (on my old Windows 8.1 machine at least) is located at:
C:\Users\Computer\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11
The common SAMD21 core code can be found in the "core" directory.
Individual set-up for each board type is in the "variants" directory, where you'll find the "variant.h" and "variant.cpp" configuration files.