Commit Graph

321 Commits

Author SHA1 Message Date
Anas Nashif df5d7d738b build: add top-level Makefile for docs
for docs and everything that is not covered by cmake.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Gustavo Lima Chaves c94760045f build: make kernel entry symbol a config option
This might change for different ports, so make it configurable.

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-11-07 08:58:49 -05:00
Anas Nashif 035814efc6 boards: move pinmux driver to board/soc dir
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Marti Bolivar 81f2d21fac build: remove flash/debug shell scripts
The functionality of the shell scripts for flashing and debugging has
now been replaced by zephyr_flash_debug.py. Remove the legacy scripts
as part of transitioning all of this to Python.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Marti Bolivar fad998f410 build: interpose zephyr_flash_debug.py in debug/debugserver targets
Just as was previously done for flashing, invoke zephyr_flash_debug.py
from the build system debug and debugserver targets by default. The
Python script will fall back on the corresponding shell script if it
doesn't have its own implementation.

The shell script can be used instead, just as with flashing, by
setting USE_ZEPHYR_FLASH_DEBUG_SHELL to any nonempty value.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:31:22 -04:00
Kumar Gala 46d82fd588 dts: Limit search of device tree bindings to dts/bindings dir
Now that all the yaml binding files are in dts/bindings lets limit the
search path for bindings to that location.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-23 15:02:00 +02:00
Kumar Gala 03fb9ff5f9 scripts/dts/extract_dts_includes.py: Cleanup yaml file finding
Cleanup how we find the yaml files for device tree bindings.  Move to a
recursive dir search of the dts/ dir.  This will be useful for
supporting re-organizing of the yaml files to match binding dir
structure.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-23 15:02:00 +02:00
Marti Bolivar 113ee65b89 build: interpose zephyr_flash_debug.py in flash target
Zephyr board flashing and debugging is done via shell scripts. It
would improve the CMake transition to remove the shell dependency.

Add zephyr_flash_debug.py to allow phasing out the shell scripts.
This takes two arguments:

- a command (eventually flash, debug, and debugserver, but just flash
  for now)

- the path to the corresponding shell script

zephyr_flash_debug.py runs the command in pure Python if it
knows how. Otherwise, it falls back on the shell script. In
this patch, it always falls back. Subsequent patches add support
for existing flash backends.

Invoke zephyr_flash_debug.py from the Makefile flash target, but only
if USE_ZEPHYR_FLASH_DEBUG_SHELL is empty. This lets users keep existing
behavior in case of issues, and can be removed later once the Python
script is more widely tested.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-12 23:53:20 -07:00
Anas Nashif b307ddfff2 release: Update version to 1.9.99 for pre-release of 1.10
Fixes #1558

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-01 23:17:01 -04:00
Andrew Boie 0053ce4b5c Makefile: put tests/ under libs-y
ztest framework doesn't do anything privileged, it interacts with the
kernel using system calls like other application code and should be
considered runtime logic.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-30 13:39:17 -04:00
Andrew Boie fa94ee7460 syscalls: greatly simplify system call declaration
To define a system call, it's now sufficient to simply tag the inline
prototype with "__syscall" or "__syscall_inline" and include a special
generated header at the end of the header file.

The system call dispatch table and enumeration of system call IDs is now
automatically generated.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-29 13:02:20 -07:00
Andrew Boie 1d3731f1e5 gen_syscall_header.py: script to generate macros
This header could be maintained by hand since there are no inputs
and it only changes if the generating script is modified, but given
the choice to maintain 800-ish lines of extremely repetitive C
preprocessor code, or 100-ish lines of Python, the choice is pretty
clear.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-28 08:56:20 -07:00
Anas Nashif 66f1f89da9 qemu: cleanup qemu configurations
Move all QEMU related defines to the boards and cleanup xtensa platforms
which were marked to be QEMU capable by mistake.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-23 16:51:20 -07:00
Anas Nashif 38625607b1 scripts: move footprint scripts to footprint/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 08:53:56 -07:00
Anas Nashif 3461c8cf59 scripts: move dts related scripts to scripts/dts/
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 08:53:56 -07:00
Andrew Boie 945af95f42 kernel: introduce object validation mechanism
All system calls made from userspace which involve pointers to kernel
objects (including device drivers) will need to have those pointers
validated; userspace should never be able to crash the kernel by passing
it garbage.

