arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.37k stars 385 forks source link

"Core" vs "platform" #549

Open alranel opened 4 years ago

alranel commented 4 years ago

Various help and error messages use the words "core" and "platform" interchangeably, as they are synonyms in the Arduino context. This might create confusion, so it would better to be consistent in all messages by choosing a single term.

masci commented 4 years ago

In some parts of the README you can spot few places where I wrote platform core instead of just core to highlight this interchangeability but it's a palliative. I will fully support any initiative to consolidate the terminology organically and across the whole codebase.

I think addressing the problem right now would be best because major version 0.x gives us a certain degree of freedom in changing user facing APIs.

lorforlinux commented 4 years ago

Hi, I think we should choose to use the term platform for referencing the software part used for the programming of the board, This Definition of the platform makes it clear.

Definition - What does Platform mean? A platform is a group of technologies that are used as a base upon which other applications, processes or technologies are developed.

and we can spare the term core for the hardware core of our board.

matthijskooijman commented 4 years ago

I actually think (based on the terminology used in the Java IDE code - I have not looked at arduino-cli), that there are a few related but distinct concepts. For example, consider the regular Arduino core, which lives at: hardware/arduino/avr/cores/arduino (and is sometimes referred to as arduino:avr:arduino, though at least in a "core reference", the "avr" part is implied).

Since a platform typically only ships a single core, these two terms are often used interchangeably, but there is a technical difference.

I can imagine that changing the terminology could be useful, since these terms were chosen long ago when we did not really know how things would be used in practice. However, if we change things, we might need to settle for terms that are completely different (e.g. do not reuse core to refer to what used to be called platform), since that would highly complicate things. OTOH, if core and platform are already used interchangeably, reusing core for platform might not be so harmful after all.

Looking at the current terms:

lorforlinux commented 4 years ago

if core and platform are already used interchangeably, reusing core for platform might not be so harmful after all.

@matthijskooijman I agree with you on this.

Since a platform typically only ships a single-core, these two terms are often used interchangeably, but there is a technical difference.

indeed! they are.

we are required to have more discussion before applying any patch for this one!

thekunalsaini commented 4 years ago

I think core is to be used.

pra-dan commented 4 years ago

I think, from the comments above, the first conclusion that can be made is: We have a common understanding of the term core but platform is understood as architecture, arduino/avr as a family and the firmware (software for the board).

To limit the scope of discussion and to give it a direction. we should only focus on the platform part. Surprisingly, according to me, platform also meant the hardware. So, that's an addition to the problem :(

matthijskooijman commented 4 years ago

To limit the scope of discussion and to give it a direction. we should only focus on the platform part. Surprisingly, according to me, platform also meant the hardware. So, that's an addition to the problem :(

I'm not so sure. I guess the main problem is that the "official" terminology is package - platform - core. However, in practice people do not often refer to the package and core much, but only to the platform. However, when they refer to the platform, they often call it "core" or "board package" (the latter is actually encouraged by the fact that you can install them using the "boards manager"). Given that both terms ("core" and "package") are currently the official terms for other things, I suspect we also need to look at these other things (otherwise terms will become ambiguous...)

pra-dan commented 4 years ago

In response to the statement by @matthijskooijman,

"official" terminology is package - platform - core

A good instance of the use-case may be seen in issue #252

cmaglie commented 4 years ago

Let me recap the glossary with a bit of schematization.

To uniquely identify a board the official way is the FQBN, for example the Arduino UNO board is arduino:avr:uno. In the FQBN arduino:avr:uno:

Inside the Platform there is a boards.txt definitions file that specifies, for each board, a build.core property that tells which Core to use for that particular Board. For example uno.build.core=arduino, in this case:

So in conclusion, we have that:

Just to give some examples of the above:

now, given the above, I think we can just use the term "Platform" without ambiguities.

The cons that I can see is are that:

matthijskooijman commented 4 years ago

Great summary. Some more additions:

cmaglie commented 4 years ago

Let me clarify a bit: I suggested to change the cli command and to start using the correct terms in the documentation / discussions and nothing else :-) so the GUI of the various IDE will remain the same.

We need to take apart users from developers I think:

pra-dan commented 4 years ago

With the user and developer point of view considered, what else can we expect out of this thread/discussion ? Is there any scope for more?

alranel commented 4 years ago

So, according to what @cmaglie says, we should rename the ArduinoCore-* repositories to ArduinoPlatform-*.

