Commit graph

59 commits

Author SHA1 Message Date
Ben Leslie
94269ed5be Remove unused PYTHON tool definition
python2 is not used in the kernel build anymore so the tool
definition is unnecessary.

python2 is also end-of-line so there is no reason to think
we would ever depend on it again.

Signed-off-by: Ben Leslie <benno@brkawy.com>
2021-09-14 16:09:33 +10:00
Kent McLeod
6bc0b06338 CMake: Add support for cmake install <dir> cmd
When using CMake to only build the kernel, an install target is now
provided to copy important outputs into an installation directory.

Currently only the following files are installed:
- ./bin/kernel.elf: Location of kernel.elf binary
- ./libsel4/include: The include root for libsel4
- ./libsel4/src: The c source files for the libsel4 library

To build and install this project to an installation directory should
now only require the following from a clean build directory:
```
export CMAKE_GENERATOR=Ninja
cmake -DCMAKE_INSTALL_PREFIX=<path-to-install> -DOption=Val <src-dir>;
cmake --build .;
cmake --install .;
```

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-09-06 08:23:17 +10:00
Gerwin Klein
aec0f5a3f0 aarch64: make gcc-10 happy
The option -mno-outline-atomics used to be default before gcc-10 and
now needs to be provided explicitly. Without it gcc will produce
references to `__aarch64_ldadd8_acq_rel` which it expects to exist
in libgcc which we are not linking against.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2021-08-31 16:37:11 +10:00
Kent McLeod
b05d681621 cmake: Add seL4Config.cmake include CMakeLists.txt
seL4Config.cmake is responsible for generating a valid
CMAKE_TOOLCHAIN_FILE and setting up platform config options at the start
of the build. The CMAKE_TOOLCHAIN_FILE variable has to be set before the
first cmake `project()` function is processed to take effect.
Previously this file was required to be imported in a CMake script
before the kernel's CMakeLists.txt could be processed. This prevented
the main CMakeLists.txt file from being used without an additional
configuration file:
cmake -G Ninja -C ../configs/ARM_verified.cmake ../

Now it is possible to do:
cmake -G Ninja -DKernelPlatform=imx6 -DKernelARMPlatform=sabre ../

This should make it easier to invoke CMake for building kernel
configurations from other build environments.

Because this file is now imported in the Kernel's CMakeLists.txt
context, there is no longer a requirement to save all the intermediate
settings into the cache and then read them out again.

Signed-off-by: Kent McLeod <kent@kry10.com>
2021-08-19 09:24:31 +10:00
Axel Heider
9c1508d8d9 Enforce '-fno-common'
GCC < 10 and clang < 11 put uninitialized global variables into a
'COMMON' section unless '-fno-common' is specified. The linker will put
anything from 'COMMON' as the end of the '.bss' it nothing else is
specified in the linker script. Besides making the variable placement
look odd, this also tends to waste a page because we puts large aligned
block at the end. Eventually, GCC 10 and clang 11 made '-fno-common'
the default, see
- https://gcc.gnu.org/gcc-10/changes.html
- https://releases.llvm.org/11.0.0/tools/clang/docs/ReleaseNotes.html

Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-08-18 14:41:59 +10:00
Axel Heider
d28752f5fa CMake: remove redundancies
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-25 15:20:48 +11:00
Axel Heider
45142a0cbd CMake: merge include_directories() calls
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-25 15:20:48 +11:00
Axel Heider
e0e45a5a80 trivial: style
Signed-off-by: Axel Heider <axelheider@gmx.de>
2021-03-25 15:20:48 +11:00
Stefan O'Rear
f68eaf49fd riscv: Set compiler ABI for hardfloat builds
Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
2020-08-26 14:21:35 +10:00
Stefan O'Rear
b3ed77311f CMake: kernel.elf LINK_DEPENDS linker script
This causes the kernel to be relinked and downstream build steps run
when the linker script is modified.  Roughly copied from the dependency
handling used by the elfloader's build system.

