What is an "Arduino core"?
Are there many different "Arduino cores"? such as a core that applies to LCD displays, another core that applies to servos, etc.?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityThe Core is the software API for a specific group of chips.
For instance, the AVR core supports the AVR chips found on most Arduino boards. The SAM3X core supports the Arduino Due. Etc.
It is the code that provides things like digitalRead(), analogWrite(), millis() etc.
Since each family of chips works differently that abstraction layer between your sketch and the physical hardware of the chip needs to be different.
In your default IDE installation the Arduino AVR core can be found within the hardware/arduino/avr/cores/arduino
folder.
Cores are usually installed as part of a "boards" bundle in the boards manager. This includes definitions for the boards ("variants"), the core and, equally importantly, the compiler and firmware uploading software for the chip on the board.
The "core" provides the low-level APIs (Application Programmer Interfaces) which are documented in the Arduino Reference page. For example, digitalRead
, digitalWrite
, delay
and so on.
The core files usually contain the "include" files from Atmel which provide documented names for the various registers in the chip (eg. DDRB
for data direction register B).
Since each chip type will have different addresses for the registers you will need a different core for each processor chip. Also in some cases people have assembled the chip onto different boards, and the cores will reflect how the board is wired. For example "edge pin 8" on one board may connect to a different pin on the processor chip compared to another board. Thus if you buy a board from a third-party they may also supply their own core files.
Are there many different Arduino cores such as a core that applies to LCD displays, another core that applies to servos?
These are usually implemented in libraries which you can optionally include into your code. The libraries extend the core. Often the same library will work with different cores as the core code handles the differences between chips, so that the library doesn't have to.
As Majenko mentions in his answer, selecting a board in the IDE (Integrated Development Environment) usually tells the IDE to select the appropriate core for that board/chip combination.
More recent versions of the IDE allow you to install more cores by providing a link to where the core files are to be found, and then allowing you to choose one or more cores from that site.
As far as I know the cores are the different products which can be found at Products. In this list the Arduino cores can be selected in the IDE: Cores
LCD display (driver) etc. are mostly referred as shields or modules. A shield is a small 'board' you can stack on top of the Arduino (Core) and a module is normally to be used on a breadboard.
The collection of MCU's that are part of the Arduino family have differences from one to another in features like the address in memory-space of the basic processor registers, the I/O pin assignments to the I/O registers, nature and operation of timers, A/Ds, etc. The kinds of things we do with calls like pinMode(), digitalWrite(), or attachInterrupt().
These are considered the basic or "core" functions to be presented to the programmer by using libraries to present a common interface and hide those differences. The core libraries are managed by the Arduino IDE and the proper one(s) are selected when you select a board-type from the Tools | Board menu.
This is different from the user-contributed and other non-core dependent libraries you keep in your workspace 'libraries' folder. Both kinds are code libraries, but the so-called "core-libraries" are specific to the kind of processor you are compiling your sketch to run on.