How the Arduino Zero uses the ArduinoCore-samd package

Hello everyone,

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?

Thank you!

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).

Are they only downloaded to the Arduino Zero board when I include Arduino.h?

Arduino.h is always included automatically

And what about the files in the drivers folder?

drivers are USB drivers for the computer installed at platform installation

Are the corresponding files only downloaded when I include SPI.h?

SPI is a library.the files from the library are only in the resulting binary if you included the header and used the library

Also, how can I determine the start and end addresses in the memory where these files are downloaded?

in the .map file after build or in the linker script

Okay, thank you for your help!

Okay, thank you for your answer.

So, can I assume that all files in the cores folder will always be included in the final binary file?

no. builder only uses what is really used (mostly)

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.

The required parts are used in the final binary; they are not separately uploaded (downloaded) to the board.

If you only print to serial port and never read from the serial port, something like Serial.read() will not be in the final binary.

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?

Yes; not as C++ code though; it's compiled.

Got it, thank you for your response.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.