Signed-off-by: Stefan O'Rear <sorear@fastmail.com>
2020-07-30 17:36:08 -04:00
Yanyan Shen
8c556d5899 riscv: Enable compiler flag for FPU for RV64
The F and D extensions are enabled for RV64 when KernelHaveFPU
is enabled. Note that we still use the lp64 abi: no floating-point
arguments will be passed in registers

Signed-off-by: Yanyan Shen <yanyan.shen@data61.csiro.au>
2020-05-07 13:48:26 +10:00
Gerwin Klein
79da079239 Convert license tags to SPDX identifiers
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
2020-03-09 13:21:49 +08:00
Matthew
497d3c66c5 Specify 32 bit to the clang assembler
If using clang, pass the -m32 flag to the assembler
2020-02-12 16:08:35 +11:00
Anna Lyons
554f812da3 mcs: scheduling context donation over ipc
After this commit, threads blocked on an endpoint can recieve a
scheduling context from the thread that wakes the blocked thread.
2019-08-22 11:22:37 +10:00
Edward Pierzchalski
3576377b08 CMake: Use unambiguous Python 2 executable name
Use the specific executable name "python2" to distinguish it from
"python" on distributions that install Python 3 as "python".
2019-08-08 10:19:24 +10:00
Anna Lyons
bc61a7f3bd python2 --> python3
Update all scripts and build system to call python3, given python2's
upcoming doom. Use sys.maxsize instead of sys.maxint in one script
(maxint does not exist in python3).
2019-08-08 10:19:24 +10:00
Kent McLeod
d5ded0c4f5 CMake: Process platform files in -C config
Allow projects that use the kernel as a subproject to configure the
kernel in -C scripts.

CMake supports providing a script via -C upon first initialisation of a
build directory. This script is expected to populate the configuration
cache for the rest of the build to depend on. This is how standalone
kernel builds are currently configured. However in buildsystems that add
the kernel as a subproject, it was up to the application to modify
configuration properties before or after the kernel was imported. This
lead to circular dependencies where properties were changed by a module
later in the build, but this then invalidated properties that were set
based on the first property's original value. This lead to running CMake
multiple times in order for settings to reach a stable state.

We now assume that most shared system configuration occurs in initial -C
settings evaluation. seL4Config.cmake is a configuration module that the
kernel exports that allows a configuration script to set kernel platform
and architecture settings in a way that doesn't introduce circular
dependencies.

seL4Config can be imported into other configuration files. This should
make it easier for a full system configuration script to query and
configure kernel configuration values without introducing circular
dependencies on configuration properties.
2019-07-03 17:32:54 +10:00
Siwei Zhuang
375a98c8b3 CMake: Generate device headers from DTS for spike
The DTS compilation was arm platforms only. Moving it to the top level
config file, making it available to RISCV platforms. The generated files
are almost identical with minor differences. A new argument(--arch) is
added to the hardware_gen.py for the differences.
2019-06-26 11:38:08 +10:00
Kent McLeod
a0cf155758 CMake: use kernel_all.c for executable
When kernel_all.i was being used as an input for kernel.elf, CMake would
add gcc -MD flags for generating an output dependency file. However GCC
doesn't run the preprocessor on .i files which have already been
preprocessed. This would lead to the expected dependency file not being
created. Ninja would cope by ignoring the missing file and printing an
error with debug flags. However, ccache was parsing the -MD flags and
the missing dependency file caused cache lookup failures resulting in
persistent cache misses on every compilation rerun.