The actual validation with _k_object_validate() will be in the system
call receiver code, which doesn't exist yet.

- CONFIG_USERSPACE introduced. We are somewhat far away from having an
  end-to-end implementation, but at least need a Kconfig symbol to
  guard the incoming code with. Formal documentation doesn't exist yet
  either, but will appear later down the road once the implementation is
  mostly finalized.

- In the memory region for RAM, the data section has been moved last,
  past bss and noinit. This ensures that inserting generated tables
  with addresses of kernel objects does not change the addresses of
  those objects (which would make the table invalid)

- The DWARF debug information in the generated ELF binary is parsed to
  fetch the locations of all kernel objects and pass this to gperf to
  create a perfect hash table of their memory addresses.

- The generated gperf code doesn't know that we are exclusively working
  with memory addresses and uses memory inefficently. A post-processing
  script process_gperf.py adjusts the generated code before it is
  compiled to work with pointer values directly and not strings
  containing them.

- _k_object_init() calls inserted into the init functions for the set of
  kernel object types we are going to support so far

Issue: ZEP-2187
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-07 16:33:33 -07:00
Anas Nashif 6597e86ed5 release: Zephyr 1.9.0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-07 18:18:42 -05:00
Anas Nashif 29a3ccecd5 release: Zephyr 1.9.0-rc4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-07 15:27:10 -05:00
Anas Nashif dca4b97918 release: Zephyr 1.9.0-rc3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-04 14:46:30 -04:00
Anas Nashif 3fb710b3ca release: Zephyr 1.9.0-rc2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-25 16:47:33 -04:00
Anas Nashif c7634a9486 release: Zephyr 1.9.0-rc1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-17 23:43:00 -04:00
Anas Nashif b8cd707b51 build: remove deprecated qemu/qemugdb targets
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-03 11:48:55 -04:00
Andrew Boie 08c291306e x86: generate RAM-based GDT dynamically
We will need this for stack memory protection scenarios
where a writable GDT with Task State Segment descriptors
will be used. The addresses of the TSS segments cannot be
put in the GDT via preprocessor magic due to architecture
requirments that the address be split up into different
fields in the segment descriptor.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Andrew Boie ddf9f4be31 x86: convert gen_idt to Python
This is one less host tool we have to compile for every build,
and makes the build tools more portable across host OSes.
The code is also much simpler to maintain.

Issue: ZEP-2063
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-25 11:32:36 -04:00
Marti Bolivar 3dd63b60a7 build: export generated DTS configuration
This can be just as important as the contents of auto.conf.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-25 09:57:07 -05:00
Marti Bolivar 497f8fd40a build: export flashing and debugging info, when present
Zephyr supports the flash and debug targets via per-board information
in Makefile.board files.

It is sometimes convenient to know this information when inspecting
the build artifacts or doing exotic builds, so include it in the file
generated by outputexports. The information in Makefile.board provides
what is needed.

Therefore, ensure that Makefile.board, when present, is included by
the generated Makefile.export. This gives users of Makefile.export
access to variables like FLASH_SCRIPT, PYOCD_TARGET, etc. (These users
need to cope with these variables being undefined if not given in
Makefile.board, or if Makefile.board does not exist for a target.)

While we're here, don't export INSTALLKERNEL. That's Linux-specific
and otherwise unused; the Zephyr equivalent is FLASH_SCRIPT and its
associated variables.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-25 09:57:07 -05:00
Leandro Pereira f5a8d498ea scripts: Convert gen_offset_header to Python
By having this as a Python script rather than a host executable, this
should simplify the build process on non-Unix platforms.

With this change, pyelftools is now required to build Zephyr.  Please
consult the getting started documentation for your host platform for
installation instructions.

Jira: ZEP-2062

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-24 11:20:04 -07:00
Timo Teräs cdec108bfe Makefile: explicitly disable PIE
Modern GCC can be configured to default to PIE. To support
such toolchains, turn PIE off as otherwise the generated
binaries are broken in multiple ways (e.g. the ELF will have
additional sections that get inserted at end of _TEXT_SECTION
making __data_rom_start point to these sections and not
the data secions).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2017-07-20 12:02:08 -07:00
Andrew Boie 2a4c2ee23a build: place app objects in libapplication.a
To prepare for upcoming memory protection features, we need to
distinguish between objects that are owned by the kernel itself
(and will be protected with supervisor permissions) and those
objects which are properly part of the application.