E.g. the ArduinoCore-samd repository is actually a platform, which contains several boards (or, maybe better, board definitions?) and one core (arduino) referenced by such board definitions. I'm really concerned about clarity and cleanness because that impacts the overall feeling beyond functionality.

(To my taste, platform is a very generic word that may sound vague in some contexts. Arduino in its entirety is known as a development platform :) Ideally we would use something like platform package or platform implementation whenever possible in documentation. For the same reason, I'd suggest board definition.)

Let's try to draft definitions to see whether we're all on the same track:

Basically I would hide core as much as possible, except when describing the internals of a platform. Regarding package, I would replace it as much as possible with vendor which is more clear (also because as @matthijskooijman was saying, that's not the installation unit).

How does this sound to you?

matthijskooijman commented 4 years ago

(To my taste, platform is a very generic word that may sound vague in some contexts. Arduino in its entirety is known as a development platform :) Ideally we would use something like platform package or platform implementation whenever possible in documentation. For the same reason, I'd suggest board definition.)

I guess that in "arduino:avr:arduino", "avr" is actually the platform, while "arduino:avr" (or really the ArduinoCoreAVR repo) would be the "Platform implementation" (or "Arduino implementation by "arduino" for the platform "avr").

Regarding package, I would replace it as much as possible with vendor which is more clear (also because as @matthijskooijman was saying, that's not the installation unit).

But "package" and "vendor" are different things? I can't say "I'll install the Arduino AVR vendor", right (but I can say "install the Arduino AVR package")?

and usually groups boards based on the same CPU architecture although any grouping criteria can be used by vendors.

Other grouping can be used, but the second level is not completely free-form, but actually expected to be the "architecture" (aka platform), i.e. it can be specified in a list of supported architectures in a library and when creating derived cores/platforms, this value should match the parent platform exactly.

Let's try to draft definitions to see whether we're all on the same track:

Your definitions seem ok to me.

matthijskooijman commented 4 years ago

(To my taste, platform is a very generic word that may sound vague in some contexts. Arduino in its entirety is known as a development platform :) Ideally we would use something like platform package or platform implementation whenever possible in documentation. For the same reason, I'd suggest board definition.)

I guess that in "arduino:avr:arduino", "avr" is actually the platform, while "arduino:avr" (or really the ArduinoCoreAVR repo) would be the "Platform implementation" (or "Arduino implementation by "arduino" for the platform "avr").

Regarding package, I would replace it as much as possible with vendor which is more clear (also because as @matthijskooijman was saying, that's not the installation unit).

But "package" and "vendor" are different things? I can't say "I'll install the Arduino AVR vendor", right (but I can say "install the Arduino AVR package")?

and usually groups boards based on the same CPU architecture although any grouping criteria can be used by vendors.

Other grouping can be used, but the second level is not completely free-form, but actually expected to be the "architecture" (aka platform), i.e. it can be specified in a list of supported architectures in a library and when creating derived cores/platforms, this value should match the parent platform exactly.

Let's try to draft definitions to see whether we're all on the same track:

Your definitions seem ok to me.

per1234 commented 4 years ago

A platform package or platform implementation (sometimes referred to as Board Support Package)

Please, let's only have one single term.There is no benefit to having three new terms. My preference is "boards platform". I have been finding that this works well in practice. For example:

This is defined in the Arduino AVR Boards platform

The commonly used platform names often end in "boards", so the "boards platform" term evolved naturally from that.

But I'm happy with anything other than "core".

Adafruit uses "Board Support Package", but my research indicated that the original meaning of "Board Support Package" is not quite the same as an Arduino boards platform.

The core names are scoped locally within each platform and they are not supposed to be referenced anywhere outside it.

Almost certainly irrelevant to this discussion, but core libraries can be referenced by other platforms: https://arduino.github.io/arduino-cli/dev/platform-specification/#core-reference

Basically I would hide core as much as possible, except when describing the internals of a platform.

My suggestion is that we augment the term to help differentiate the new specific usage of the term "core" from the old ambiguous use of it, and never again use the term "core" alone. Something like "core library".

WestfW commented 3 years ago

I guess there are no platforms that ship a core but define no boards

I'm late, but I'd argue that the popular MCUDude and SpenceKonde "cores" (MegaCore, ATtinycore, etc) do not define "boards." (they have boards.txt entries, but they're mostly for generic pinouts of individual CHIPs rather than productized boards.)