Using kernel_all.c as the input, can mean that we preprocess the file
twice, however for regular builds we don't need to create a
kernel_all_pp.c, and when creating a kernel_all_pp.c for verification we
don't care about speed as much and so can run the preprocessor twice.
2019-05-06 12:15:48 +10:00
Anna Lyons
ffa9fda8f0 style: use consistent styling for all cmake files
Add .cmake-format.yaml which defines custom functions with kwargs to
style nicely
2019-03-22 11:52:06 +11:00
Anna Lyons
86ed25b8c0 cmake: use snake_case for RegisterDriver & CPPFile
Our upcoming cmake styling tool requires any custom functions you want
styled nicely to be lower case. We only need to style these two nicely,
as they have kwargs we would like aligned.
2019-03-22 11:50:04 +11:00
Kent McLeod
f6e5e218dc Remove symlinked libsel4 files from include dir
These files can be included normally using libsel4 include paths. This
removes situations where the same file is available under different
include paths due to symlinking into different directory structures.
2019-03-21 12:44:57 +11:00
Kofi Doku Atuah
63632cb370 CMake: Update to use new common, preprocessed ldscripts 2019-03-21 12:31:25 +11:00
Jasper Lowell
895726d410 Add initial LLVM toolchain support 2019-03-18 14:11:07 +11:00
Siwei Zhuang
d52341df3c cmake: Update the RISCV build to work with GCC 8.2.0 2019-03-15 10:48:37 +11:00
Oliver Scott
7bf089c5e4 serial-refactor: Update config.cmake and rename drivers
Updated config.cmake in drivers/serial to use the marco properly
and added license. Renamed all serial drivers to conform to style.
Moved include for configurations scripts below tools used by the kernel.
2019-02-21 17:31:36 +11:00
Oliver Scott
282d6a902c serial-refactor: Move kernelDTSList to arm
Currently dts support is only for arm so makes
sense to move into arm config.cmake. Will eventually add RISC-V to
the dts list too.
2019-02-21 16:11:37 +11:00
Simon Shields
0ac0792339 arm: generate memory region tables from dts
This change adds infrastructure to automatically generate the
physBase macro, the avail_p_regs array, and the dev_p_regs array
based on a device tree. Platforms can opt-in to using this
by adding DTS files to the KernelDTSList variable.

The Python script uses the hardware.yml file to determine which
devices in the device tree are of interest to the kernel and should
be hidden from userspace and instead mapped into the kernel. Note that
currently the kernel mappings are not (yet) generated, however most
of the infrastructure needed to make that happen is present.
2019-01-16 14:38:25 +11:00
Adam Felizzi
43b7bca872 CMake: CPPFile EXACT_NAME creates a temp copy
Modified the behaviour of the EXACT_INPUT option within the
CPPFile helper function. Now named EXACT_NAME, the option
copies the input file to a temporary file. The name of the
temporary file is also passed in by the caller. This
step in necessary in getting the CPP step to correctly
depend on the targets given by the caller
(through EXTRA_DEPS). Also updated the CPP generation of the
kernel_all.i file to reflect the change.
2018-08-27 10:18:10 +10:00
Adam Felizzi
2bf255c8a3 tools: Ignore option for circular_includes script
Added an "ignore" argument to the circular_includes script. This
allows the caller to specify files for the script to ignore when
it parses the source file. Rather than creating a special
ignore case for "kernel_all.c" in the script itself, the user
parses the file as an argument (plus others if needed). Updated
the kernels cmake file to reflect the change.
2018-08-27 10:18:10 +10:00
Adam Felizzi
c1c5e2f035 CMake: syscall_header_gen now called with python
Updated the command for calling 'syscall_header_gen.py' with
python. This allows the script to be called with the
desired version of python.
2018-05-22 14:20:51 +10:00
Kent McLeod
c9644f6ba2 RISC-V: Add CMake build files 2018-04-18 10:10:14 +10:00
Adrian Danis
91e44d3835 cmake: Correctly disable FPU usage on aarch64
aarch64 has different flags for preventing the usage of FPU registers
2018-03-23 16:26:05 +11:00
Adrian Danis
6081ecef9e cmake: Only pass -marm for aarch32
The -marm flag is not present on aarch64 toolchains
2018-03-23 16:25:29 +11:00
Adrian Danis
c42f338133 cmake: Explicitly set ARM and not thumb compilation
Some toolchains default to thumb compilation for some reason
2018-03-23 12:29:33 +11:00
Adrian Danis
066c736f05 cmake: Fix typo 2018-03-23 12:29:33 +11:00
Adrian Danis
764b19dc43 cmake: Avoid circular dependencies in prune generation
This fixes a case where modifying certain kernel files would cause subsequent ninja
invocations to complain of circular dependencies due to the prune generation seeing
an include directory that it was not suppose to.
2018-03-21 17:11:23 +11:00
Adrian Danis
4a30b46dbb cmake: add_compile_options and link flags directly
Introduces a macro for adding immediately to the compile options and the exe linker
flags. We are able to directly call add_compile_options as all compilation is happening
through cmake and so we do not need to construct our own duplicate argument lists for
manually applying to both the ASM and C flags
2018-02-22 14:51:48 +11:00
Adrian Danis
9b86333df6 cmake: string APPEND where possible 2018-02-22 14:51:48 +11:00
Adrian Danis
3f506c89ea cmake: Remove now unused macros 2018-02-22 14:51:48 +11:00
Adrian Danis
68da26ac92 cmake: Directly use include_directories
Since all compilation is now being handled by cmake the AddHeader wrapper that was adding
include directories directly to the ASM flags and C flags is no longer needed and we can
just use the regular source relative include_directories
2018-02-22 14:51:48 +11:00
Adrian Danis
11b6b78d04 cmake: Remove unused custom_command_c_fflags
By using CPPFile there is now no need for custom_command_c_flags as we are pulling
the includes rom what was given to include_directories instead
2018-02-22 14:51:48 +11:00
Adrian Danis
a214cbb418 cmake: Refactor file kernel compilation using CPPFile and changing source file properties
CPPFile is a more robuse verision of GenCPPCommand and allows us to drop the
`custom_command_c_flags` as cmake can directly perform compilation.