The current policy will be to place in libapplication.a anything
under lib/ (such as the C library), the application itself, and
additional libaries specified by KBUILD_ZEPHYR_APP.

These entities will no longer end up in libzephyr.a, which will
let us do output section routing in the linker script on a
per-file basis.

Some of the internal variables have been combined and simplified.

Issue: ZEP-2184
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-29 07:46:58 -04:00
Andy Gross 1e72c1e761 Makefile: Add config-sanitycheck target
This patch adds a separate target for config-sanitycheck that will
generate a .config-sanitycheck file that contains both Kconfig and DTS
config information.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-06-15 16:14:59 -05:00
Adithya Baglody 83644a493e kernel: x86: MMU: Build system support for x86 MMU
Makefile rule to create the MMU page tables at boot time. This
rule invokes the gen_mmu.py script to create a binary which is
then placed into the kernel image using objcopy.
Makefile.mmu is included only when CONFIG_X86_MMU is enabled.

JIRA: ZEP-2095

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-06-13 11:36:54 -04:00
Anas Nashif 054ab5f1cf release: Update version of master to 1.8.99
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-07 21:33:10 -04:00
Carles Cufi 5dec78bb50 build: Fix DTC overlay file paths on MSYS2
On MSYS2, the #include paths for GCC need to be in native format
(Windows-style paths) since GCC is a native Windows application and
therefore requires standard paths.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-31 14:57:33 -04:00
Andy Gross 78114e2f8a Makefile: Add dts config include file
This patch adds a dts config include file that is sourced during builds.
The config file contents are key value pairs derived from the DTS board
descriptions.

Jira: ZEP-2119

Change-Id: I4d50e795ba776645b56f0b83410cbb5b0a8fd4fa
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-05-31 14:56:57 -04:00
Anas Nashif 6b081415d3 dts: make extract script take options
Use argeparse for options and add a fixup option to add on top of
generated file. This was previously done in the top Makefile and was
generated defines outside of the header main if statement.

Jira: ZEP-2147

Change-Id: If65f34a11de27baa770d4ce0ef4fca2abbd30258
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-05-31 14:56:57 -04:00
Carles Cufi d464929d2d build: Treat MSYS2 build as a UNIX build
Since MSYS2 provides a UNIX-like environment, treating it as a Windows
build caused issues with the paths.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-19 16:12:05 -04:00
Andrew Boie 174f301147 build: simplfy how extra build steps are specified
For various reasons its often necessary to generate certain
complex data structures at build-time by separate tools outside
of the C compiler. Data is populated to these tools by way of
special binary sections not intended to be included in the final
binary. We currently do this to generate interrupt tables, forthcoming
work will also use this to generate MMU page tables.

The way we have been doing this is to generatea "kernel_prebuilt.elf",
extract the metadata sections with objcopy, run the tool, and then
re-link the kernel with the extra data *and* use objcopy to pull
out the unwanted sections.

This doesn't scale well if multiple post-build steps are needed.
Now this is much simpler; in any Makefile, a special
GENERATED_KERNEL_OBJECT_FILES variable may be appended to containing
the filenames to the generated object files, which will be generated
by Make in the usual fashion.

