|
|
SBS (*Skyward Build System*) is the build system that is used to compile boardcore's entrypoints, which are written for Miosix and need to be executed on a specific target board. It permits to group useful drivers in library and reuse the same group of files for different entrypoints.
|
|
|
SBS (*Skyward Build System*) is the build system used to compile boardcore's entrypoints, which are written for Miosix and need to be compiled for a specific target board.
|
|
|
|
|
|
## Usage
|
|
|
SBS lets you specify the target board and custom includes and defines for each entrypoint, as well as grouping useful drivers in a library to reuse them in different entrypoints.
|
|
|
|
|
|
## SBS
|
|
|
|
|
|
**Building**
|
|
|
|
... | ... | @@ -15,7 +17,7 @@ You can also use the `-v` option (verbose). If you omit the `-b` option all ent |
|
|
|
|
|
Prompting `./sbs --help` will print the options menu.
|
|
|
|
|
|
## Configuration
|
|
|
## SBS.conf
|
|
|
|
|
|
#### Project Configuration
|
|
|
|
... | ... | @@ -62,12 +64,35 @@ Sections of type `board` and `test` define how to compile the entrypoints. |
|
|
Main: name of the main file (e.g. 'foo' -> TEST_PATH/foo.cpp)
|
|
|
```
|
|
|
|
|
|
## Creating a new SBS project
|
|
|
|
|
|
Typically when you want to develop the software for a new board or system, you want to include `skyward-boardcore` in your project and develop specific components using the ones provided by boardcore. To do this:
|
|
|
|
|
|
1. include `skyward-boardcore` as a submodule of your project.
|
|
|
|
|
|
2. create a `sbs.conf` file in your project directory, specifying the relative path of the boardcore folder (e.g. libs/skyward-boardcore) and where the sources are located ( typically `modules`, `entrypoints` and `tests`).
|
|
|
|
|
|
A typical file structure for your project could be:
|
|
|
|
|
|
```
|
|
|
YourProject/
|
|
|
|_ src/
|
|
|
| |_ modules/
|
|
|
| |_ entrypoints/
|
|
|
| |_ tests/
|
|
|
|_ libs/
|
|
|
| |_ skyward-boardcore/
|
|
|
|_ sbs.conf
|
|
|
|_ bin/ <-- binaries will be generated here
|
|
|
|_ build/ <-- Makefiles will be generated here
|
|
|
```
|
|
|
----
|
|
|
|
|
|
## SBS Internals
|
|
|
|
|
|
## How it Works
|
|
|
Normally, to compile code made with Miosix for a specific board you would have to comment some lines in miosix/config and then execute `make` (see the [Miosix Guide](https://miosix.org/wiki/index.php?title=Quick_start)).
|
|
|
<br/>Since Boardcore uses a modified version of Miosix, a custom config/ folder was created without a specified target board in it.
|
|
|
Normally, to compile code with Miosix you would have to choose the target board in `miosix/config` and execute Miosix's Makefile (see the [Miosix Guide](https://miosix.org/wiki/index.php?title=Quick_start)).
|
|
|
|
|
|
What SBS does is that it creates a Makefile for each entrypoint starting from the `Makefile.template`. The placeholders that are there are substituted with the values defined in `sbs.conf`, then the Makefile is moved to build/ and executes it.
|
|
|
Since in boardcore we have many entrypoints to build, and we don't want to write a custom Makefile for each one of them, SBS generates them for us filling the `Makefile.template` with the values defined in `sbs.conf`. Each Makefile is generated into the `build/` folder and executed to compile the corresponding binary, which is generated in the `bin/` folder.
|
|
|
|
|
|
#### Standard MIOSIX build
|
|
|
|
... | ... | @@ -94,21 +119,20 @@ end |
|
|
end
|
|
|
```
|
|
|
|
|
|
**Build Sequence**
|
|
|
|
|
|
1. Choose target board modifying Makefile.inc
|
|
|
2. Choose sources, defines and includes modifying Makefile
|
|
|
3. Compile with `make` from the main folder
|
|
|
|
|
|
#### SBS Build
|
|
|
|
|
|
The SBS build works as follows: from your project folder, you execute `python3 <BOARDCORE_FOLDER>/sbs` (e.g. using a script). SBS will then search for an sbs.conf in the directory from which it has been executed. From there, it will get the paths and configurations for all the entrypoints, importing the srcfiles also from the boardcore/sbs.conf (to reuse source groups that come from boardcore). Then, for each entrypoint, it fills in the Makefile.template creating a standard MIOSIX Makefile for each entrypoint. Each Makefile is then executed to compile a binary.
|
|
|
The SBS build works as follows:
|
|
|
1. from your project folder, you execute `<BOARDCORE_FOLDER>/sbs`
|
|
|
2. SBS will then search for an sbs.conf in the directory from which it has been executed, loading configurations for all the entrypoints
|
|
|
3. SBS then imports the srcfiles from the `<BOARDCORE_FOLDER>/sbs.conf` (to reuse source groups that come from boardcore)
|
|
|
4. For each entrypoint, SBS fills in the `Makefile.template` creating a MIOSIX Makefile
|
|
|
5. Each Makefile is then executed to compile a binary
|
|
|
|
|
|
```mermaid
|
|
|
graph TD;
|
|
|
|
|
|
subgraph "Project Folder"
|
|
|
sbs.sh
|
|
|
sbs.sh[.]
|
|
|
sbs.conf
|
|
|
subgraph "build"
|
|
|
buildBOARD1[BOARD1]
|
... | ... | @@ -136,27 +160,4 @@ boardcoresbs.conf[sbs.conf] |
|
|
boardcoresbs.py[sbs]
|
|
|
Makefile.template
|
|
|
end
|
|
|
```
|
|
|
|
|
|
## Making a new SBS project
|
|
|
|
|
|
*Make a new project that includes SBS*
|
|
|
|
|
|
1. include skyward-boardcore as submodule of your project.
|
|
|
|
|
|
2. create a `sbs.conf` in your project directory, specifying where is the boardcore submodule (e.g. libs/skyward-boardcore) and where are the sources (shared, entrypoints and tests).
|
|
|
|
|
|
3. a typical file structure is
|
|
|
|
|
|
```
|
|
|
YourProject/
|
|
|
|_ src/
|
|
|
| |_ shared/
|
|
|
| |_ entrypoints/
|
|
|
| |_ tests/
|
|
|
|_ libs/
|
|
|
| |_ boardcore/
|
|
|
|_ sbs.conf
|
|
|
|_ bin/ <-- binaries will be generated here
|
|
|
|_ build/ <-- Makefiles will be generated here
|
|
|
``` |
|
|
\ No newline at end of file |
|
|
``` |
|
|
\ No newline at end of file |