Changing the LANGUAGE of the SOURCE file from CPPFile allows us to pass a file with a .i
name to GCC, which gcc already knows to not preprocess again. This removes the need for
the custom compilation step.

Due to external tools depending on the kernel_all_pp.c output we still need to provide
this.
2018-02-22 14:51:48 +11:00
Adrian Danis
f685dc0717 cmake: CPPFile for bitfield generation
CPPFile is a more robuse verision of GenCPPCommand and allows us to drop the
`custom_command_c_flags` as cmake can directly perform compilatio
2018-02-22 14:51:48 +11:00
Adrian Danis
ea35fa5209 cmake: CPPFile for pruner generation
CPPFile is a more robuse verision of GenCPPCommand and allows us to drop the
`custom_command_c_flags` as cmake can directly perform compilation
2018-02-22 14:51:48 +11:00
Adrian Danis
f9e11037c0 cmake: Provide configuration includes directly to include_directories
include_directories makes these directories directly available to all compilation that
happens, without needing to provide additional target link directories. This is the
first step to removing the `custom_command_c_flags` variable
2018-02-22 14:51:48 +11:00
Adrian Danis
daf619fa44 cmake: Refactor dependency tracking for generated files and targets
This change is perofrm two refactors
 * Separates the notion of 'targets' and 'files' instead of having a single list
for all of them
 * Groups targets by providing new targets instead of a list

Whilst more verbose for the moment the separation of 'targets' and 'files' is needed
to refactor and change the generation targets.
2018-02-22 14:51:48 +11:00
Adrian Danis
c77e3b52a1 cmake: kernel_all.c does not depend upon any generation
`c_arguments_deps` is meant to be the dependencies needed if directly using the CMAKE_C_FLAGS
variable, but we are not using that here and so the dependency is redundant
2018-02-22 14:51:48 +11:00
Adrian Danis
c499f7004b cmake: Custom linker script as kernel target property
Whilst the kernel is currently the only thing that gets linked and so whilst this change is
functionally the same, it is a bit neater
2018-02-22 14:51:48 +11:00
Claudia Tu
43a818505d Fix: check KernelArmMach for exynos 2017-12-12 14:13:22 +11:00