I would like to know how the Arduino Zero uses the ArduinoCore-samd package. Specifically, which parts of it are downloaded to the Arduino Zero development board and where are they stored in the memory?
For example, I know that the files in the bootloader folder will be installed in the bootloader section of the Arduino Zero board. But what about the files in the core folder? Are they only downloaded to the Arduino Zero board when I include Arduino.h? And what about the files in the drivers folder? Are the corresponding files only downloaded when I include SPI.h?
Also, how can I determine the start and end addresses in the memory where these files are downloaded?
I can only help with the core as I'm not familiar with the Arduino Zero.
When you verify (compile) a sketch, (parts of?) the core are compiled and linked in the final bin (or hex) file. The compiler is clever and will throw away any functions / variables that are not used during the linking.
You can find out what is compiled if you enable verbose output during compilation in file / preferences in the IDE. Note that due to caching mechanisms you might not see all files being compiled because they were already compiled; to play around with it, starting a new sketch will probably show the all files that are compiled.
IDE 1.x throws away the cache when you close it, IDE 2.x maintains the cache (I think for one month).
Okay, can I understand it this way?
Only the bootloader is always present on the Arduino development board. Therefore, other files in the ArduinoCore-samd package, such as those in the cores and libraries folders, are only downloaded to the Arduino Zero when needed.
Alright, do you mean that in this case, the Serial.read() function will not appear, but the Serial.print() function will appear in the final binary file?