stm32-installer 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. stm32_installer-1.1.1/LICENSE +201 -0
  2. stm32_installer-1.1.1/PKG-INFO +340 -0
  3. stm32_installer-1.1.1/README.md +322 -0
  4. stm32_installer-1.1.1/pyproject.toml +42 -0
  5. stm32_installer-1.1.1/setup.cfg +4 -0
  6. stm32_installer-1.1.1/src/stm32_installer/__init__.py +33 -0
  7. stm32_installer-1.1.1/src/stm32_installer/__main__.py +8 -0
  8. stm32_installer-1.1.1/src/stm32_installer/checks.py +218 -0
  9. stm32_installer-1.1.1/src/stm32_installer/cli.py +469 -0
  10. stm32_installer-1.1.1/src/stm32_installer/console.py +132 -0
  11. stm32_installer-1.1.1/src/stm32_installer/download.py +271 -0
  12. stm32_installer-1.1.1/src/stm32_installer/ide/__init__.py +76 -0
  13. stm32_installer-1.1.1/src/stm32_installer/ide/base.py +202 -0
  14. stm32_installer-1.1.1/src/stm32_installer/ide/cmake.py +241 -0
  15. stm32_installer-1.1.1/src/stm32_installer/ide/cubeide.py +206 -0
  16. stm32_installer-1.1.1/src/stm32_installer/ide/iar.py +297 -0
  17. stm32_installer-1.1.1/src/stm32_installer/ide/keil.py +211 -0
  18. stm32_installer-1.1.1/src/stm32_installer/installer.py +296 -0
  19. stm32_installer-1.1.1/src/stm32_installer/manifest.py +588 -0
  20. stm32_installer-1.1.1/src/stm32_installer/yamlreader.py +301 -0
  21. stm32_installer-1.1.1/src/stm32_installer.egg-info/PKG-INFO +340 -0
  22. stm32_installer-1.1.1/src/stm32_installer.egg-info/SOURCES.txt +32 -0
  23. stm32_installer-1.1.1/src/stm32_installer.egg-info/dependency_links.txt +1 -0
  24. stm32_installer-1.1.1/src/stm32_installer.egg-info/entry_points.txt +2 -0
  25. stm32_installer-1.1.1/src/stm32_installer.egg-info/top_level.txt +1 -0
  26. stm32_installer-1.1.1/test/test_bootstrap.py +75 -0
  27. stm32_installer-1.1.1/test/test_checks.py +119 -0
  28. stm32_installer-1.1.1/test/test_cli.py +346 -0
  29. stm32_installer-1.1.1/test/test_ide.py +808 -0
  30. stm32_installer-1.1.1/test/test_installer.py +193 -0
  31. stm32_installer-1.1.1/test/test_manifest.py +256 -0
  32. stm32_installer-1.1.1/test/test_packaging.py +26 -0
  33. stm32_installer-1.1.1/test/test_versions.py +164 -0
  34. stm32_installer-1.1.1/test/test_yamlreader.py +168 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: stm32-installer
