Commit graph

266 commits

Author SHA1 Message Date
Alberto Escolar Piedras 76f7644118 arch: native: Run Zephyr natively in a POSIX OS
A new arch (posix) which relies on pthreads to emulate the context
switching
A new soc for it (inf_clock) which emulates a CPU running at an
infinely high clock (so when the CPU is awaken it runs till completion
in 0 time)
A new board, which provides a trivial system tick timer and
irq generation.

Origin: Original

Fixes #1891

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Anas Nashif 5146dbbc58 arch: architecture defines kernel entry
Make defining the kernel entry architecture specific and move it to the
architecture domain.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Sebastian Bøe ba0b2836e8 cmake: Fix the -Wl,--print-memory-usage compatibility test
-Wl,--print-memory-usage is a relatively new LD feature (2015) and is
not supported by the espressif toolchain. Unfortunately the toolchain
compatibility test was broken as it was not using the flag when
linking.

The root cause lies in how we test LD compatibility and this same fix
must be applied again in e.g. target_ld_options().

This patch fixes
https://github.com/zephyrproject-rtos/zephyr/issues/5458

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-21 11:06:56 -05:00
Sebastian Bøe dbdd722239 ld: Introduce --print-memory-usage
Pass the --print-memory-usage to the linker on the first link if the
toolchain supports it.

Don't use this option with the second link because seeing it twice
could confuse users and using it on the second link would suppress it
when the first link has a ram/flash-usage issue.

Note that the memory regions are symbolic concepts defined by the
linker scripts and do not necessarily map directly to the real
physical address space. Take also note that some platforms do two
passes of the linker so the results do not match exactly to the final
elf file. See also rom_report, ram_report and
https://sourceware.org/binutils/docs/ld/MEMORY.html

This is particularly useful when the linker fails due to excessive
flash/ram usage. When a section does not fit into a memory region the
linker will exit with an error code and will state how big the
overflow was. But it doesn't state what the memory region size is, or
what memory regions exist, which is good to know when debugging
overflow issues.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-19 16:57:11 -05:00
Sebastian Bøe 4ece94df6f cmake: Fail with an error message when empty libraries exist
A very annoying usability issue is that the error message is very
cryptic when you create a zephyr library that doesn't have any source
files. Creating such a library is very easy to do, so we should have a
good error message for it.

It was also considered to allow empty libraries to exist, but this was
decided against as they show up in the build output and can confuse
the end user.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-10 19:51:54 -05:00
Sebastian Bøe 89516fbc25 cmake: Change the zephyr_get_* API to be LANG-aware
When exporting flags to an external build system we need to deal with
the fact that we sometimes use generator expressions. Specifically, we
use generator expressions that look like this:

$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>

This patch replaces the old API with a new one where users can ask for
compile options for specific languages, like this:

zephyr_get_compile_options_for_lang_as_string(CXX x)

The existing API would have either crashed or silently omitted flags
when a COMPILE_LANG generator expression was present.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-05 10:08:40 -05:00
Gustavo Lima Chaves 4c4189242f cmake: honor again CONFIG_KERNEL_ENTRY
This was impacting Jailhouse port, at least.

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-12-04 21:02:06 -05:00
Sebastian Bøe 13a6840261 cmake: Re-organize syscall generation wrt. the build system
This commit fixes
https://github.com/zephyrproject-rtos/zephyr/issues/5008.

It does so by splitting up gen_syscalls.py into two scripts with a
json metadata file to communicate syscall metadata between them. The
parsing script parses header files from include/ and writes syscall
metadata to a file if the contents changed. The generation script
reads from the json file and generates syscall code.

The build system DAG now looks like this:

always_rebuild -> json -> syscalls -> offset.o

The script for generating json will do so only if the content changes,
this ensures that the entire DAG does not always do a full rebuild.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-12-04 10:51:07 -08:00
Sebastian Bøe 2ead15de8d cmake: Move syscall_macros.h generation into the build stage
This fixes https://github.com/zephyrproject-rtos/zephyr/issues/5186

The script that generates syscall_macros.h is moved from Configuration
time to build time. This allows us to express to the build system that
syscall_macros.h depends on the script that generates it.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-11-30 06:49:33 -05:00
Sebastian Bøe 703dc59baa kernel: stack: add -fstack-protector-all without checks
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-11-29 09:51:55 -05:00
Sebastian Bøe 033fe7ed74 Revert "kernel: stack: add -fstack-protector-all without checks"
This reverts commit eb88bf2e62.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-11-29 09:51:55 -05:00
Anas Nashif eb88bf2e62 kernel: stack: add -fstack-protector-all without checks
Fixes #5019

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-28 16:48:41 -05:00
Anas Nashif 1f1143ac87 build: use kconfig to select generated artifacts
Not all boards require the various binary formats zephyr generates. So
be selective based on the arch, SoC or board and only geenrate the
binaries actually needed.

Fixes #5009

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-23 07:29:13 -05:00
Sebastian Bøe e51ce4d34d cmake: Generate POST_BUILD items based on KConfig
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-22 13:29:37 -05:00
Sebastian Bøe 9f59045546 cmake: Refactored EXTRA_FLAGS code into a dedicated script
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-15 19:47:44 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00