We should be able to run the script without requiring a zephyr,flash
property in the choosen node. Qualify insert based on having the
choosen property.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When building in Windows, extract_dts_includes.py failed with an
exception on boards that have dts sensor bindings. This was caused by
path handling to search for i2c-device.yaml that worked in Linux, but
not in Windows.
Affected boards were disco_l475_iot1, frdm_k64f, frdm_kw41z, and
hexiwear_k64.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Names that begin with an underscore are reserved by the C standard.
This patch does not change names of functions defined and implemented
in header files.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
The current script relies on a hardware reset pin to release the chip
from reset. Software reset is also possible and even required in case
the reset pin hasn't been wired to the J-Link connector on the board.
This patch adds an additional command line switch to nrfjprog.py that
uses the software reset mechanism of nrfjprog instead of pin reset.
Signed-off-by: Aapo Vienamo <aapo.vienamo@iki.fi>
When we determine the address and size cells to determine how to parse a
reg property, we need to stop at the parent of the node, not at the node
itself. If we have #address-cells or #size-cells in a node its meant
for the children of that node and not the node itself.
Fixes#4568
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
For those still using old variable ZEPHYR_GCC_VARIANT.
raise an error if the variable is not defined.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add the STM32 ccm_bss, ccm_noinit, abd ccm_data sections
to the list of allowed sections so the sanity check passes.
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
Allow for any toolchain variants to be useable with sanitycheck without
the need for them to be registered.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We want to support other toolchain not based on GCC, so the variable is
confusing, use ZEPHYR_TOOLCHAIN_VARIANT instead.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
As per current policy of requiring supervisor mode to register
callbacks, dma_config() is omitted.
A note added about checking the channel ID for start/stop, current
implementations already do this but best make it explicitly
documented.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
It is important that it is easy to reproduce CI issues locally. Using
the same sanitycheck options locally and in CI helps in this
regard. Specifically, Ninja and Make can produce different results and
therefore the default generator should be the same for sanitycheck and
shippable.
This patch makes four changes:
The sanitycheck option '--make' is introduced to allow specifying Make
as a generator.
CI no longer passes the option '--ninja' to sanitycheck.
Sanitycheck defaults to using Ninja.
Sanitycheck documents the --ninja option as deprecated.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
When generating coverage report:
* Also generate branch coverage
* If the report is properly generated tell user where to find it
* Handle case in which no ztests are run (it would crash before)
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Aligned sanitycheck command line options in doc
with the actual ones.
+
Minor fix in --coverage description.
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Sort the glob results when Kconfig sources do 'source
"/path/*/Kconfig"' to ensure that the resulting dotconfig file is the
same for all platforms.
This fixes#5743
Credit goes to @ulfalizer.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
sanitycheck: Compile unit tests with coverage enabled always
+ run also first unit tests together with native_posix
shippable: also include unit_testing coverage into report to
codecov
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Added a label for soc-nv-flash nodes. Made some updates to the
generation to maintain creating defines for properties like
erase-block-size and write-block-size so they we get both
FLASH_ERASE_BLOCK_SIZE and FLASH_${LABEL}_ERASE_BLOCK_SIZE (same for
WRITE_BLOCK_SIZE).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This patch adds app_pad and priv_stacks to the rw section list so that
tests which validate the sections found in the binary pass when run on
systems which contain MPUs.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Rather than having handler generate differently named log files,
generate the same for all handlers, so qemu, native and unit will now
generate handler.log.
This will simplify things and reporting will be consistent. Also, this
fixes a bug where we only included qemu.log in generated reports.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This patch converts over the current ELF processing scripts to use the
new elf helper python library.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch adds a python helper library that encapsulates the ELF
processing being done across multiple scripts. Users of this script
will be converted over in a following patch.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch adds the generation and incorporation of privileged stack
regions that are used by ARM user mode threads. This patch adds the
infrastructure for privileged stacks. Later patches will utilize the
generated stacks and helper functions.
Signed-off-by: Chunlin Han <chunlin.han@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch adds application data section alignment constraints
to match the region definition requirements for ARM MPUs. Most MPUs
require a minimum of 32 bytes of alignment for any regions, but some
require power of two alignment to the size of a region.
This requires that the linker align the application data section to
the size of the section. This requires a linker pass to determine the
size. Once this is accomplished the correct value is added to a linker
include file that is utilized in subsequent linker operations.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
A lot of improvements have made it into Kconfiglib since we introduced
it into Zephyr. This rebases our 2 Zephyr-specific commits into the
latest Kconfiglib upstream.
Origin: https://github.com/zephyrproject-rtos/Kconfiglib/tree/zephyr
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
When adding support for the 'flash' command to the jlink runner, it was
not clear if the jlink commander would erase flash before programming,
therefore an explicit mass erase was implemented in the jlink runner as
a precaution and enabled by default.
The Segger folks later confirmed that the jlink commander does an
implicit erase of relevant flash sectors with the loadbin command,
therefore the explicit mass erase is not required.
Keep the mass erase option available in the jlink runner, but change the
default to false.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
When building the testcase path, replace symlinks in path
with the realpath both in the testcase root and in ZEPHYR_BASE
For more info see issue #5772Fixes: #5772
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Adds support for the 'flash' command to the jlink runner so we can flash
via 'make flash'. This works by generating a temporary jlink commander
script file and passing the script to the jlink commander executable.
Previously, the only way to flash with jlink was via 'make debug'.
Includes support for DT based flash address, and an optional mass erase
before loading the flash.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Instead of crashing when a source file outside of ZEPHYR_BASE is
detected we accept it as-is to include it in the report.
This fixes#5866
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Its possible we have dashes in interrupt names that we need to convert
to underscores when we generate defines. Make sure we do that otherwise
things aren't going to build.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Some boards do not generate .bin files by default, this file is however
needed when generating ram/rom reports, so in case it is not present,
create it.
Fixes#5784
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Changed the default behavior for when we run sanitycheck to match the -R
flag that turns on assertions. Introduced a --disable-asserts option if
we desire to explicitly turn of asserts.
This matches behavior that our CI builds have been doing and addresses
part of #5726.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add 2 classes, one to handle the current TestCase scenario, and one more
for handling generic Console with regex matching.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
size_report was assuming Unix-style absolute paths and misbehaving
when paths had a colon ("C:\") in them. Also, refactored and improved
documentation.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Use Universal newlines when calling check_output and rely on the
locale's encoding to decode the output instead of explicitly decoding
UTF-8.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
size_report was assuming that the GNU Binutils programs were
generating files with the line ending '\n'. But on native Windows
binutils will generate files with the line ending \r\n.
This patches size_report to use so-called "Universal newlines"[0], so
that size_report can deal with any kind of newline on any kind of
platform.
[0] https://www.python.org/dev/peps/pep-0278/
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Some boards are supported natively by qemu. This option will allow us to
run tests using those platforms directly without having to go via a
dedicated qemu board definition.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
if we are using command line platform filter, no need to list every
other platform as excluded, we know that already. Show only the
discards that apply to the selected platforms on the command line
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When we load tests from a file, we do not have the discarded list, this
would have been done already when saving the test file.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This issuse is found in arch/arc's memory domain api support.
For arc, dwarf-2 is used to keep compatible with synopsys metaware
mdb debugger. However, the gen_kobject_list.py cannot generate the
correct information from dwarf-2, because loc.form's value is
DW_FORM_block1.
If dwarf-4 is adopted, there is no issuse.
Other arch and tools may use dwarf-2 and face the same issuse, so
this commit is created.
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
When checking if a testcase passed or failed, allow there
to be prefixes or postfixes in the line, around
PROJECT EXECUTION SUCCESSFUL/FAILED
Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Update tags.sh tool to generate appropriate files to use with cscope and
ctags programs.
Current implementation generates tags for all but samples and it's
possible to filter by architecture.
Signed-off-by: Juan Manuel Torres Palma <j.m.torrespalma@gmail.com>
Specifying a C standard triggered a compiler warning on Ubuntu (gcc
5.4.0) and a compiler error on Mac OS 10.12.6. Omit specifying the
standard and let the host toolchain use it's default instead. Tested
on Mac OS and Ubuntu 16.04.3.
This fixes#5640
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
We have been using a fork of the Linux kernel's Kconfig system to
configure the Zephyr tree. The issue is that this is a native tool
written in C that is not easy to compile for Windows. This patch
replaces the use of the conf executable with kconfig.py, a script that
uses Kconfiglib to generate the .config and autoconf.h files required to
compile Zephyr.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Some projects use wildcards when sourcing a Kconfig file. Add
support for globbing the files that match the wildcards and process
them one by one.
Origin: https://github.com/carlescufi/Kconfiglib/tree/zephyr
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Import Kconfiglib, the Python Kconfig parsing library.
Origin: https://github.com/ulfalizer/Kconfiglib
Revision: 8d30e5bb1ad5cab16d1226cc5cd3a03d64664f5d
Note that this will in time replace doc/scripts/genrest/kconfiglib.py,
which is an earlier version and should not live in that folder.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
In order to support both "/" and "\" as OS path separators,
use the correct Python os.sep helper.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
I've been successfully using the latest sphinx/breathe/docutils
and doxygen versions for local doc build testing. The CI system
already uses the latest doxygen, so this patch updates the
pip-installed sphinx, breathe, and docutils tools too.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
It has been agreed in the project TSC to reject commit messages without
any content. Every commit message needs some explaination beyond what
was put in the title, even the most trivial ones.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It is desired behaviour that when 'make VERBOSE=1' is invoked, the
underlying scripts will be invoked in 'verbose mode', e.g. they have
the flag --verbose passed to them.
This patch modifies all the underlying scripts in the build system to
inject --verbose into the command line when the environment variable
VERBOSE is set.
The environment variable VERBOSE is a CMake concept. CMake will
generate Makefile's that read this environment variable and try to
behave accordingly. Unfortunately, the generated ninja build systems
behave differently and will have to be invoked like this:
VERBOSE=1 ninja -v
This fixes#4851
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Windows users have on multiple occasions cloned Zephyr using a Windows
git client. It seems that the windows git client defaults to
converting line endings from LF to CRLF when cloning repo's. This
breaks at least one of Zephyr's tools (Kconfig).
This patch introduces a sanity check of the environment for MSYS
users.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
CONFIG_ASSERT is being set by cmake, so it is not possible to filter
using the generated config, add this as a standalone filter.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Generating coverage data is split over two CI jobs which means the
service will need to merge results and reports wrong coverage data when
only 1 job is finished. This puts the native_posix board first making
sure we run on the first job and generate data in one place.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Extend exception handling to cover not just YAML loading, but any
error while accessing parsed data too. That may catch e.g. schema
mismatch errors (for folks who don't have pykwalify installed, which
is optional). So, now error will be logged, but processing of other
tests will continue.
For example, I had a local, uncommitted test which wasn't converted
per 23f81eeb42 and caused:
Traceback (most recent call last):
File "./scripts/sanitycheck", line 2456, in <module>
main()
File "./scripts/sanitycheck", line 2324, in main
options.outdir, options.coverage)
File "./scripts/sanitycheck", line 1445, in __init__
for name in parsed_data.tests.keys():
AttributeError: 'list' object has no attribute 'keys'
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
We have been passing around options from one function to the next making
it very difficult to add a new option easily and requiring changes to
man function prototypes.
This declated the parsed command line options global and renames args to
options. args is being used elsewhere and this was confusing.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This keyword would mean that a special harness is needed to run the
tests sucessfully. This can be as simple as a loopback wiring or a
complete hardware test setup for sensor and IO testing. It is free form
initially and would be changed to be an enum once we have more values in
place.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
When a debugger is already connected to the JLink debug adapter
nrfjprog.py would incorrectly detect that the snr is '0' and try to
flash a device with that snr.
Also, when there were no boards connected, nrfjprog.py would
incorrectly state that there were multiple boards connected.
This patch improves the error feedback so that a user can more easily
debug why he can't flash his device.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
For readability, swallow exceptions unless --verbose is given on the
command line. Add a printline to direct the user how to ensure that's
set in case more information out of the flash script is desired.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Add a debug-only global that prevents commands from running, and just
prints what would have been run.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Allow the user to specify additional options for pyocd-flashtool. This
grants finer-grained control to individual applications, e.g. to
perform a chip erase instead of a sector erase when flashing.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
This gives callers finer-grained control over the flash. For example,
giving --dfuse-modifiers=force:mass-erase allows a chip-erase rather
than just erasing the sectors which need to be overwritten with the image.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Enable DT support in the dfu-util flasher when the target is a
DfuSe (DFU + ST extensions) device.
Untangling DfuSe-specific options (currently, the default is 'leave',
to immediately start running after the flashing is done) from the
actual address makes this cleaner, and sets up a subsequent patch to
let callers set DfuSe options.
It also lets us fix an unnecessary printline when flashing DfuSe
devices. There's no need to reset those, since the 'leave' modifier
starts execution immediately.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Add the necessary infrastructure to the runner core to support
computing flash addresses based on the devicetree. Specifically, add:
- a new RunnerCaps capability, flash_addr, which lets runners declare
when they support flashing to an arbitrary address
- a common --dt-flash option to all runner command line parsers which
support this capability, which lets users request flash addresses to
be computed from device tree
- a ZephyrBinaryRunner helper method, get_flash_address(), which is
the common code needed to compute a flash address from device
tree (or return a default value if non-DT based flashing is
requested). This relies on the BuildConfiguration parser introduced
in an earlier patch.
Subsequent patches will use this functionality in individual runners.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
The various runners (flash/debug scripts) use environment variables to
take arguments. This is legacy behavior which is not desirable.
Use command line arguments instead.
Note: this leaves more general environment variables with publicly
documented behavior in place for now, for compatibility, e.g.:
ZEPHYR_FLASH_OVER_DFU, OPENSDA_FW, ESP_IDF_PATH, PYOCD_DAPARG
For example, when using dfu-util to flash arduino_101, instead of
setting DFUUTIL_PID, DFUUTIL_ALT, and DFUUTIL_IMG environment
variables, have the script invocation look like this:
python3 .../zephyr_flash_debug.py dfu-util flash \
[common arguments omitted] \
--pid=8087:0aba --alt=x86_app \
--img=.../build/zephyr/zephyr.bin
Make similar changes for other runners (openocd, etc.) and
targets (debug, debugserver).
To implement this in the scripts:
- have the individual scripts/support/runner/some-runner.py files
register their own command line arguments
- teach them to construct instances from arguments, not the
environment
- have zephyr_flash_debug.py request runners to register command
line argument parsers, and handle arguments
In the build system:
- add a new board_runner_args() extension function that board.cmake
files can use to add to the zephyr_flash_debug.py command line
- adjust cmake/flash/CMakeLists.txt to invoke with arguments
- add new helper include files for each runner (like
boards/common/dfu-util.board.cmake, etc.), which add default
options as needed and then add on overrides from
board_runner_args() calls
- update board.cmake files to use the new includes and extension
This implied some tweaking when using openocd to make the CMake string
escaping and unescaping work properly.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Some configuration options or device tree nodes affect the way that
runners ought to behave, but there's no good way for them to report
whether they can handle them.
One motivating example is CONFIG_FLASH_LOAD_OFFSET, as influenced by
the zephyr,code-partition chosen node in the DT for architectures
where CONFIG_HAS_FLASH_LOAD_OFFSET=y.
If CONFIG_FLASH_LOAD_OFFSET is nonzero, the 'flash' command ought to
place the kernel at that address offset from the device flash's start
address. Runners don't support this right now, which should be
fixed. However, we don't want to mandate support for this feature,
since not all targets need it.
We need to let runners declare what their capabilities are. Make it so
by adding a RunnerCaps class to the runner core. This currently just
states which commands a runner can handle, but can be generalized to
implement the above use case.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
The Python-based runners have replaced the old shell scripts. Refactor
the build system accordingly:
- FLASH_SCRIPT is now BOARD_FLASH_RUNNER
- DEBUG_SCRIPT is now BOARD_DEBUG_RUNNER
The values, rather than being the names of files, are now the names of
runners in scripts/support/runner. They are still short, descriptive
names like "openocd", "jlink", "em-starterkit", etc.
Adjust the zephyr_flash_debug.py call and runner internals
accordingly. Have each runner class report a name and the commands it
can handle. This lets us move some boilerplate from each do_run()
method into the common run() routine, and enables further improvements
in future patches.
The handles_command() method is temporary, and will be replaced by a
more general mechanism for describing runner capabilities in a
subsequent patch. The initial use case for extending this is to add
device tree awareness to the runners.
To try to avoid user confusion, abort the configuration if an
xxx_SCRIPT is defined.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Have the subclasses implement a do_run() method instead, which run()
delegates to. This will make it possible to handle common
functionality in the superclass before runner-specific methods are
called. It is a prerequisite for tasks like loading the build time
configuration to add device tree awareness.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
When node has 'bus' as 'parent' attribute, change base label to
include parent address in label prefix.
Besides, generates a "_BUS_NAME" define which equals parent label.
Signed-Off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
size_report was using the environment variables NM and OBJDUMP to find
it's toolchain dependencies. It is not clear how well this will work
on different platforms; OSX, Windows. So we now pass the paths of
these dependencies from the build system to the script.
PS: This ensures that size_report uses the cross-compiler's GNU bin
tool instead of the host GNU bin tools. This is presumably beneficial
as it has been required for other GNU bin tools like GDB.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
when running multiple instances of sanitycheck, allow placing the
parsetab.py in a customer location that can be set using an environment
variable.
export PARSETAB_DIR=/tmp/
run sanitycheck and the parsetab.py will be placed in /tmp/.
Fixes#4513
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We have now different runners/handlers, so avoid using qemu terminology
for the generic classes and for generic usage.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Passing ARCH during the build process is something from the past and
samples/tests should not do that, remove it here to catch any
violations.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Since the move to YAML format and the change in how we define default
platforms this is no longer needed as we are able to set multiple
default platforms per architecture and not using a list based on
priority anymore.
Fixes#4445
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The section terminology was relevant with the ini syntax, with yaml we
can call this a test and avoid confusion and make the code more
readable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Simplify parsing of yaml structures and remove usage of cp which was for
the ConfigParser used for ini files.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The BOARD variable has been removed from the environment provided to
runners. It's not being used to flash the board, so just remove the
check for it to avoid an exception at runtime.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
It is supported to add give extra flags to the linker from the
commandline like this:
cmake -DEXTRA_LDFLAGS=-Lmy_dir path
But unfortunately this was broken during the CMake
migration. Interestingly, the reason that it was broken is that KBuild
was also partially broken. KBuild would pass on EXTRA_LDFLAGS when
object files were linked together into built-in.o files, but it would
not use EXTRA_LDFLAGS for the final link into an elf file.
This patch fixes EXTRA_LDFLAGS.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
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>
The core kernel is built with the --no-whole-archive linker option.
For all the individual .o files which make up the kernel, if there
are no external references to symbols within these object files,
everything in the object file is dropped.
This has a subtle interaction with system call handlers. If an object
file has system call handlers inside it, and nothing else in the
object file is referenced, then the linker will prefer the weak
version of the handler in the generated syscall_dispatch.c. The
user will get an "unimplemented system call" error if the associated
system call for that handler is made.
Fix this by making a fake reference to the handler function at the
system call site. The address gets stored inside a special section
"hndlr_ref". This is enough to prevent the handlers from being
dropped, and the hndlr_ref section is itself dropped from the binary
from gc-sections; these references will not consume space.
Handlers for system calls that are never invoked anywhere will still be
dropped if nothing else in their containing C files is used, which is
a good thing. A future enhancement could be to split out all handlers
into individual object files, such that we can guarantee that any system
call that is not made somewhere in the application will have its handler
dropped. This will need to be extended to driver subsystems as well.
This won't be pretty but will ensure the tightest binary size.
Fixes#5184.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This can be used by other handlers and is defined in the main Handler
class. Qemu is just an implementer.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
According to yaml syntaxic rules, 'properties' described in dts
bindings yaml files could be seen as 'mapping'(key/value couple),
instead of 'series' (list of single elements).
yaml 'mappings' will then be converted by yaml python library as
python 'dict' which will ease treatment (instead of current list
as were before this commit).
Same treatment is applied to 'inherits'.
script extract_dts_inlcude is updated to take change of yaml_list
structre into account. This allows some code simplification. Largest
impact is yaml_collapse function which works now allow complete
overload method on all the attributes of a yaml nodes.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Make sure committers have correct and valid git settings and verify that
the committer idenity matches one of the signed-off-by entries.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The mimxrt1052 does not have any internal flash, therefore a reset after
load blows away the code when loaded into sram. Reverse the order of the
jlink commands such that the load follows the reset.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
The script argument isn't really a path, so stop assuming that it is
one. We still use the shell script name at this point, but there isn't
any actual shell script in the system.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This makes piped output work as the user expects. And looking at the
piped output is the only way to use sanitycheck normally because
of #4603.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Some boards define multiple configuration which all are maintained under
the same board directory. The flasher was looking for an openocd.cfg
based on the board name, which can't be found for such boards.
Use the variable BOARD_DIR provided by cmake instead of trying to
assemble the board directory location on our own.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
sanitycheck was incorrectly documenting that --extra-args would pass
on it's input unchanged to Make.
In reality --extra-args acts as a way to define extra CMake cache
entries. The key-value entries will be prefixed with -D before being
passed to CMake.
E.g
"sanitycheck -x=USE_CCACHE=0"
will translate to
"cmake -DUSE_CCACHE=0"
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
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>
Dumping out the entire page table contents is extremely spammy.
Don't do this unless --verbose is passed twice.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The port will enable Zephyr to run as a guest OS on x86-64 systems. It
comes with a test on QEMU to validate that, thus this new board
introduction. It's "make run" target will issue QEMU with the same
configuration Jailhouse upstream uses for their confis/qemu-x86.c root
cell configuration:
Test configuration for QEMU Q35 VM, 1 GB RAM, 4 cores,
6 MB hypervisor, 60 MB inmates (-4K shared mem device)
This will work provided qemu-system-x86_64 is installed in the system
and a given (qcow2) image with the Jailhouse root cell in it is
provided (any of those will ever ship with Zephyr, it's out of its
scope).
Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
Kernel object metadata had an extra data field added recently to
store bounds for stack objects. Use this data field to assign
IDs to thread objects at build time. This has numerous advantages:
* Threads can be granted permissions on kernel objects before the
thread is initialized. Previously, it was necessary to call
k_thread_create() with a K_FOREVER delay, assign permissions, then
start the thread. Permissions are still completely cleared when
a thread exits.
* No need for runtime logic to manage thread IDs
* Build error if CONFIG_MAX_THREAD_BYTES is set too low
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Do not set XD at page directory level - some leaf PTE may have it
cleared.
Fixes: d1703691c8 ("x86: MMU: Generation of PAE tables")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This should clear up some of the confusion with random number
generators and drivers that obtain entropy from the hardware. Also,
many hardware number generators have limited bandwidth, so it's natural
for their output to be only used for seeding a random number generator.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Use-cases for these subsystems appear to be limited to board/SOC
code, network stacks, or other drivers, no need to expose to
userspace at this time. If we change our minds it's easy enough
to add them back.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
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>
Some of the flashing scripts try to be clever about picking unused
ports. That's convenient for the user, so add a helper class to
runner.core to accomplish similar ends portably.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Factor the classes which do the work into a new "runner" package. This
package has a core module where ZephyrBinaryRunner and common helpers
will live, and one file per subclass / runner front-end.
The top-level script, zephyr_flash_debug.py, still exists, but just
delegates its work to the core.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Though it isn't used by any in-tree Makefile.boards, looking at the
RIOT OS build system, this is meant to be split along lexical
boundaries defined by the shell, not just whitespace.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Several debugging scripts run setsid before executing a server
process, then run GDB with SIGINT ignored.
Relying on setsid is not portable. Add a popen_ignore_int() helper
that provides a portable alternative, and provide a generic
run_server_and_client() in ZephyrBinaryRunner which uses it to
abstract the pattern.
Subsequent patches will use this to implement the 'debug' command.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Replace the 'flash' method with a 'run' method, which takes a command
to run (flash, debug, or debugserver).
Rename the classes involved appropriately, and generalize the factory
interfaces as needed.
Add documentation and theory of ops.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
We only had a few hundred tests run when sanitycheck was first written,
and printing out the reasoning why tests were skipped seemed reasonable
at the time. Now that we are running tens of thousands of tests, this
is too much information.
The dump of what tests were skipped and why now requires two instances
of --verbose on the command line.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Now that we have a newer version of bossa in the SDK we can use a
version where there -p option works properly.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
If CONFIG_X86_PAE_MODE is enabled for the build, then gen_mmu.py
would generate the boot time page tables in PAE format.
This supports 3 level paging i.e Page Directory Pointer(PDPT), Page
Directory(PD) and Page Table(PT). Each Page Table Entry(PTE) maps to
a 4KB region. Each Page Directory Entry(PDE) maps a 2MB region.
Each Page Directory Pointer Entry(PDPTE) maps to a 1GB region.
JIRA: ZEP-2511
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
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>
The file was opened as text, to avoid issues with UTF-8 in the future,
make it all binary and encode to UTF-8 correctly.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
It's possible to declare static threads that start up as K_USER,
but these threads can't do much since they start with permissions on
no kernel objects other than their own thread object.
Rather than do some run-time synchronization to have some other thread
grant the necessary permissions, we introduce macros
to conveniently assign object permissions to these threads when they
are brought up at boot by the kernel. The tables generated here
are constant and live in ROM when possible.
Example usage:
K_THREAD_DEFINE(my_thread, STACK_SIZE, my_thread_entry,
NULL, NULL, NULL, 0, K_USER, K_NO_WAIT);
K_THREAD_ACCESS_GRANT(my_thread, &my_sem, &my_mutex, &my_pipe);
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Support new keywords in testcase.yaml that would allow us to inject
configuration options to be merged with default configuration instead of
having to provide a prj.conf for each variant of the test which is very
difficult to keep in sync. Sanitycheck script will create an overlay
file that is merged during the build process.
This is now done using the extra_configs option which is a yaml list of
option with the values, for example:
extra_configs:
- CONFIG_XXXX=y
- CONFIG_YYYY=y
With this option we can have multiple tests that for example run on
hardware with different values. This type of testing is good on HW but
it does not make sense to be built in normal sanitycheck operation
because it will be just rebuilding the same code with different values.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We need to track permission on stack memory regions like we do
with other kernel objects. We want stacks to live in a memory
area that is outside the scope of memory domain permission
management. We need to be able track what stacks are in use,
and what stacks may be used by user threads trying to call
k_thread_create().
Some special handling is needed because thread stacks appear as
variously-sized arrays of struct _k_thread_stack_element which is
just a char. We need the entire array to be considered an object,
but also properly handle arrays of stacks.
Validation of stacks also requires that the bounds of the stack
are not exceeded. Various approaches were considered. Storing
the size in some header region of the stack itself would not allow
the stack to live in 'noinit'. Having a stack object be a data
structure that points to the stack buffer would confound our
current APIs for declaring stacks as arrays or struct members.
In the end, the struct _k_object was extended to store this size.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
We need to enforce that if the implementation function is inlined,
and we are using a syscall declaration macro where a runtime check
is performed, that all memory access in the inlined implementation
function is done after the user context check is performed.
Fixes bad memory access issues observed due to the compiler fetching
member data from a kernel object when the calling context was in
user mode.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
By default, threads are created only having access to their own thread
object and nothing else. This new flag to k_thread_create() gives the
thread access to all objects that the parent had at the time it was
created, with the exception of the parent thread itself.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
- When flashing with dfu-util while alt is not a number, the name must
be quoted.
- Add missing commas in self.list_pattern
- Always call dfu-util with the VID/PID
Fixes: 257fa4af9 ("scripts: zephyr_flash_debug: flash like dfuutil.sh")
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
All commands need to have quotation marks stripped.
Fixes: bee6f9e73 ("scripts: zephyr_flash_debug: flash like openocd.sh")
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Add support for flashing targets compatible with esp32.sh.
Only tested by comparing commands that would be run.
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>