Skip to content

Commit e0c3642

Browse files
Enhanced README (#9)
Complete the README file with mroe user-friendly content after first test from external people. Fixed local sample cross-file to be uptodate to Sentry kernel needs. Add default `dts-include-dirs` option value for standalone build
2 parents b43261a + a4f9f9e commit e0c3642

File tree

3 files changed

+71
-14
lines changed

3 files changed

+71
-14
lines changed

README.md

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ pip3 install -r requirements.txt
2323

2424
This kernel aims to be fully portable. Its initial target are ARM Cortex-M MCUs (starting with STM32) and thus one needs a cross toolchain for such target. One can use any cross toolchain as long as this is a GNU compatible compiler for Cortex-M. The reference toolchain used for `CI/CD` is bundled in this project using `meson` wrap mechanism.
2525

26+
Cross-toolchain relative need to be declared so that the `meson` build system is able to detect overall cross-compilers and associated tools. This is
27+
done by defining `cross-files`. The meson build system describes these cross file [here](https://mesonbuild.com/Cross-compilation.html).
28+
2629
### Project bootstrap
2730

2831
A common good practice is `do not inject environment variable for build configuration`. For this purpose, `meson` does not allow using relative path in toolchain definition. Toolchain path **_must_** be absolute.
@@ -58,17 +61,41 @@ menuconfig
5861

5962
# How to build
6063

64+
## About build options
65+
66+
The Sentry kernel has the following configuration options, that can be added at `meson setup` time using `-D<optname>=<optvalue>`
67+
68+
* `with_doc` (boolean, false): Enable support for building docs
69+
* `with_tests` (boolean, false): Enable unit test suite support through `meson test`
70+
* `with_proof` (boolean, false): Enable support for frama-C analysis through `meson test`
71+
* `with_kernel` (boolean, true): Enable kernel binary build
72+
* `with_uapi` (boolean, true): Enable kernel UAPI library build
73+
* `with_idle` (boolean, true): Enable kernel Idle task build
74+
* `with_tools` (boolean, true): Enable build host native tooling build
75+
* `config`: (string): path to the defconfig file. Can be externally provided, while respecting the kernel Kconfig
76+
* `dts` (string): DTS file path, may be local or any externaly provided DTS file
77+
* `dts-include-dirs` (array): DTS file include dir for dtsi resolution, depending on the DTS file content
78+
79+
It is to note that all the `with_` options are not mandatory, while others are.
80+
6181
## meson setup
6282
The first step in meson build is project setup, this will create a specific build directory for the given options. This step also configures the toolchain to use.
83+
6384
Some cross-files describing toolchain configuration are set in `support/meson` directory. More than one cross file can be used if needed.
6485

6586
```console
6687
meson setup [-Doption ...] --cross-file=</path/to/cross/file> <builddir>
6788
```
6889

90+
A typical setup of the Sentry kernel can then be, in a standalone mode:
91+
92+
```console
93+
meson setup -Dwith_doc=true -Dwith_tests=true -Ddts=dts/examples/stm32f429i_disc1_autotest.dts -Dconfig=configs/stm32f429i_disc1_autotest_defconfig --cross-file support/meson/armv7m.ini --cross-file support/meson/cortex-m4.ini builddir
94+
```
95+
6996
## build
7097

71-
The build step is as simple as calling ninja.
98+
Once meson build directory is setup, the build step is as simple as calling ninja.
7299
```console
73100
ninja -C builddir
74101
```
@@ -98,18 +125,20 @@ then be called separatelly by calling only the proof suite.
98125
FramaC tests can be listed using:
99126

100127
```console
101-
$ meson test -C builddir_framac/ --list
102-
frama-C-parsing
103-
frama-C-eva
104-
frama-C-wp-bsp-exti
105-
frama-C-wp-bsp-pwr
106-
frama-C-wp-bsp-rcc
107-
frama-C-wp-bsp-rng
128+
$ meson test -C builddir/ --list
129+
sentry-kernel:proof / frama-C-parsing
130+
sentry-kernel:proof / frama-c-eva-entrypoint
131+
sentry-kernel:proof / frama-C-eva-handler-systick
132+
sentry-kernel:proof / frama-c-eva-handler-svc
133+
sentry-kernel:proof / frama-c-eva-zlib
134+
sentry-kernel:proof / frama-C-eva-handler-systick-redalarm
135+
sentry-kernel:proof / frama-c-eva-handler-svc-redalarm
136+
sentry-kernel:proof / frama-c-eva-zlib-redalarm
108137
[...]
109138
```
110139

111-
EVA and WP targets generate `.eva` and `.wp` files in the corresponding test build directory that can then be opened with `ivette` and the Frama-C GUI for analysis.
112-
In the same time, red-alarms file holding detected RTE are also stored for each test.
140+
Each Frama-C execution is stored in a dedicated build directory that hold all usual files such as session file, red alarms, flamgraph and so on,
141+
that allows various post-processing, such as results analysis or Frama-C tools usage such as `ivette` or `frama-c-gui`.
113142

114143
## tests
115144

@@ -141,5 +170,19 @@ meson test -C <builddir> --suite ut-utils
141170
[...]
142171
```
143172

144-
## doc
145-
TBD
173+
## Documentation
174+
175+
Sentry documentation is written in the `doc/` subdirectory.
176+
It can be build if the `with_doc` flag is set to true.
177+
178+
There are multiple doc types:
179+
180+
* concepts: Overall Sentry concepts definition, and high level documentation, targetting the user or application developer
181+
* internals: Sentry internal code hierarchy, mostly built using doxygen. This doc is for kernel developers
182+
* mandb: Sentry UAPI manuals, in groff (man) format, so that it can be used with the `man` utitily
183+
184+
The ninja targets associated to these documentations are `doc-concepts` (`doc-concepts-pdf` for PDF generation), `doc-internals` and `mandb`.
185+
186+
Generated documentation is in the `$BUILDDIR/doc` directory, and are also deployed in `/usr/share/doc` in case of the usage of the `install` target.
187+
188+
More information about the various concepts of the Sentry-kernel and its build system can be found in the `concepts` documentation.

meson.options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ option('with_idle', type: 'boolean', value: true, description: 'Sentry Idle task
77
option('with_tools', type: 'boolean', value: true, description: 'compile naitive tools')
88
option('config', type: 'string', description: 'Configuration file to use', yield: true)
99
option('dts', type: 'string', description: 'Top level DTS file', yield: true)
10-
option('dts-include-dirs', type: 'array', yield: true,
10+
option('dts-include-dirs', type: 'array', value: ['dts'], yield: true,
1111
description: 'Directories to add to resolution path for dtsi inclusion')

support/meson/armv7m.ini

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
[constants]
2-
cross_compile = '/opt/arm-none-eabi/bin/arm-none-eabi-'
2+
# gcc triple, unified for ARM cortex-M
3+
cross_triple = 'arm-none-eabi-'
4+
# llvm triple, target-explicit, needed by Rust
5+
llvm_triple = 'thumbv7m-none-eabi'
6+
cross_toolchain = '/opt/arm-none-eabi/'
7+
cross_compile = cross_toolchain + 'bin/' + cross_triple + '-'
38

49
[host_machine]
510
system = 'baremetal'
611
cpu_family = 'arm'
712
endian = 'little'
13+
exe_wrapper = 'qemu-arm-static'
814

915
[binaries]
1016
c = cross_compile + 'gcc'
@@ -13,3 +19,11 @@ ar = cross_compile + 'gcc-ar'
1319
ranlib = cross_compile + 'gcc-ranlib'
1420
strip = cross_compile + 'strip'
1521
objcopy = cross_compile + 'objcopy'
22+
clang = 'clang'
23+
rust_ld = 'gcc'
24+
rust = 'rustc'
25+
pkg-config = 'pkg-config'
26+
27+
[properties]
28+
rust_target = llvm_triple
29+
sysroot = cross_toolchain + cross_triple

0 commit comments

Comments
 (0)