The -B option has always existed but was first officially documented in
CMake 3.13.0. In that same release the -S option was introduced,
replacing the old undocumented -H. Switch to using the officially
documented options.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
One of the first things needed when comparing builds of tests across
different environments/systems is to make sure the same (sub)tests were
selected and run in the first place. For that purpose sort the output of
--testcase-report and --discard-report as they were in random order.
Actually make the entire class TestInstance sortable by adding a
standard __lt__() method comparing unique instance names; it could be
useful again.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This makes the output of file2hex.py deterministic by default while also
letting the user set the mtime in the gzip header manually if desired.
Use the option without any argument to restore the previous behavior
that sets the current (and obviously changing) "now" timestamp.
To test: ./sanitycheck --tag gen_inc_file
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This is an old script for finding references to undefined Kconfig
symbols that assumes Kconfiglib 1 (an older API).
There's now a different check for references to undefined symbols (see
commit 1d0834b35f ("checks: kconfig: Check for references to undefined
Kconfig symbols") in the ci-tools repo).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This includes a bugfix for a pyocd requirement on pyyaml
that could not be satisfied using officially supported
releases.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
After the testcase configs are built, there is a step to
filter all the test case information to determine the set
of tests to run.
As this step takes a nontrivial amount of time, add an
informational message about it.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Fixes: #15289
Kconfig requires posix style path when sourcing other files.
As abspath in python will use native host style, i.e. backslash '\' in
windows this will cause invalid paths in Kconfig generated file and
thus the file will never be loaded.
This commit uses PurePath to convert the path to posix style, ensuring
Kconfig can load the modules.
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Rename reserved function names in arch/ subdirectory. The Python
script gen_priv_stacks.py was updated to follow the 'z_' prefix
naming.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
For systems without userspace enabled, these work the same
as a k_mutex.
For systems with userspace, the sys_mutex may exist in user
memory. It is still tracked as a kernel object, but has an
underlying k_mutex that is looked up in the kernel object
table.
Future enhancements will optimize sys_mutex to not require
syscalls for uncontended sys_mutexes, using atomic ops
instead.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The data value in a kernel object structure is specific
to that type of object. Allow this to be a reference to
another C symbol or other compiled code by populating as
a string.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Some forthcoming kernel object types like futexes need to
be tracked, but do not contain data that is private to
the kernel.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The code coverage reports on pull requests has been inconsistent and
confusing. Disable them for pull-requests.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Some logging text and colors were not escaped correctly, make sure we
generate well formed XML reports.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
We have not been counting samples in reports. This change lists tests
associated with sample code which in many cases is just verifying output
from the sample and counts as 1 test.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Due to the fact that CMake only supports greedy regexes,
the ':' in a Windows path ('C:\...') was being matched leading
to an invalid split of the line. Quote both the name and the path
to avoid this issue.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixes: #14513
This commit move the functionality of extracting zephyr modules into
generated CMake and Kconfig include files from CMake into python.
This allows other tools, especially CI to re-use the zephyr module
functionality.
Signed-off-by: Torsten Rasmussen <torsten.rasmussen@nordicsemi.no>
Zero functional change, this is pure refactoring and preparation for
using the mtime= parameter which the gzip.compress() shortcut does not
make available.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Update the script to detect and update more instances of unsigned
variable assignments when using all four simple rules of arithmetics.
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Fixes pylint warnings like this one:
doc/conf.py:325:0: W1401: Anomalous backslash in string: '\s'.
String constant might be missing an r prefix.
(anomalous-backslash-in-string)
The reason for this warning is that backslash escapes are interpreted in
non-raw (non-r-prefixed) strings. For example, '\a' and r'\a' are not
the same string (first one has a single ASCII bell character, second one
has two characters).
It just happens that there's no \s (or \., or \/) escape for example,
and '\s' turns into two characters (as needed for a regex). It's risky
to rely on stuff like that regexes though. Best to make them raw strings
unless they're super trivial.
Also note that '\s' and '\\s' turn into the same string.
Another tip: A literal ' can be put into a string with "blah'blah"
instead of 'blah\'blah'.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
The /memreserve/ code would crash if it ever ran, because 'name' isn't
defined (seems to be some copy-paste here). There are no /memreserve/s
in Zephyr though, so it works out.
'name' seems to be the node name. Not sure what to put for a
/memreserve/, but make it '<memreserve>' to make it stand out.
Fixes a pylint warning.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
self.num_members doesn't exist. This commit just removes the reference,
because I didn't want to guess a proper fix.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Using a member variable in the dict comprehension was probably a typo
(can't see 'sym' referenced elsewhere). Use a local variable instead.
Made pylint spit out these warnings (which might be spurious though):
scripts/elf_helper.py:535:24: E0203: Access to member 'sym' before
its definition line 536 (access-member-before-definition)
scripts/elf_helper.py:535:39: E0203: Access to member 'sym' before
its definition line 536 (access-member-before-definition)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Discovered with pylint3.
Use the placeholder name '_' for unproblematic unused variables. It's
what I'm used to, and pylint knows not to flag it.
Python tip:
for i in range(n):
some_list.append(0)
can be replaced with
some_list += n*[0]
Similarly, 3*'\t' gives '\t\t\t'.
(Relevant here because pylint flagged the loop index as unused.)
To do integer division in Python 3, use // instead of /.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Discovered with pylint3.
Use the placeholder name '_' for unproblematic unused variables. It's
what I'm used to, and pylint knows not to flag it.
Also improve the naming a bit in devicetree.py. If a key/value is known
to be a specific thing (like a node), then it's helpful to call it that
instead of something generic like "value".
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Fix --help message. Also rename run_report() to save_tests() as it's
used only once by --save-tests and nowhere else. Maybe the code was
shared with some --other-report feature in the past but not any more.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
debug_die() is not implemented in this class, and indeed we
don't even have a reference to the DWARF DIE object.
This is a fatal error anyway, just raise an exception.
Fixes#14762
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Also add a "generated by sanitycheck" header to indicate origin and a
warning about the dependency required to actually run the test.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
os.exit() doesn't exist.
Also use the nifty sys.exit(msg) feature, which prints 'msg' to stderr
and exits with status 1.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Not needed in Python. Detected by check C0325 in pylint3.
Also replace an
if len(tag):
with just
if tag:
Empty strings, byte strings, lists, etc., are falsy in Python.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Making a clean slate for some pylint CI tests. Only enabling relatively
uncontroversial stuff.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Needs to be at the beginning of the file. Fixes a pylint warning:
scripts/process_gperf.py:26:-1: W0105: String statement has no
effect (pointless-string-statement)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Needs to be at the beginning of the file. Fixes a pylint warning:
scripts/process_gperf.py:26:-1: W0105: String statement has no
effect (pointless-string-statement)
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Fix wrong --test help message
- Provide more examples to clarify naming hierarchy
- Document that --sub-test runs its entire --test
- Point out that save/load options use their own format
- Document that --list-tests is flattened
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
- Remove DTFlash.extract(), which was just dispatching to either
_extract_flash() or _extract_code_partition() depending on which
magic string was passed in. Call them directly instead.
- Fold constant and globally available parameter values into functions
- Remove DTFlash._flash_node. It's easy to derive wherever it's needed,
and it makes it clearer where it comes from (and means functions can
be called in any order).
- Remove DTFlash._flash_base_address, which is unused
- Remove various unused parameters to functions
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
def_label is the name used for macros and .conf file values. It can
never have a slash in it.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Fix broken code that was meant to turn the
'interrupts'/'interrupts-extended' value into a list if it wasn't.
list(123) will error out instead of creating [123].
- Remove weird .split('/') on macro name
- Rename 'props' to 'vals'. It's the value of a single property.
- Get rid of a bare 'except:'
- Rename l_fqn to full_name. Accidentally stumbled upon 'fqn' probably
standing for "fully qualified name", but it's not obvious.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- Have get_parent_path() return None for the root ('/'). This is handy
when looping over path components.
- Move _find_parent_irq_node() out of the class, call it
parent_irq_node(), and use get_parent_path() in it.
- Add a global err() function for reporting errors. Use it if a node
unexpectedly has no interrupt-parent.
Previously, this would give a Python error instead.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
(OPTIONAL) was a vestiage from the initial import of the Zephyr code
base and we dont utilize it with the GNU linker. Additionally, the way
(OPTIONAL) gets defined to nothing creates a linker script that lld
(from llvm) doesn't like.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Linking to API material requires knowing the pecularities of how
doxygen, sphinx, and breathe work. In an attempt to hide some of this
we're preparing the current docs to allow use of configuration defaults
that will let us more simply use a default role that will hunt for a
reference target in the various domains that are available by using a
default "role" of "all". This will let us use the simple notation
`functionname` or `typename` without fully specifying the reference as
:c:func:`functionname`.
This patch cleans up exising docs that were (incorrectly) using single
backtics where double backtics should have been used, and also found
some typos (such as a space between the role name and the reference,
such as :file: `filename`, and a missing colon such as
c:func:`functionname`)
This is a start to address issue #14313
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
PyYAML 5.1 was just released and it doesn't support !include as
previous versions do. This breaks our DTS bindings parsing.
Let's fix our extract_dts_include.py script to work with both
3.13 and 5.1.
Also, update the pyyaml requirement to >=3.13 to be sure we're
compatible.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/14496
Signed-off-by: Michael Scott <mike@foundries.io>
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.
For example, tests/subsys/jwt and board mps2_an385:
z_test_mem_partition: addr 0x20000000, size 52
z_libc_partition : addr 0x20000040, size 4
k_mbedtls_partition : addr 0x20008000, size 32736
ending at 0x2000ffff, taking up 65536 bytes
With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.
After the changes here, the partitions are:
k_mbedtls_partition : addr 0x20000000, size 32736
z_test_mem_partition: addr 0x20008000, size 52
z_libc_partition : addr 0x20008040, size 4
ending at 0x2000805f, taking up 32864 bytes
With the above example, sorting results in a saving
of 32672 bytes of saving.
Fixes#14121
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
They're effectively mutually exclusive already because
options.sub_test in main() immediately discards any --test
argument(s). This commit preempts user confusion thanks to this new
message:
sanitycheck: error: argument --sub-test: not allowed with
argument -s/--test
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Due to issues with the implementation of the default auto-erase in
pyocd, sometimes the chip is mass-erased even when not intended. To
avoid this issue, default to forcing sector erasing unless mass erasure
is explicitly requested by the user with additional flash options.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
We have several scripts used by the build system related
to generating code for system calls, privileged mode stacks,
kernel object metadata, and application shared memory
partitions. Add some overview documentation for each.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
$ sanitycheck -h # is re-ordered like this:
< ... all other options ... >
-C, --coverage Generate coverage reports. Implies
--enable_coverage
--coverage-platform COVERAGE_PLATFORM
Plarforms to run coverage reports on. This
option may be used multiple times.
Test case selection:
-f, --only-failed Run only those tests that failed the previous
sanity check invocation.
-s TEST, --test TEST Run only the specified test cases. These are
named by <path to test project relative to
--testcase-root>/<testcase.yaml section name>
--sub-test SUB_TEST Run only the specified sub-test cases and its
parent. These are named by test case name
appended by test function, i.e.
kernel.mutex.mutex_lock_unlock.
--list-tests list all tests.
-F FILENAME, --load-tests FILENAME
Load list of tests to be run from file.
-E FILENAME, --save-tests FILENAME
Save list of tests to be run to file.
-T TESTCASE_ROOT, --testcase-root TESTCASE_ROOT
Base directory to recursively search for test
cases. All testcase.yaml files under here will
be processed. May be called multiple times.
Defaults to the 'samples' and 'tests' directories
in the Zephyr tree.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Update reserved function names starting with one underscore, replacing
them as follows:
'_k_' with 'z_'
'_K_' with 'Z_'
'_handler_' with 'z_handl_'
'_Cstart' with 'z_cstart'
'_Swap' with 'z_swap'
This renaming is done on both global and those static function names
in kernel/include and include/. Other static function names in kernel/
are renamed by removing the leading underscore. Other function names
not starting with any prefix listed above are renamed starting with
a 'z_' or 'Z_' prefix.
Function names starting with two or three leading underscores are not
automatcally renamed since these names will collide with the variants
with two or three leading underscores.
Various generator scripts have also been updated as well as perf,
linker and usb files. These are
drivers/serial/uart_handlers.c
include/linker/kobject-text.ld
kernel/include/syscall_handler.h
scripts/gen_kobject_list.py
scripts/gen_syscall_header.py
Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Commit 45a7e5d076 removed scripts/sysgen
and _k_task_list/_k_event_list sections are no longer being used.
So remove them.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Commit 73cb9586ce renamed linker
section from _k_memory_pool to _k_mem_pool, but the references
in linker scripts are still there. So remove them now.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Running checkpatch in pre-commit hook could be a constraint
for day to day work. Though, running it before pushing to
zephyr repo is highly recommended.
Add a series push script callable from pre-push hook.
Document how to use it in contribute section.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
In order to simplify the usage of `west build`, take a positional
argument with the source directory instead of requiring the `-s,
--source-dir` flag. This makes it easier and quicker to invoke west when
building, as well as being consistent with CMake.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Users often get confused when they change Kconfig sources and then
rebuild only to discover that nothing happens. To fix this we add a
dependency between re-running cmake, and all Kconfig sources, similair
to how touching CMakeLists.txt files cause CMake to re-run.
This fixes#5634
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Dictionaries are iterated in a random order by Python 3.5 and before.
This could have caused "Unstable" CI in PR #13921 and maybe others.
Anyway we want builds to be determimistic by default. Explicit
randomness can be added for better coverage but not by default.
1. When running "make kobj_types_h_target" repeatedly one can observe
that the following .h files keep changing in
build/zephyr/include/generated/:
- kobj-types-enum.h
- otype-to-str.h
- otype-to-size.h
Switching kobjects to OrderedDict makes these 3 .h files deterministic.
2. When running this test repeatedly with CONFIG_USERSPACE=y:
rm build/zephyr/*.gperf && make -C build obj_list
... the dict used for --gperf-output seems to be deterministic, probably
because its keys are all integers (memory addresses). However we can't
take that for granted with Python < 3.6 so out of caution also switch
the output of find_objects() in elf_helper.py to a sorted OrderedDict.
PS: I would normally prefer official Python documentation to
StackOverflow however this one is a good summary and has all the
multiple pointers to the... official Python documentation.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
To reproduce the issue this addresses, run "cmake -B96b_nitrogen"
twice with Python 3.5. Observe the order of the flash partition table
changing in:
"build{1,2}/zephyr/include/generated/generated_dts_board.conf" and
"generated_dts_board_unfixed.h"
Dictionaries are iterated in a random order by Python 3.5 and before.
This could have caused "Unstable" CI in PR #13921 and maybe others.
Anyway we want builds to be determimistic by default. Explicit
randomness can be added for better coverage but not by default.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Sigvart pointed out that the error message for missing Kconfig files
(which rambles on a lot about $srctree) can easily kick people off in
the wrong direction.
Update Kconfiglib to upstream revision 9f26eb3ae3 to add the following
commit, which makes the error message point to stuff that's more likely
to be the problem:
Give more helpful error messages when files are missing
The current error message talks a lot about $srctree, but $srctree
is seldom the culprit in practice. More common is 'source
"$(SOME_ENV_VAR)/foo"`, where SOME_ENV_VAR hasn't been set.
Include the complete 'source ...' line for missing Kconfig files,
and mention unset environment variables as a hint. Only mention
$srctree briefly.
Also shorten the message when a .config can't be a found a bit. This
message would usually only be seen when working directly with the
library.
Example error:
Kconfig:7: '/Kconfig' not found (in 'source
"$(SOME_ENV_VAR)/Kconfig"'). Check that environment variables are
set correctly (e.g. $srctree, which is unset or blank). Also note
that unset environment variables expand to the empty string.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
App shared memory defines a bunch of symbols in the
linker script. Namespace them properly as private
zephyr variables.
The variables which indicate the bounds of the entire
partition now end with "_part_start", "_part_size",
and "_part_end" to make them easy for scripts to
distinguish them from other generated symbols for
data/bss sizes.
Finally, the bss size is not rounded up, this was
causing unnecessary memory to be zeroed.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
When re-running failed tests, do not go through any filtering, just load
the failed tests directly and execute them. The filtering was done based
on default platforms and any tests that were failing on non-default
platforms were ignored.
Fixes#13956
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This is useful when running the script locally on a set of commits to
reproduce how things are run in CI.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Zephyr Continuous Integration made the choice of rebasing pull requests
on its fast moving master branch before testing them. Unfortunately the
Shippable interface assumes the other choice[*] and highlights the SHA1
of the pull request _before_ rebasing which is very misleading. For now
the only way to realize this disconnect is to scrutinize the build logs
and/or this source code (or tribal knowledge).
To mitigate and reduce a bit this confusion, run a short:
git log -n 5 --oneline --decorate
before and after rebase.
Making it worse, Shippable sub-runs are not pegged to a common base
version. For instance the reason why shippable sub-run 35578.1 passed
while all other 35578.x sub runs failed is very likely because PR #13803
was merged to master in the mean time. This commit would have been able
to prove that.
[*] In an ideal world with infinite time and resources, Continuous
Integration would test pull requests BOTH alone and combined with the
moving tip.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
On (at least) Fedora "pytest" is python2 and python2 only.
Also update remote name in sample invocation from "upstream" to "origin"
because that's how west sets things up by default (and this script
requires west)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Was apparently an artifact of Python2 to Python3 conversion. Led to
printing of literal '='*110i instead of a line of ='s.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
When building incrementally, filter-known-issues.py reports a varying
and totally different set of "new" issues than when building from
scratch. Warnings for unrelated upstream code disappearing and
re-appearing are especially confusing. Expand the messages a bit to
clarify.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
insert_defs() is the only function that adds keys to 'defs', and they
always get added with an 'aliases' key.
This function could get super simple if the duplicate-removal code could
be removed. It only seems to be needed to prevent duplicates for some
(unfortunately tricky) flash-related stuff now.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
- No deep copying is needed. The deepcopy() is just a hack to work
around that the value might not be a list. That deserves a comment at
least.
- A catch-all try/except will hide stuff like misspelled variables as
well. It's usually a bad idea.
Rewrite things to be more explicit, and add some comments.
reg.py was indirectly using the deepcopy() imported in global.py,
because it does 'from global import *'. Have it import deepcopy() itself
instead. reg.py is the only remaining user of deepcopy().
reg.py relying on the deepcopy() import in global.py was super hard to
discover, due to another catch-all try/except around the deepcopy()
call.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
All nodes have a 'children' key.
Also simplify a bit. The loop is copying a dictionary verbatim.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
'/foo' was turned into ''. Turn it into '/' instead. That's how the root
is represented in 'reduced' too.
Also remove some code from get_addr_size_cells() that was only there to
work around the bug.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
If a binding specifies 'generate: define' for 'interrupt-names' (like
some bindings do), then that ought to generate #defines for it, but the
scripts/dts code currently hardcodes 'interrupt-names' to be ignored
(along with some other properties).
Maybe the 'generate: define' in those bindings is a mistake, but the
code still ought to respect it. That also gets rid of some mystery code.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This is an integral part of userspace and cannot be used
on its own. Fold into the main userspace configuration.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Add some short doc comments at the beginning so that people can quickly
get an idea of what they're about.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
It's confusing that "address" is often used within the same function to
refer to both node paths and e.g. address cells.
Make things easier to understand by calling /foo/bar a path instead.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
extract_property() is meant to generate #defines for a single property,
like 'foo = <1 2 3>'. Currently, it also generates node-level #defines
related to parent buses.
That makes the intent of the code hard to understand, and also means
that identical node-level #defines get redundantly added multiple times
(once per property).
Generate the node-level bus #defines before processing properties, in
generate_node_defines(). Use a new generate_bus_defines() helper.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Due to the way the code was structured,
flash.extract_partition(node_path) was called multiple times for the
same 'node_path'.
That must've been a mistake to begin with (but was hard to spot before
the code was cleaned up). Move the generation of per-node #defines out
of the property loop.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Do not load the GENERATED_DTS_BOARD_CONF if in doc mode, since it will
not defined as it doesn't apply. No need to defined it to a dummy value.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
generate_node_defines() immediately returns if the node's 'compatible'
is not in the binding.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Derive 'node_compat' and 'prop_val' (the dictionary for the property
from the YAML binding) inside extract_property().
That gives it just two parameters and makes it clearer that it's just
generating #define's for a single device tree property. 'prop_val' was
only used to look up prop_val['type'].
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Moves it closer to where it's used, and will allow other simplifications
in generate_node_defines().
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>