Skip to content

Commit

Permalink
📝 Explain the usage of libhal-bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
kammce committed Jul 29, 2024
1 parent 1fb1029 commit 36238d8
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ This is a [Conan](https://conan.io/) recipe file. Conan is a package manager for
C and C++ that helps manage dependencies in your project. This file defines how
Conan should build your project and its dependencies.
This conan file utilizes the
[`libhal-bootstrap`](https://github.com/libhal/libhal-bootstrap) extension
library to reduce the amount of replicated code for libhal libraries. This conanfile extends the `libhal-bootstrap.library` class. That class implements:
- `def validate(self)`
- `def layout(self)`
- `def generate(self)`
- `def build(self)`
- `def package(self)`
- `def build_requirements(self)`: which adds the tool packages for `cmake`,
`libhal-cmake-util`, `libhal-mock`, `boost-ext-ut`
The class methods can be extended by implementing your own. The base class
implementations simply get called first. The derived class can then extend
these even further, but in general, most of these should be left untouched.
### `CMakeList.txt`
The root CMake build script for the library. It contains a call to the
Expand Down Expand Up @@ -88,6 +104,27 @@ library. It includes:
function from
[`libhal-cmake-util`](https://github.com/libhal/libhal-cmake-util).
The `demos/conanfile.py` utilizes the
[`libhal-bootstrap`](https://github.com/libhal/libhal-bootstrap) extension
library and extends the `libhal-bootstrap.demos` class. This class provides the
basic building blocks for a demo. The requirements from the base class are not
transitive so:
```python
bootstrap = self.python_requires["libhal-bootstrap"]
bootstrap.module.add_demo_requirements(self)
```

Must be invoked in order to add the appropriate platform libraries to the
`ConanFile` class. These platform libraries are usually `libhal-lpc40`,
`libhal-stm32f1` and `libhal-micromod`. Note that bootstrap must be updated to
support additional platforms. If you attempt to use a profile with a platform
name outside of what is supported by `libhal-bootstrap` then this API does
nothing except include `libhal-util`.

Additional requirements and dependencies can be added after calling
`add_demo_requirements`.

### `include/libhal-__device__/`

This directory contains the header files for the device library. This contains
Expand Down

0 comments on commit 36238d8

Please sign in to comment.