|
4 | 4 | [](https://codecov.io/gh/arduino/ArduinoCore-API)
|
5 | 5 | [](https://github.com/arduino/ArduinoCore-API/actions/workflows/spell-check.yml)
|
6 | 6 |
|
7 |
| -This repository hosts the hardware independent layer of Arduino core. |
| 7 | +This repository hosts the hardware independent layer of Arduino core. In other words it contains the abstract definition of the Arduino core API, consisting of hardware-independent header files that are then included and implemented by the various platform-specific cores. |
8 | 8 |
|
9 |
| -All Arduino official cores are being ported to the new structure so they take advantage of this single repo. |
| 9 | +Having a single place where the Arduino API is defined means that there is no longer a String implementation within every Arduino core (a String module within ArduinoCore-avr, a String module within ArduinoCore-samd, a String module within ArduinoCore-megaavr …) but rather one String implementation within ArduinoCore-API which all other cores utilise. This has the pleasant side effects that bugs fixed or features added within the ArduinoCore-API String implementation are automatically propagated to all cores utilizing ArduinoCore-API. |
10 | 10 |
|
11 |
| -Including this repo in your existing Arduino core will allow the language to grow and include new features. |
12 |
| -For backwards compatibility, every revision of this repo will increase the `ARDUINO_API_VERSION` define. |
| 11 | +As of now, the following official cores are utilising ArduinoCore-API: |
13 | 12 |
|
14 |
| -Some cores have been ported to the new structure, for example: |
15 |
| -* megaAVR (https://github.com/arduino/ArduinoCore-megaAVR) |
16 |
| -* nRF52-mbedos (https://github.com/arduino/ArduinoCore-nRF528x-mbedos) |
17 |
| -* classic AVR (https://github.com/arduino/ArduinoCore-avr/tree/api) |
18 |
| -* SAMD (https://github.com/arduino/ArduinoCore-samd/tree/api) |
| 13 | +* [megaavr](https://github.com/arduino/ArduinoCore-megaAVR) |
| 14 | +* [mbed](https://github.com/arduino/ArduinoCore-mbed) |
| 15 | +* [samd](https://github.com/arduino/ArduinoCore-samd) |
19 | 16 |
|
20 |
| -These repositories **don't** contain the needed `api` subfolder; to "complete" the core you need to copy or symlink the `api` folder from this repo to the target's `cores/arduino` folder. |
| 17 | +There's an ongoing effort to port the others, while maintainers of third-party cores are strongly invited to follow the same route in order to stay up-to-date with the new language features. For backwards compatibility, every revision of this repo will increase the `ARDUINO_API_VERSION` define. |
21 | 18 |
|
22 |
| -### Porting tips |
| 19 | +## Documentation |
23 | 20 |
|
24 |
| -In the future, core APIs will be updated independently from the core, so all the compatible cores will seamlessly adopt new features. |
25 |
| -This requires support from all the IDEs, so in the meantime we suggest to release the core by copying a snapshot of this `api` folder. |
| 21 | +The Arduino API is documented in the official [language reference](https://www.arduino.cc/reference/en/), whose sources are located in [this repository](https://github.com/arduino/reference-en) and are open to contributions from the community. |
26 | 22 |
|
27 |
| -The most elegant and effective solution is to develop the core with `api` symlinked and produce the distributable archive by telling `tar` to follow symlinks. |
28 |
| -Example command: |
| 23 | +## Support |
| 24 | + |
| 25 | +This repository is not directly usable by final users. If you need assistance with Arduino, see the [Help Center](https://support.arduino.cc/) and browse the [forum](https://forum.arduino.cc). |
| 26 | + |
| 27 | +## Development |
| 28 | + |
| 29 | +### Bugs & Issues |
| 30 | + |
| 31 | +If you want to report an issue with this core, you can submit it to the [issue tracker](https://github.com/arduino/ArduinoCore-API/issues) of this repository. Some rules apply: |
| 32 | + |
| 33 | +* If your issue is about a specific hardware platform, report it to its repository. This one is only about discussing the generic API. |
| 34 | +* Before posting, please check if the same problem has been already reported by someone else to avoid duplicates. |
| 35 | +* Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board. |
| 36 | + |
| 37 | +### Contributions |
| 38 | + |
| 39 | +Contributions are always welcome! You can submit them directly to this repository as Pull Requests. Please provide a detailed description of the problem you're trying to solve. We also appreciate any help in testing issues and patches contributed by other users. |
| 40 | + |
| 41 | +### Unit testing |
| 42 | + |
| 43 | +This repository includes a test suite that covers most of the API and that is designed to run on generic hardware, thus not requiring a development board. We call this _host-based unit-testing_. In order to test the features that are only defined but not implemented in this repository, mock implementations are included. |
| 44 | + |
| 45 | +Please help us improve the coverage of the test suite! |
| 46 | + |
| 47 | +#### To build and run unit tests |
| 48 | + |
| 49 | +The unit tests are automatically built by GitHub as part of pull request checks (in `.github/workflows/unit-tests.yml`). |
| 50 | + |
| 51 | +To build and run locally: |
| 52 | + |
| 53 | +**Dependencies** |
| 54 | + |
| 55 | +* [CMake](https://cmake.org/) |
| 56 | +* [GCC](https://gcc.gnu.org/) |
| 57 | + |
| 58 | +On (Ubuntu) Linux run: |
| 59 | + |
| 60 | +```bash |
| 61 | +sudo apt-get install build-essential cmake |
29 | 62 | ```
|
| 63 | + |
| 64 | +From the project root: |
| 65 | + |
| 66 | +```bash |
| 67 | +cd test && mkdir build && cd build |
| 68 | +cmake .. |
| 69 | +make && bin/test-ArduinoCore-API |
| 70 | +``` |
| 71 | + |
| 72 | +### Implementing ArduinoCore-API |
| 73 | + |
| 74 | +In order to compile a core which is implementing ArduinoCore-API you'll need to copy/symlink the `api` directory to the target's `cores/arduino` directory as part of your development and release workflow. The most elegant and effective solution is to develop your core with `api` symlinked and produce the distributable archive by telling `tar` to follow symlinks. Example: |
| 75 | + |
| 76 | +```bash |
30 | 77 | tar --exclude='*.git*' -cjhvf $yourcore-$version.tar.bz2 $yourcore/
|
31 | 78 | ```
|
32 | 79 |
|
33 | 80 | Documentation for how to integrate with a Arduino core (which is necessary if you do not download the Arduino core via the Boards Manager) can be found here:
|
34 | 81 | * [ArduinoCore-megaavr](https://github.com/arduino/ArduinoCore-megaavr#developing)
|
35 | 82 | * [ArduinoCore-mbed](https://github.com/arduino/ArduinoCore-mbed#clone-the-repository-in-sketchbookhardwarearduino-git)
|
36 | 83 | * [ArduinoCore-samd](https://github.com/arduino/ArduinoCore-samd/#developing)
|
| 84 | + |
| 85 | +## Donations |
| 86 | + |
| 87 | +This open source code is maintained by Arduino with the help of the community. We invest a considerable amount of time in testing code, optimizing it and introducing new features. Please consider [donating](https://www.arduino.cc/en/donate/) or [sponsoring](https://github.com/sponsors/arduino) to support our work, as well as [buying original Arduino boards](https://store.arduino.cc) which is the best way to make sure our effort can continue in the long term. |
| 88 | + |
| 89 | +## License and credits |
| 90 | + |
| 91 | +This code is licensed under the terms of the GNU LGPL 2.1. If you have questions about licensing please contact us at [[email protected]](mailto:[email protected]). |
| 92 | + |
0 commit comments