Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build
# python
**/__pycache__/
venv/
myenv/

# code-check standards and reports
misra.txt
Expand All @@ -20,3 +21,9 @@ scan-build-reports/
cppcheck_reports/
cppcheck.checkers
err.xml

# Ignore docs build (Sphinx)
docs/build
docs/source/_build
__pycache__/
_build/
56 changes: 7 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,14 @@
# Contributing to XMC for Arduino
First important point: **All Contributions** are welcomed :open_hands:.

Please contribute and raise issues via the [github repository](https://github.com/Infineon/XMC-for-Arduino/tree/master)
Please contribute and raise issues via the [github repository](https://github.com/Infineon/XMC-for-Arduino/tree/master).

## Overview for Contributors

- Start your contribution by creating a [fork](https://github.com/Infineon/XMC-for-Arduino/fork) of this repository
- It's recommended to create a separate branch for your contribution in your fork
- Once your contribution is ready & tested, please create a [Pull Request](https://github.com/Infineon/XMC-for-Arduino/compare) to the master branch
- Once we merged your changes to the master branch, they are automatically included in the next release
- Start your contribution by creating a [fork](https://github.com/Infineon/XMC-for-Arduino/fork) of this repository.
- It's recommended to create a separate branch for your contribution in your fork.
- Once your contribution is ready & tested, please create a [Pull Request](https://github.com/Infineon/XMC-for-Arduino/compare) to the master branch. We have some automated tests, so make sure you've browsed our [CODE CONVENTION](CODE_CONVENTION.md) and [development instructions](https://xmc-arduino.readthedocs.io/en/latest/development-instructions.html)
- Once we merged your changes to the master branch, they are automatically included in the next release.

## Install the BSP under development (on Windows)
Clone the repository in Arduino folder:
- Open Arduino and install any version of this project as described [here](https://xmc-arduino.readthedocs.io/en/latest/installation-instructions.html).
- Open the installation location in your Arduino program folder, e.g.
`C:\Users\<username>\AppData\Local\Arduino15\packages\Infineon\hardware\xmc`
- Open git bash, type command:
`git clone <your-xmc-for-arduino-fork> <version>`

This allows quick testing of local changes during development.

[!TIP]
If you encounter strange behavior with Arduino IDE during development, try cleaning up the cache:
* Windows: `C:\User\"username"\AppData\Roaming\arduino-ide`
* Linux: `~/.config/arduino-ide`
* macOS: `~/Library/Application Support/arduino-ide/`

## Automated Build Checks

Currently a Github workflow is used for automatic compilation checking and releasing. Workflows are defined [here](https://github.com/Infineon/XMC-for-Arduino/tree/master/.github/workflows).
Before opening a Pull Request for your contribution, please add a git tag in the format `Vx.y.z` (e.g. V3.3.0) to trigger the release process in your fork and pass the compilation tests.

## Creating and Maintaining Third Party Libraries
### Basics
The Arduino IDE allows for external libraries to be added to support specific devices and functions which are not part of the core setup. For details on creating libraries see the
[Arduino library specifications](https://arduino.github.io/arduino-cli/library-specification/). If you add additional libraries to this project, make sure to [document them](https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html) accordingly.

### XMC-for-Arduino Configuration
To ensure that a library specific to one architecture or board type is only compiled when a supporting board is set up, this specification includes a setting for *architecture* in the *library.properties* file.

When creating or maintaining third party or external libraries for XMC-for-Arduino please use this setting:
~~~
architecture=xmc
~~~

If your library also supports other boards and architectures, add those in as well.

## Validation test
To test the XMC4arduino, we used unity to test some of the features of the arduino core & builtin library.

Tests are located in tests/arduino-core-tests and included as submodule in this project. Run `git submodule update --init --recursive` to update them. If you are nor familiar with submodules, check out: https://git-scm.com/book/en/v2/Git-Tools-Submodules

## Code checks (WIP)
Refer to libraries\CAN\Makefile.codecheck
* Regarding formatting, we currently use [pre-commit](https://pre-commit.com/) to automatically run clang-formatting to format all c/c++ code. Please install this python package, and follow the quick start (the pre-commit configuration file is already there). You should be able to format your code automatically on git commit!
## Development
Please check [development instructions](https://xmc-arduino.readthedocs.io/en/latest/development-instructions.html) section in our documentation for more information on how to set up your development enviroment and start developing XMC4Arduino!
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

extensions = [
# 'sphinx.ext.autodoc',
# 'sphinxemoji.sphinxemoji',
# 'sphinx_tabs.tabs',
'sphinxemoji.sphinxemoji',
'sphinx_tabs.tabs',
# 'sphinx.ext.intersphinx',
# 'sphinx.ext.autosectionlabel',
# 'sphinx.ext.todo',
Expand Down
150 changes: 150 additions & 0 deletions docs/development-instructions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
Development Instructions
=========================

..
TODOS:
- Code conventions
- Tools installation:
- test
- doc
- code check
- ...

.. _env_dev_setup:

Environment Setup
------------------

#. Pre-conditions:

* Install `Arduino IDE (2.0 or higher) <https://docs.arduino.cc/software/ide-v2/tutorials/getting-started/ide-v2-downloading-and-installing/>`_
* Or Install `Arduino CLI (1.0.0 or higher) <https://arduino.github.io/arduino-cli/latest/installation/>`_
* Python

#. Create a ``<SKETCHBOOK>/hardware/arduino-git`` folder. Where ``<SKETCHBOOK>`` is the location of your Arduino sketchbook. The ``<SKETCHBOOK>`` default is OS-dependent:

.. tabs::

.. group-tab:: Linux

::

{HOME}/Arduino

.. group-tab:: Windows

::

{DOCUMENTS}/Arduino

.. group-tab:: MacOS

::

{HOME}/Documents/Arduino


#. Clone this repo in ``<SKETCHBOOK>/hardware/arduino-git``:
::

git clone https://github.com/Infineon/XMC-for-Arduino.git xmc

This allows quick testing of local changes during development while keeping the released version.

#. You can check if the correct version is installed by running:
::

arduino-cli core list

You should be able to see the ``arduino-git:xmc core``.

#. Update all submodule included in this project:
::

git submodule update --init --recursive

If you are not familiar with git submodules, check out `Git-Tools-Submodules <https://git-scm.com/book/en/v2/Git-Tools-Submodules>`_

#. Start developing |:tools:|!

|:bell:|
If you encounter strange behavior with Arduino IDE during development, try cleaning up the Arduino IDE's cache:

.. tabs::

.. group-tab:: Windows

.. code-block:: text

%AppData%\arduino-ide

.. group-tab:: Linux

::

~/.config/arduino-ide

.. group-tab:: macOS

::

~/Library/Application Support/arduino-ide/

Code Check and Tests
----------------------

Pre-commit Hooks
^^^^^^^^^^^^^^^^^^
For the C/C++ code format and commit message format, we add git hooks to check it automatically.

For ease of use, we currently use `pre-commit <https://pre-commit.com/>`_ to automatically run clang-formatting to format all C/C++ code.
Please install this Python package, and follow the quick start (the pre-commit configuration file is already there). You should be able to format your code automatically on git commit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Python package? 😄


We also have workflow to for auto-checking, so please refer to code convention before committing your code.

Code Check
^^^^^^^^^^^^
.. warning::

Code Checks are still a work in progress in this project.

If you are developing a new built-in library, please refer to ``libraries\CAN\Makefile.codecheck`` using cppcheck for static code analysis to ensure code quality.

Automated Build Checks
^^^^^^^^^^^^^^^^^^^^^^^^
Currently a GitHub Action workflow is used for automatic compilation checking.
Workflows are defined `here <https://github.com/Infineon/XMC-for-Arduino/blob/master/.github/workflows/compile-platform-examples.yml>`_.

Validation Test
^^^^^^^^^^^^^^^^
To validate the XMC-for-Arduino, we utilize Unity for testing various features of the Arduino core and built-in libraries.

Tests are located in ``tests/arduino-core-tests`` and included as submodule in this project. Run ``git submodule update --init --recursive`` to update them.

If you need to run these tests locally, you'll also need to download `GNU Make <https://www.gnu.org/software/make/#download>`_ .

Release
---------
Add a git tag in the format `Vx.y.z` (e.g. V3.3.0) to trigger the release process.


Creating and Maintaining Third Party Libraries
------------------------------------------------
Basics
^^^^^^^^
The Arduino IDE allows for external libraries to be added to support specific devices and functions which are not part of the core setup. For details on creating libraries see the
`Arduino library specification <https://arduino.github.io/arduino-cli/library-specification/>`_.

If you add additional libraries to this project, make sure to `document them <https://xmc-arduino.readthedocs.io/en/latest/builtin-libraries.html>`_ accordingly.

XMC-for-Arduino Configuration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To ensure that a library specific to one architecture or board type is only compiled when a supporting board is set up, this specification includes a setting for *architecture* in the *library.properties* file.

When creating or maintaining third party or external libraries for XMC-for-Arduino please use this setting:

.. code-block:: text

architecture=xmc

If your library also supports other boards and architectures, add those in as well.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ advantage of the advanced features and performance offered by XMC microcontrolle

Introduction<self>
installation-instructions
development-instructions
hw-platforms
builtin-libraries
arduino-deviations
Expand Down
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This is a list of python packages used to generate documentation. This file is used with pip:
# pip install --user -r requirements.txt
#
sphinx>=7.2.6
sphinx-tabs
sphinxemoji
Expand Down
28 changes: 0 additions & 28 deletions tests/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions tools/dev-setup.sh

This file was deleted.

Loading