You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 76602b0
Browse filesBrowse the repository at this point in the historyBrowse files
docs: add Doxygen API reference to the versioned documentation site
Generate the Doxygen API reference of the core and publish it with each
documentation version, so it is available at /dev/doxygen/,
/latest/doxygen/ and /<X.Y.Z>/doxygen/.
- Add doxygen/Doxyfile covering cores, libraries, system and variants,
excluding cores/arduino/api, system/Drivers and system/Middlewares.
Source listings are disabled to keep each published version small.
__cplusplus and the HAL module macros used as guards are predefined so
that classes such as HardwareTimer are documented.
- Add an HTML header and version-selector.js: every Doxygen page links
back to the documentation home of the same version and provides a
version selector (dev, latest, releases) fed by the mike versions.json.
When a page does not exist in the selected version, it falls back to
the Doxygen home page, then to the documentation home page.
- Add docs/hooks/doxygen.py, a MkDocs hook adding the Doxygen output to
the site, or a placeholder page when it is absent so that documentation
only builds still pass mkdocs build --strict.
- Build the Doxygen output in docs-check.yml and publish-docs.yml before
MkDocs, check that it is part of the site, and also trigger both
workflows on changes to the documented sources.
- Ignore doxygen/** in the Arduino, CMake and PlatformIO build workflows.
- Link the reference from API.md, the home page, the Core Reference
navigation and README.md.
- Document the Doxygen generation, publication and version selector in
Documentation-workflow.md.
- Restrict the release tag pattern to a major version below 1000 in
publish-docs.yml (tag validation and "latest" computation) and in the
supported boards generator. The legacy date tags 2017.8.31 to
2018.1.18 matched X.Y.Z and were seen as the highest tag, so "latest"
and the site default would never have moved to a new release.
- Document in Documentation-workflow.md how the supported boards
"Next release" labels are resolved from the release tags, and that
docs/supported-boards/index.md must be regenerated and committed after
a release tag.
Assisted-by: GitHub Copilot: Claude Sonnet 5.5
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Copy file name to clipboardExpand all lines: docs/API.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,9 @@
5
5
6
6
This page documents STM32-specific additions and extensions. For the standard Arduino API, see the [Arduino language reference](https://docs.arduino.cc/language-reference/) and the [ArduinoCore-API documentation](https://github.com/arduino/ArduinoCore-API).
7
7
8
+
> [!TIP]
9
+
> The source-level reference of the core, generated with Doxygen from the code comments (classes, structures, functions and their parameters), is available in the [Doxygen API reference](doxygen/index.html). It follows the documentation version selected in this site: use the version selector to switch between `dev` and the released versions.
Copy file name to clipboardExpand all lines: docs/development/Documentation-workflow.md
+68-6Lines changed: 68 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ The STM32 core documentation is maintained in the `docs/` directory of the `stm3
8
8
2. Add new pages to the `nav` section in `mkdocs.yml`. The navigation is explicit, so a file that is not listed there will not appear in the sidebar.
9
9
3. Use relative links to other Markdown files and verify that image paths resolve from the page containing them.
10
10
4. The [Supported boards](../supported-boards/index.md) page is generated from `boards.txt`: do not edit it. After changing `boards.txt`, run `python docs/hooks/supported_boards.py` (or any MkDocs build) and commit the updated `docs/supported-boards/index.md`; the documentation check fails if it is out of date. Optional `# Docs: field=value` comments placed directly above a board option (`<group>.menu.pnum.<option>=...`) add metadata: `release`, `mcu`, `url` and `notes`; above a `<group>.name=` line, `url` links the category. Options without `release` get their first release from Git tags, so keep full Git history and tags available when building the documentation.
11
-
5. Create a persistent virtual environment under your home directory once, then install or update the documentation dependencies from the core repository:
11
+
5. The [Doxygen API reference](#doxygen-api-reference) is generated from the comments in the source code: to change it, edit the comments in the sources, not the documentation pages. Documentation-only builds work without Doxygen installed.
12
+
6. Create a persistent virtual environment under your home directory once, then install or update the documentation dependencies from the core repository:
12
13
13
14
```bash
14
15
python3 -m venv "$HOME/.venvs/stm32duino-docs"
@@ -39,18 +40,79 @@ Open `http://127.0.0.1:8000/dev/`. This exercises links under the `/dev/` prefix
39
40
40
41
The static preview tests the selected version's files and paths, not Mike's deployed version list or redirects. To inspect the actual locally deployed versions and default redirect, use `mike serve` from a checkout whose configured `gh-pages` branch already contains those deployments.
41
42
43
+
## Doxygen API reference
44
+
45
+
The source-level API reference (classes, structures, functions and their parameters of the core, its libraries, the STM32 system files and the variants) is generated with [Doxygen](https://www.doxygen.nl/) from the comments in the source code. It is not written by hand: improve it by editing the Doxygen comments in the sources, not the generated pages.
46
+
47
+
The reference is part of the versioned site and is published at `/<version>/doxygen/`, for example `/dev/doxygen/` or `/latest/doxygen/`. It is linked from the [Arduino API](../API.md) page, from the home page, and from the **Core Reference** section of the navigation.
|`doxygen/mainpage.md`| Main page of the reference. |
55
+
|`doxygen/html-header.html`| HTML header template: link back to the documentation site and version selector. |
56
+
|`doxygen/version-selector.js`| Version selector: lists the versions from the Mike `versions.json` file of the site. |
57
+
|`docs/hooks/doxygen.py`| MkDocs hook that adds the generated Doxygen pages to the site under the same version prefix. |
58
+
59
+
### Comment conventions
60
+
61
+
- API contracts (`@brief`, `@param`, `@return`, `@note`) are written in the header files. Do not duplicate them in the source file.
62
+
- Static and source-only functions are documented directly above their definition in the `.c`/`.cpp` file.
63
+
- The ST HAL, LL and CMSIS drivers (`system/Drivers`), the middlewares (`system/Middlewares`) and `cores/arduino/api` (ArduinoCore-API) are excluded from the reference.
64
+
- Only documented items are listed (`EXTRACT_ALL = NO`).
65
+
- Code under a guard such as `HAL_TIM_MODULE_ENABLED` is only documented if the macro is listed in `PREDEFINED` in `doxygen/Doxyfile`. Add the macro there when a new guard hides documented code.
66
+
- Source listings are not generated, to keep every published version small; the reference links to the declarations, and the sources are on GitHub.
67
+
68
+
### Build locally
69
+
70
+
Install Doxygen 1.9.8 or later (`sudo apt-get install doxygen` on Debian/Ubuntu), then run, from the repository root:
The HTML pages are written to `build/doxygen/`, which is ignored by Git. Open `build/doxygen/index.html` to review them. Doxygen warnings are printed on the standard error: fix those that concern the comments you changed.
77
+
78
+
To check the reference inside the documentation site, run the Doxygen command above first, then build or serve the site as described in [Update documentation](#update-documentation) and [Preview locally](#preview-locally). When `build/doxygen/` exists, MkDocs adds its pages to the site at `doxygen/`. When it does not, MkDocs adds a placeholder `doxygen/index.html` page, so documentation-only builds, including `mkdocs build --strict`, work without Doxygen installed; the workflows never publish the placeholder because they build the real reference first.
79
+
80
+
### Version selector
81
+
82
+
Every Doxygen page shows a **← STM32duino documentation** link, which goes to the home page of the same documentation version, and a **Version** selector. The selector lists the versions published by Mike (`dev`, `latest` and each release) and opens the same page in the selected version. If that page does not exist in the selected version, for example because the version was published before the reference was added or the page was renamed, it opens the Doxygen home page of that version, and then the documentation home page of that version.
83
+
84
+
The selector reads `versions.json` from the site root, so it only appears on a published site or on a preview that contains it. A preview built with `mkdocs build --site-dir /tmp/stm32duino-docs-preview/dev` has no `versions.json`: the selector is hidden, the link back still works.
85
+
86
+
### Maintenance
87
+
88
+
-`doxygen/html-header.html` is based on the default header of Doxygen 1.9.8 (`doxygen -w html header.html footer.html style.css`). When the Doxygen version used by the workflows changes, regenerate the default header, reapply the two additions (the `version-selector.js` script and the `doc-nav` cell with the link and the selector) and check the pages again.
89
+
- The Doxygen version is the one installed from the `ubuntu-latest` runner image by the workflows.
90
+
42
91
## Pull request checks
43
92
44
-
The `Documentation build` workflow runs `mkdocs build --strict` on every pull request, including pull requests that do not edit documentation. It also runs on `main` when documentation sources, the MkDocs configuration, its dependencies, or the workflow change. The `main` branch requires the `Documentation build / build` status check, including for administrators, so a failed or missing result blocks merging.
93
+
The `Documentation build` workflow installs Doxygen, builds the API reference, runs `mkdocs build --strict` and fails if the reference is not part of the generated site. It runs on every pull request, including pull requests that do not edit documentation. It also runs on `main` when documentation sources, the Doxygen configuration, the MkDocs configuration, its dependencies, the workflow, or the sources documented by Doxygen (`cores/`, `libraries/`, `variants/`, `system/` except `Drivers/` and `Middlewares/`) change. The `main` branch requires the `Documentation build / build` status check, including for administrators, so a failed or missing result blocks merging.
94
+
95
+
Doxygen warnings do not fail the check, but they are visible in the log of the `Build Doxygen API reference` step.
45
96
46
97
If branch protection for `main` is recreated or changed, keep `Documentation build / build` as a required status check.
47
98
48
99
## Publish a release
49
100
50
-
The documentation publisher uses Mike to keep versioned snapshots on the `gh-pages` branch of `stm32duino/stm32duino.github.io`:
101
+
The documentation publisher uses Mike to keep versioned snapshots on the `gh-pages` branch of `stm32duino/stm32duino.github.io`. Before running Mike, the workflow installs Doxygen and builds the API reference, so each snapshot contains the Doxygen pages generated from the sources of the commit or tag being published:
51
102
52
-
- Documentation changes merged to `main` publish the development version at `/dev/`. The first publish sets `dev` as the site default; later development publishes leave the existing default unchanged.
53
-
- Pushing an exact semantic-version tag such as `3.0.0` publishes that release at `/3.0.0/`.
103
+
- Documentation or documented-source changes merged to `main` publish the development version at `/dev/` (documentation at `/dev/`, API reference at `/dev/doxygen/`). The first publish sets `dev` as the site default; later development publishes leave the existing default unchanged.
104
+
- Pushing an exact semantic-version tag such as `3.0.0` publishes that release at `/3.0.0/` (API reference at `/3.0.0/doxygen/`).
54
105
- When the pushed tag is the highest semantic-version tag in the core repository, the workflow also moves the `latest` alias and sets it as the site default. Older release tags are published without changing `latest`.
55
106
56
-
Use the normal core release process to create and push the release tag. The documentation workflow runs from that tag automatically; no manual Mike command is needed. GitHub release tags must use the exact `MAJOR.MINOR.PATCH` form for this workflow.
107
+
Use the normal core release process to create and push the release tag. The documentation workflow runs from that tag automatically; no manual Mike command is needed. GitHub release tags must use the exact `MAJOR.MINOR.PATCH` form, with a major version below 1000, for this workflow. The legacy date tags such as `2018.1.18` are not release tags: they are ignored when the highest release is computed, so they never prevent `latest` from moving, and a new tag in that form is rejected.
108
+
109
+
Releases published before the Doxygen reference was added do not contain it; the version selector falls back to the documentation home page of those versions.
110
+
111
+
### Supported boards after a release
112
+
113
+
The **First release** column of the [Supported boards](../supported-boards/index.md) page is computed from the Git tags each time the documentation is built. A board that is in `boards.txt` but in no release tag yet shows **Next release**.
114
+
115
+
- The workflow builds from the release tag, which is fetched with the full history, so the `/<X.Y.Z>/` documentation published for the tag already shows the new release number for the boards it contains. Pages of older versions are not rebuilt and keep their labels.
116
+
- The generated `docs/supported-boards/index.md` committed on `main` is not updated by the workflow. Once the tag exists, it differs from a fresh build, so the `Documentation build` check fails on the next pull request until it is regenerated. After pushing a release tag, run `python docs/hooks/supported_boards.py` from a clone that has the tags (`git fetch --tags`) and commit `docs/supported-boards/index.md`.
117
+
- The `dev` documentation shows the new release numbers at its next publish.
118
+
- To pin a different value for a board, add a `# Docs: release=<version>` comment above its option in `boards.txt`.
0 commit comments