Is Mbed (or ARM) enforcing a standard to use pin name aliases like I2C_SDA and I2C_SCL in the board support package for the Mbed enabled boards?
Does the use of these aliases in the Mbed official documentation for I2C: https://os.mbed.com/docs/mbed-os/v5.14/apis/i2c.html, prove that this is a standard to follow or was it simply used to show a use-case?
Yes, mbed enabled platforms should define these pin aliases. However, some platforms may not support a specific function and that means that an example program may behave differently. You will see that with the signaling LEDs: some platforms have only one LED, so the predefined names LED1, LED2, LED3, LED4 are all mapped onto the same LED pin.
Does ARM or Mbed enforce this standard on all boards? For example, if an Mbed enabled board does have Arduino headers, does ARM mandate its Board Partners to define the I2C pins as I2C_SDA and I2C_SCL in its PinNames.h file? What is the convention for SPI pins?
If this is not mandated, then the examples in documentation, I assume, are based on the use-case.
At this time, there isn’t a hard standard for pin name definitions. I have heard that this may be coming as part of Mbed OS 6 when it arrives next year. For now, there are very common pin names in use for I2C and SPI default interfaces.
I used grep to count the number of occurrences of these common pin names in the mbed-os library. (example: grep -roh SPI_MOSI . | wc -w). Here are the results.
These seem to be the most common, at least with the popular targets I looked at.
I do see this shows up a lot.