3
+ Version: 1.1.1
4
+ Summary: Install NimaLTD embedded C libraries into an STM32 project
5
+ Author-email: "Nima Askari (NimaLTD)" <nima.askari@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/nimaltd/stm32-installer
8
+ Project-URL: Issues, https://github.com/nimaltd/stm32-installer/issues
9
+ Keywords: stm32,embedded,installer,cubeide,nimaltd
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Software Development :: Embedded Systems
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # stm32-installer
20
+
21
+ Installs [NimaLTD](https://github.com/nimaltd) embedded C libraries into an STM32 project.
22
+
23
+ Copying two files into a project is easy. Doing it so the build actually picks them up, without clobbering the settings you changed last month, is the part this handles.
24
+
25
+ Every command below uses `example` as the library name. Put the real one in its place.
26
+
27
+ ---
28
+
29
+ ## Installing a library
30
+
31
+ There are three ways to run it. They all do the same thing, and they all take the same arguments.
32
+
33
+ ### With pip
34
+
35
+ Install the installer once. This needs internet:
36
+
37
+ ```bash
38
+ pip install stm32-installer
39
+ ```
40
+
41
+ Then, from the root of your STM32 project:
42
+
43
+ ```bash
44
+ stm32-installer nimaltd/example
45
+ ```
46
+
47
+ To update it later, `pip install --upgrade stm32-installer`. To remove it, `pip uninstall stm32-installer`.
48
+
49
+ A library can need a newer installer than the one you have. It then says so and changes nothing:
50
+
51
+ ```
52
+ Error: This library needs stm32-installer 1.2.0 or newer, and this one is 1.1.1. Nothing was changed.
53
+ Update it with:
54
+ pip install --upgrade stm32-installer
55
+ ```
56
+
57
+ Run without pip, the installer is fetched fresh every time, so it is always the newest.
58
+
59
+ ### Without pip
60
+
61
+ One line, straight from the web. Nothing is installed on your machine, and nothing is saved that you would have to delete afterwards.
62
+
63
+ **Windows, PowerShell:**
64
+
65
+ ```powershell
66
+ irm https://raw.githubusercontent.com/nimaltd/stm32-installer/main/install.py | python - nimaltd/example
67
+ ```
68
+
69
+ **Windows, Command Prompt:**
70
+
71
+ ```bat
72
+ curl -fsSL https://raw.githubusercontent.com/nimaltd/stm32-installer/main/install.py | python - nimaltd/example
73
+ ```
74
+
75
+ **Linux and macOS:**
76
+
77
+ ```bash
78
+ curl -fsSL https://raw.githubusercontent.com/nimaltd/stm32-installer/main/install.py | python3 - nimaltd/example
79
+ ```
80
+
81
+ The installer is fetched into a temporary folder, run, and deleted. Everything after the `-` goes to it, so a zip, a folder and every option below work here exactly as they do with the pip command.
82
+
83
+ PowerShell needs `irm` rather than `curl`, because `curl` there is an alias for a different command that does not understand those options.
84
+
85
+ ### Without internet
86
+
87
+ On any machine that has internet, download two zips, from the green **Code** button, **Download ZIP**: this repository, and the library. Copy both to the machine that has none, then from your project:
88
+
89
+ ```bash
90
+ python stm32-installer-main/install.py D:/Downloads/example-master.zip
91
+ ```
92
+
93
+ `install.py` sees the installer sitting beside it and runs that copy, so it never goes online.
94
+
95
+ pip cannot do this on its own. Even given the zip, it goes online to fetch the tools it builds the package with.
96
+
97
+ ### What to install
98
+
99
+ The one argument can be any of these:
100
+
101
+ | You have | You type |
102
+ |---|---|
103
+ | Nothing yet, and internet | `stm32-installer nimaltd/example` |
104
+ | The library's GitHub address | `stm32-installer https://github.com/nimaltd/example` |
105
+ | The zip from GitHub's **Download ZIP** | `stm32-installer D:/Downloads/example-master.zip` |
106
+ | That zip unpacked, anywhere on disk | `stm32-installer D:/Downloads/example-master` |
107
+ | The library's folder, already inside your project | `stm32-installer example` |
108
+
109
+ A bare name like `example` means `nimaltd/example` on GitHub, unless a folder of that name exists where you run it, in which case the folder is used. A path that does not exist is reported as missing rather than looked up on GitHub, so a typo in `D:/Downloads/...` gets a straight answer.
110
+
111
+ The zip does not need unpacking first. If you did unpack it with Windows' **Extract All**, which puts `example-master` inside another `example-master`, either folder works.
112
+
113
+ ### Options
114
+
115
+ | Option | What it does |
116
+ |---|---|
117
+ | `--ref 2.0.0` | A tag, a branch or a commit to take from GitHub. `master` when not given |
118
+ | `--dir Libs/example` | The folder of your project to install into. Asked for when not given, with the library's name as the answer if you just press Enter |
119
+ | `--project D:/Work/MyBoard` | Your project's root, when you are not running from it |
120
+ | `--ide cubeide` | Register with this IDE only: `cmake`, `cubeide`, `keil` or `iar`. Every one found, when not given |
121
+
122
+ `--ref` holds a project on one release, which is useful when you need exactly what you built with last time:
123
+
124
+ ```bash
125
+ stm32-installer nimaltd/example --ref 2.0.0 # a tag
126
+ stm32-installer nimaltd/example --ref develop # a branch
127
+ stm32-installer nimaltd/example --ref 00949e695e16 # an exact commit
128
+ ```
129
+
130
+ ### Where the files go
131
+
132
+ **From GitHub, from a zip, or from a folder outside your project**, the files the library's `library.yml` lists are copied into a folder of your project. Nothing else comes with them, so the library's tests never reach your build. The zip or folder you gave is left exactly as it was.
133
+
134
+ **A folder already inside your project** becomes the library where it stands. The header and source move to its top, your config file is created, and everything that belongs to the repository rather than your firmware is removed from it, the test folder above all. `--dir` does not apply here, since the folder is already where it is going. Rename it first if you want it called something else.
135
+
136
+ ### The folder question
137
+
138
+ Without `--dir`, you are asked where the library should go:
139
+
140
+ ```
141
+ Folder to install into [example]:
142
+ ```
143
+
144
+ Press Enter for the default. Run the one line way, the question still reaches you: the answer is read from the console, because the installer itself is arriving on the input. In a script or on a build server, where nobody is there to answer, the default is taken without asking, rather than waiting for ever.
145
+
146
+ ### Updating a library
147
+
148
+ Run the same command again. The code is replaced, and your `example_config.h` is kept, because it is yours:
149
+
150
+ ```
151
+ Files
152
+ written example/example.h
153
+ written example/example.c
154
+ kept example/example_config.h not overwritten
155
+
156
+ This was an update. Code replaced, your configuration kept.
157
+ ```
158
+
159
+ ### What you see
160
+
161
+ A first install from a downloaded zip, into a CubeMX project that builds with both CMake and STM32CubeIDE:
162
+
163
+ ```
164
+ Reading example-master.zip ...
165
+
166
+ example 2.0.0
167
+ What this library does, in one line
168
+ middleware / system
169
+
170
+ Files
171
+ written example/example.h
172
+ written example/example.c
173
+ written example/LICENSE.md
174
+ written example/NOTICE
175
+ written example/README.md
176
+ created example/example_config.h yours to edit
177
+
178
+ Project
179
+ updated CMake Added example to CMakeLists.txt, linked to ${CMAKE_PROJECT_NAME}.
180
+ backup: CMakeLists.txt.20260923-193649.bak
181
+ updated STM32CubeIDE Added example to the include path and source folders in .cproject.
182
+ Refresh the project in CubeIDE (F5) so it picks up the new files.
183
+ backup: .cproject.20260923-193649.bak
184
+
185
+ Done. #include "example.h" and you are away.
186
+ ```
187
+
188
+ The first line says where the library came from: `Fetching nimaltd/example ...` from GitHub, `Reading ...` from a zip or a folder. Run without pip, it starts with `Fetching the installer ...` first.
189
+
190
+ ---
191
+
192
+ ## What it does for you
193
+
194
+ **Finds your IDE and wires the library in.** CMake, STM32CubeIDE, Keil MDK and IAR are all handled, and a project can be more than one of them at once.
195
+
196
+ | IDE | What gets changed |
197
+ |---|---|
198
+ | CMake | The library gets its own `CMakeLists.txt`, and two lines are appended to yours |
199
+ | STM32CubeIDE | The include path, and the source folders where the project lists them, in every build configuration of `.cproject` |
200
+ | Keil MDK 5 and 6 | A file group and the include path in `.uvprojx` |
201
+ | IAR EWARM | A file group and the include path in `.ewp` |
202
+
203
+ **Never overwrites your configuration.** `example_config.h` is created once. Reinstall as often as you like: the code is replaced, your settings are not.
204
+
205
+ **Leaves the file looking like you wrote it.** An added line copies the indentation, the line ending and the path separator of the lines around it. These files go into version control, so a correct edit that shows up as a whole file diff is still a bad edit.
206
+
207
+ **Keeps your CMakeLists.txt short.** Your project gets two lines that never change, and the library's file list lives with the library:
208
+
209
+ ```cmake
210
+ # >>> stm32-installer: example >>>
211
+ add_subdirectory(example)
212
+ target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE example_lib)
213
+ # <<< stm32-installer: example <<<
214
+ ```
215
+
216
+ The target is called `example_lib` rather than `example`, because a project is often named after the library being tried out in it and CMake allows only one target per name. The `PRIVATE` keyword is dropped when your project links its libraries without one, since CMake refuses to mix the two forms.
217
+
218
+ The generated `example/CMakeLists.txt` declares an INTERFACE target, not a STATIC one. That matters: an INTERFACE target hands its sources to whoever links it, so they are compiled as part of your application and inherit its defines and include paths. That is what lets a driver's `.c` file find `main.h` and the HAL headers. A STATIC library would not see them and would fail to compile.
219
+
220
+ **Backs up before editing.** Every project file is copied to a timestamped `.bak` first. If the file is not one it recognises, it changes nothing and prints what to click instead.
221
+
222
+ **Edits the project, not a copy of it.** IAR leaves a `Backup of <name>.ewp` beside the real project when it upgrades one, and that copy is a valid project file whose name sorts first. The workspace file is asked which project is the real one, and backups are skipped.
223
+
224
+ **Keeps the repository out of your build.** CubeIDE compiles every `.c` under your project, and a library repository ships a test suite with its own `main()`. Left in place, that breaks your build with an error that points nowhere useful. So only the listed files are copied, and a repository that sits inside your project has everything else removed from it.
225
+
226
+ **Tells you what the library needs.** It reads your `stm32xxxx_hal_conf.h` and `.ioc` and warns before you hit a confusing compile error:
227
+
228
+ ```
229
+ Requirements
230
+ check HAL SPI module is not enabled
231
+ Uncomment HAL_SPI_MODULE_ENABLED in stm32f4xx_hal_conf.h
232
+ ok GPIO is configured
233
+ check This library needs an RTOS and none was found
234
+ It expects freertos. Enable it in CubeMX under Middleware.
235
+ ```
236
+
237
+ It cannot switch a peripheral on for you. The `.ioc` belongs to CubeMX, and editing it behind CubeMX's back goes wrong quietly.
238
+
239
+ ---
240
+
241
+ ## For someone writing a library
242
+
243
+ Put a `library.yml` at the root of the repository.
244
+
245
+ ```yaml
246
+ name: example
247
+ description: What this library does, in one line
248
+ repository: https://github.com/nimaltd/example
249
+ license: Apache-2.0
250
+
251
+ kind: middleware # driver, middleware, rtos, protocol, filesystem, utility, bsp
252
+ category: system # sensor, storage, display, communication, wireless,
253
+ # rtos, timing, power, input, math, system
254
+
255
+ provides: [] # what this gives other libraries. An RTOS says [rtos]
256
+
257
+ requires:
258
+ installer: 1.1.0 # the oldest stm32-installer that reads this file
259
+ libraries: [] # other NimaLTD libraries, by name
260
+ hal: true
261
+ cmsis: true
262
+ rtos: none # none, optional, any, freertos, cmsis-os2, threadx
263
+ hal_modules: [spi] # must be enabled in stm32xxxx_hal_conf.h
264
+ peripherals:
265
+ - type: spi
266
+ count: 1
267
+ note: Master mode, 8 bit
268
+ c_standard: c11
269
+
270
+ install:
271
+ layout: flat # flat (default) puts every file at the top of the
272
+ # folder, so one include path covers the library.
273
+ # mirror keeps the repository's own folders, for a
274
+ # library too big to flatten sensibly.
275
+
276
+ files:
277
+ headers:
278
+ - src/example.h # listed first: the one "#include" is printed for
279
+ - src/port/*.h # a wildcard, matched the way a shell would
280
+ sources:
281
+ - src/example.c
282
+ - from: src/port/spi.c # a file can say exactly where it goes, which
283
+ to: port/spi.c # overrides the layout for that one file
284
+
285
+ once: # copied once, then it belongs to the user
286
+ - from: src/example_config.h
287
+ - from: src/example_port.c # a .c starter works the same way
288
+ to: my_port.c # "to" only when the name should change
289
+
290
+ extras: # copied as they are, no compiling
291
+ - LICENSE.md # LICENSE.md and NOTICE are the default, so this
292
+ - NOTICE # section can be left out entirely
293
+ - README.md
294
+ - docs # a folder, copied whole and keeping its shape
295
+ ```
296
+
297
+ There is no `version` in it. The installer reads the version from the `@version` tag in the file comment of the first header listed, so it is written in the code and nowhere else:
298
+
299
+ ```c
300
+ /**
301
+ * @file example.h
302
+ * @version 2.0.0
303
+ */
304
+ ```
305
+
306
+ `requires.installer` is the oldest stm32-installer that reads the file correctly. It is checked before anything else in the file is read, so when a manifest starts using something only a newer installer understands, raising this makes an older one stop with a message saying to update, rather than read the file wrongly without a word. Write it as three numbers, `1.1.0`: unquoted, YAML reads `1.10` as the decimal number `1.1`, and that is refused.
307
+
308
+ A file listed under `once` is copied only when it is missing, so the user's own edits survive every update. It keeps its own name unless you give it a `to`.
309
+
310
+ The key says what happens rather than what the file is. It is usually a configuration header, but the same rule fits a port layer someone fills in, or a table they tune: anything that is the library's to start and theirs from then on.
311
+
312
+ One catch worth knowing: `#include "x.h"` searches the including file's own folder before any include path, so a config sitting beside the header that includes it will always win. That is fine when the library's tests use the same config, and it is why the tests in these libraries are written against `EXAMPLE_MAX_TASKS` rather than a fixed number.
313
+
314
+ The include path follows the layout on its own: `flat` gives the library folder, `mirror` gives wherever the headers landed. Add `install.include_dirs` only when that guess is wrong.
315
+
316
+ Three things about this that are easy to get wrong:
317
+
318
+ **A `.c` template is a source.** If you ship a port layer as `src/example_port.c` that lands as `my_port.c`, it is added to the build like any other source. Leaving it out would fail at link time with undefined references and no clue why.
319
+
320
+ **`kind: rtos` implies `provides: [rtos]`.** A library that is an operating system satisfies another library's RTOS requirement, whether or not you remembered to write it down.
321
+
322
+ **`LICENSE.md` and `NOTICE` travel with the code.** The Apache licence requires it, and the NOTICE file is what carries your attribution into someone else's product. They are never removed during cleanup.
323
+
324
+ That is everything the repository needs. There is no installer script to copy in: put the install lines from the top of this page in your README, with your library's name in them.
325
+
326
+ If you maintain your own libraries with a fork of this tool, change `SOURCE` near the top of `install.py` in your fork to point at your fork, and use your fork's address in those lines.
327
+
328
+ ---
329
+
330
+ ## Running the tests
331
+
332
+ ```bash
333
+ python test/run_tests.py
334
+ ```
335
+
336
+ ---
337
+
338
+ ## License
339
+
340
+ Apache License 2.0. See [LICENSE](https://github.com/nimaltd/stm32-installer/blob/main/LICENSE).