If one forgets to source the zephyr-env.sh script before starting a doc
build (using the top-level Makefile), a long screenful of error messages
go by and you can miss what the actual problem is.
Check if ZEPHYR_BASE is not set and give a nice short error message.
(Updated to a more generic error message in anticipation of #9801
deprecating use of zephyr-env.sh)
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Since we only document Ninja as a generator for building the
documentation, switch to it for the convenience Makefile provided.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to build with different themes, propagate the theme options
through the Makefile to CMake.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Now that CMake is supported for building the docs, adapt the
instructions to build the documentation to the new mechanism and also
adapt the root-level Makefile to support building using CMake.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>