|
|
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.
|
|
|
|
|
|
### 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 and pulled out from the kernel's folder, without a specified target board in it.
|
|
|
|
|
|
What SBS does is that it modifies, for each of the target boards, a Makefile.template by substituting the placeholder that are there with the values defined in `sbs.conf`, then puts the Makefile in build/ and executes it.
|
|
|
|
|
|
### Project Configuration
|
|
|
|
|
|
Whenever it is executed, SBS looks for a `sbs.conf` file in the current folder to know how to compile each entrypoint. The current folder could be the boardcore repository as well as another project which includes boardcore. For this reason, we have to define a `[PROJECT_CONF]` section with the following information, that will be valid for all entrypoints listed in the file:
|
|
|
|
|
|
```
|
|
|
ENTRY_PATH: entrypoints folder relative path, e.g. src/entrypoints
|
|
|
TESTS_PATH: tests folder relative path, e.g. src/tests
|
|
|
SRC_PATH: shared sources folder relative path, e.g. src/shared
|
|
|
SBS_BASE: boardcore folder relative path, e.g. libs/skyward-boardcore
|
|
|
PROJECT_INCLUDES: Optional additional include directories, preceded by -I (eg: -Ilibs/mxgui)
|
|
|
PROJECT_SUBDIRS: Optional subfolders which contains additional makefiles (eg: libs/mxgui)
|
|
|
PROJECT_LIBS: Optional static libraries. (eg: libs/mxgui/mxgui.a)
|
|
|
```
|
|
|
|
|
|
### SrcFiles
|
|
|
|
|
|
The *srcfiles* are used for grouping together sources that refer to a common device/porpouse,
|
|
|
so that the can be referred when building entrypoints by simply using `%name`.
|
|
|
|
|
|
```
|
|
|
[name]
|
|
|
Type: srcfiles
|
|
|
Files: a '\n'-separated list of files
|
|
|
```
|
|
|
|
|
|
### Boards and Tests
|
|
|
|
|
|
Sections of type `board` and `test` define how to compile the entrypoints.
|
|
|
|
|
|
```
|
|
|
board:
|
|
|
BoardId: which board to compile for
|
|
|
BinName: name of the final binary (without extension!)
|
|
|
Include: a space-separated list of files, %something will be substituted
|
|
|
with the corresponding 'srcfiles'
|
|
|
Main: name of the main file (e.g. 'foo' -> ENTRY_PATH/foo.cpp)
|
|
|
|
|
|
test:
|
|
|
BoardId: which board to compile for
|
|
|
BinName: name of the final binary (without extension!)
|
|
|
Include: a space-separated list of files, %something will be substituted
|
|
|
with the corresponding 'srcfiles'
|
|
|
Main: name of the main file (e.g. 'foo' -> TEST_PATH/foo.cpp)
|
|
|
```
|
|
|
|
|
|
For example
|
|
|
|
|
|
```
|
|
|
#srcfiles
|
|
|
|
|
|
[canbus]
|
|
|
Type: srcfiles
|
|
|
Files: src/shared/drivers/canbus/CanManager.cpp
|
|
|
src/shared/drivers/canbus/CanBus.cpp
|
|
|
src/shared/drivers/canbus/CanSocket.cpp
|
|
|
src/shared/drivers/canbus/CanInterrupt.cpp
|
|
|
|
|
|
#boards
|
|
|
|
|
|
[discovery-canbus-test]
|
|
|
Type: board
|
|
|
BoardId: stm32f429zi_stm32f4discovery
|
|
|
BinName: discovery-canbus-test
|
|
|
Include: %canbus %shared
|
|
|
Defines:
|
|
|
Main: canbus-test
|
|
|
|
|
|
```
|
|
|
|
|
|
### Building
|
|
|
|
|
|
SBS's standard usage is building a board's firmware, which can be done with:
|
|
|
```
|
|
|
.\sbs -b *boardname*
|
|
|
```
|
|
|
|
|
|
You can also use the `-v` option (verbose). If you omit the `-b` option all entrypoints will be compiled.
|
|
|
|
|
|
### Other options
|
|
|
|
|
|
Prompting `./sbs --help` will print the options menu. |
|
|
\ No newline at end of file |