This document provides a synopsis and loose guidelines for how to contribute to this project. It is a work in progress. Maintainers should expand this document.
This repository includes an opinionated clang-format
specification to ensure that we maintain a common code style. For convenience, a pre-commit hook is also provided in .githooks
which will run clang-format
against any staged changes prior to executing a commit.
clang-format@17
or newer
To set up the pre-commit hook:
git config --local core.hooksPath .githooks/
To run the formatter on the full source tree:
./format.sh
clang-format does not recognize the syntax for inline asm that is required by mwccarm, so it should be disabled for non-matching functions specifically. clang-format accepts directives via comments of the form // clang-format [on|off]
. Example:
#ifdef NONMATCHING
void func() {
// ...
}
#else
// clang-format off
asm void func() {
push {lr}
// ...
pop {pc}
}
// clang-format on
#endif // NONMATCHING