Instead of using objcopy to pull out, we now create a linker-pass2.cmd
which additionally defines LINKER_PASS2. The source linker script
can #ifdef around this to use the special /DISCARD/ section target
to not include metadata sections in the final binary.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-13 14:07:09 -04:00
Anas Nashif e5bd83f4aa build: build host-tools when prebuilts are enabled
The build process of the host tools requires fixdep, when prebuilt host
tools are enabled and no host-tools are available (i.e. after a 'make
mrproper'), the build would fail because of the dependency. So make sure
we point to the in tree fixdep binary when building.

Change-Id: I8311f870d90b32ba56c821bb8533379f57003a8d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-27 20:52:20 -04:00
Anas Nashif 19ee5efa61 build: support building host tools
To speed up builds, this change allows building the needed host tools
that are built for every application and stores them un
${ZEPHYR_BASE}/bin.

Run 'make host-tools' and then define PREBUILT_HOST_TOOLS to reuse the
host tools across multiple builds.

$ make host-tools
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/gen_idt/version.o
  HOSTCC  scripts/gen_idt/gen_idt.o
  HOSTLD  scripts/gen_idt/gen_idt
  HOSTCC  scripts/gen_offset_header/gen_offset_header.o
  HOSTLD  scripts/gen_offset_header/gen_offset_header
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf

$ export PREBUILT_HOST_TOOLS=${ZEPHYR_BASE}/bin

$ make -C samples/hello_world

Now you will notice a speedup when building the application!

Change-Id: Ie0aeee7f9a60b1fd49e7e32d78601f03473d73b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-25 22:48:23 +00:00
Kumar Gala 4f1e304f68 build: only build gen_idt on x86
Change-Id: I0401e2557c69f1e32ddedb79758c1dde781ea69b
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-24 03:17:16 +00:00
Andy Gross c8112aaeec build: Add separate DTS target
This patch adds an actual dts target for builds.  This required moving the
rules from Kbuild to Makefile and adding the correct dependencies to targets
requiring the dts files.

JIRA: ZEP-1979

Change-Id: I6ad568e2a821630911623cb227aa303fbf388515
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-04-20 14:36:10 +00:00
Anas Nashif 45a7e5d076 kernel: remove legacy.h and MDEF support
Change-Id: I953797f6965354c5b599f4ad91d63901401d2632
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 10:59:35 -05:00
Patrice Buriez 49a8de7ae3 build: use -O2 instead of -Os for ARC with SDK 0.9
This is intended as a temporary fix for ZEP-1882.
Investigation for this bug has shown that the current SDK 0.9 compiler
for ARC generates incorrect code under -Os optimization level.

Kuo-Lang Tseng found out that SDK 0.8.2 does not have this issue, and
that lowering optimization level to -O2 fixes the issue with SDK 0.9.
Juro Bystricky is working on an updated SDK with ARC GCC 6.3.0, but
there are still problems with it, so he also suggested to use -O2 in
the meantime.

Instead of blindly setting -O2 for all toolchains and architectures,
let Makefile.toolchain.zephyr make the decision for ARC and 0.9 only.
Tested with hello_world, CONFIG_ADC=y and BOARD=arduino_101_sss.

Jira: ZEP-1882
Change-Id: Ifde2e3950c9d93eed8982149805acfda9d13a94f
Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>
2017-04-09 14:57:50 +00:00
Andy Gross c65c6a9029 build: Don't remove dts/ directory on clean
This patch fixes an issue where any make target executing the the clean
from the root source directory would remove the dts directory.  This is
not necessary and can cause build issues on following make commands.

ZEP-1968

Change-Id: I2cc751d8fd24bd77e425860686b66644ade44eeb
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-03-27 10:27:01 -05:00
Carles Cufi 1436e44aa6 build: Add support for MSYS2
MSYS2 is a modern fork of Cygwin that is widely supported
and provides frequent releases and good support. It is
also the framework used by the official Windows Git port.
This patch adds MSYS2 support so that builds on Windows using
MSYS2 work properly.

Change-Id: Ia5743a410d1cff983a7aab37f8e3d8228cb8ae8e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-03-17 17:34:56 +01:00
Anas Nashif 161a863da7 bump version to v1.7.99
This starts development on master for Zephyr 1.8

Change-Id: I81484f09cd4ed90c276f2901be90132af90c2208
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-02-15 05:46:45 -08:00
Andrew Boie 19dc4c67cc Makefile: test for -fno-asynchronous-unwind-tables
Some GCC variants don't support this. Moved later in the Makefile
after the toolchain Makefile has been included so the test works
properly.

Change-Id: Ia9ec2582c486197ea3df3d878173643c14786408
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER 0efb2313ca Xtensa port: Let xcc specific make file override unsupported -Og with -O0.
Change-Id: If1a1833b5ce09c7112245b8b73c0ccd28be66c88
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER f69499a4a8 Xtensa port: Remove XCC warning about unrecognized CLI option.
XCC does not support compiler option -fno-defer-pop.

Change-Id: Ic47714331502b10e5e1e510984991615fe801696
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00