Commit graph

41120 commits

Author SHA1 Message Date
Marc Herbert
f67dcdbdf8 CMakeLists.txt: -fmacro-prefix-map=${CMAKE_SOURCE_DIR}=CMAKE_SOURCE_DIR
In commit 28a5657f1f we stopped ZEPHYR_BASE from leaking into
__FILE__ and other macros.  This works great for apps inside ZEPHYR_BASE
but does nothing for apps outside ZEPHYR_BASE.
-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=CMAKE_SOURCE_DIR does it.

To avoid collisions and for consistency change:
  -fmacro-prefix-map=${ZEPHYR_BASE}=.
to:
  -fmacro-prefix-map=${ZEPHYR_BASE}=ZEPHYR_BASE

Quickest test/demo:

 - Copy samples/hello_word/ to ~/home_world/
 - Add "%s", __FILE__  to printf in ~/home_world/src/main.c

 cmake -B build  -S ~/home_world/  -DBOARD=qemu_x86
 make  -C build  run

Before:
     ~/home_world/src/main.c says Hello World! qemu_x86

After:
 CMAKE_SOURCE_DIR/src/main.c says Hello World! qemu_x86

objdump -h $(find build -name *.c.obj) | grep noinit

  9 .noinit."ZEPHYR_BASE/kernel/system_work_q.c".0 0000
 17 .noinit."ZEPHYR_BASE/kernel/init.c".2 00000100  000
 18 .noinit."ZEPHYR_BASE/kernel/init.c".1 00000400  000
 19 .noinit."ZEPHYR_BASE/kernel/init.c".3 00000800  000
 16 .noinit."ZEPHYR_BASE/kernel/mailbox.c".2 00000348
 18 .noinit."ZEPHYR_BASE/kernel/mailbox.c".1 00000028
 20 .noinit."ZEPHYR_BASE/kernel/pipes.c".2 00000280  00
 22 .noinit."ZEPHYR_BASE/kernel/pipes.c".1 00000028  00

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-06-17 16:21:51 -04:00
Erwan Gouriou
b20f288a2b soc: stm32: STM32WB: Remove useless package digit
Fixes #16733, applied to STM32WB series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 16:14:45 -04:00
Erwan Gouriou
dbad99ec92 soc: stm32: STM32L4: Remove useless package digit
Fixes #16733, applied to STM32L4 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 16:14:45 -04:00
Erwan Gouriou
191b30927b soc: stm32: STM32L0: Remove useless package digit
Fixes #16733, applied to STM32L0 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 16:14:45 -04:00
Marc Herbert
0370c9b76c cmake: stop destroying intermediate link maps like zephyr_prebuilt.map
The different linker steps are all hardcoded to the output filename
"zephyr.map" and only the last one survives.

Un-harcode.

This removes some confusion when trying to follow who builds
what/when/how and it stops destroying intermediate linking information
useful when tracing/debugging new features or issues in the build.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-06-17 12:02:12 -07:00
Nicolas Pitre
c47bf1fa5e prf.c: implement the ll length modifiers
This allows for printing long long values. Because the code size
increase may be significant, this is made optional on 32-bit targets.
On 64-bit targets this doesn't change the code much as longs and
long longs are the same size so it is always enabled in that case.

The test on MAXFLD has to be adjusted accordingly. Yet, its minimum
value wasn't large enough to store a full-scale octal value, so this
is fixed as well.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-17 10:58:09 -07:00
Nicolas Pitre
2b32059a61 printk: make it 64-bit compatible
On 64-bit systems the most notable difference is due to longs and
pointers being 64-bit wide. Therefore there must be a distinction
between ints and longs. Similar to the prf.c case, this patch properly
implements the h, hh, l, ll and z length modifiers as well as some small
cleanups.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-17 10:28:44 -07:00
Ioannis Glaropoulos
f4f2b13126 tests: kernel: fatal: add HW stack check for priv stack
This commit adds a test in tests/kernel/fatal test-suite, which checks
that the HW stack overflow detection works as expected during a user
thread system call.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 10:27:52 -07:00
Carles Cufi
93e643c5fd doc: extensions: Default to 'all' in 'tool'
In order to expose west to the majority of users, default to 'all'
instead of 'cmake' in the 'tool' option. This means that, unless
otherwise specified, build instructions will be generated for both west
and cmake by default.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-17 10:09:57 -07:00
Carles Cufi
b476643695 doc: Cleanup references to cmake
Clean up some stray references to cmake in doc, boards and
samples that don't make explicit use of the zephyr app extension,
as well as other minor doc fixes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-17 10:09:57 -07:00
Carles Cufi
2670cd4ca1 doc: extensions: Refactor cmake build instructions generation
In order to simplify the current implementation and to prepare for a
change where we default to west as the standard build tool, partially
refactor the generation of cmake-based build instructions:

- Introduce `cd-into` as boolean flag that controls whether build
instructions are generated from the current working directory or from
inside the actual app folder. In the case of cmake, this includes
changing into the build folder to run ninja or make.

- Default to building from the current working directory, in the case of
cmake using the `-B` flag to create the build folder.

- Remove the usage of ZEPHYR_BASE with the `zephyr-app` option.
The option itslef is kept fsince it has semantic value, and a comment is
added when used.

- Consolidate the _generate_make and _generate_ninja functions into a
common code block inside _generate_cmake.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-17 10:09:57 -07:00
Ioannis Glaropoulos
1212604488 kernel: app_memdomain: remove unused defines
Remove unused definition of MEMDOMAIN_ALIGN_SIZE macro
from include/app_memory/app_memdomain.h.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 10:00:22 -07:00
Ioannis Glaropoulos
7da47c6982 include: scripts: fix typos in priv_stacks.ld
This commit fixes some (minor) typos in priv_stack.ld linker script.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 10:00:22 -07:00
Ioannis Glaropoulos
02a3c52084 tests: kernel: userspace: correct address of thread priv stack start
In ARM architecture z_priv_stack_find() returns the start of a
thread's privilege stack; we do not need to subtract the length
of a (possible) stack guard. This commit corrects the assigning
of the start address of a thread privilege stack in
test/kerne/mem_protect/mem_protect/userspace.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 09:47:21 -07:00
Ioannis Glaropoulos
c06a74cd80 CODEOWNERS: update code-onwers' list for gen_priv_stacks.py
Update the list of code owners for gen_priv_stacks.py script.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 12:33:58 -04:00
Ioannis Glaropoulos
a4afe8c0fa scripts: gen_priv_stacks: remove unused variable
Variable priv_stack_decl_size is not used by the script,
so we can remove it.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 12:33:58 -04:00
Alberto Escolar Piedras
36627605ec CODEOWNERS: Clarify behaviour
Clarify the last matching rule, as it is not too intuitive
(developers may have expected that all matching regexes would
be added as code owners)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-06-17 12:33:18 -04:00
Vinayak Kariappa Chettimada
3e56c2cf16 Bluetooth: controller: split: Fix buffer leak on disconnect
Fix pending Tx control buffer leak on supervision timeout.
Queued tx buffers in LLL consists of both data and control
PDUs but only data buffers got correctly released.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-17 15:32:35 +02:00
Ioannis Glaropoulos
ac8e810d94 tests: benchmarks: timing_info: add user space tag
Adding userspace tag for benchmark.timing.userspace test-case.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-17 09:30:24 -04:00
Marti Bolivar
c24e044c6e scripts: runners: check for required programs
Add self.require() checks before running commands. Increase test
coverage, including for this feature, while we are here.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-17 15:06:21 +02:00
Marti Bolivar
c07267a26a scripts: runners: abstract jlink's missing program support
The runners/jlink.py script has a mechanism for erroring out if a host
tool is not installed. Abstract it into runners/core.py and handle it
from run_common.py. This will let it be used in more places.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-17 15:06:21 +02:00
Luiz Augusto von Dentz
db7b9a988b Bluetooth: Make it safe to allocate buffers from TX callback
This makes it safe to allocate buffer from the TX callback by freeing
the context before calling the callback which should wake up the TX
thread had it be pending on add_pending_tx.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-06-17 15:53:06 +03:00
Krzysztof Chruscinski
591b0e1c7a drivers: counter: Add helper macros for logging
Added macros to simplify logging in the counter driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-06-17 10:06:13 +02:00
Krzysztof Chruscinski
10074fc477 tests: drivers: counter: Add device name to zassert strings
Prefix strings printed on zassert failure with device name.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-06-17 10:06:13 +02:00
Erwan Gouriou
a7a5e49796 drivers/clock_control: stm32: Leftover from driver clean up
Some files cleanup was overlooked when STM32 clock_control
was re-factored in #16486.
Fix this by removing the now superfluous files.



Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 03:37:56 -04:00
Erwan Gouriou
ae7ce0792d soc/arm/st_stm32: Replace STM32 specific core selection option
stm32mp1 was adding a STM32 specific Core selection Kconfig
symbol while zephyr generic CPU_CORTEX_M4 could be used for the
same purpose.
Remove STM32 specific symbol and use generic one.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 03:17:46 -04:00
Erwan Gouriou
afb4e4ff0f drivers: spi hci: Add spi dedicated rx thread
Get spi hci driver to define its own rx thread, in order
not to mix with bt own RX thread as driver use bt_recv_prio
that expect to be used in a different thread than BT host one.

Fixes #15714

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-17 03:17:08 -04:00
Anas Nashif
49b22d4fc3 sanitycheck: report tests that never build/run
Add new option --report-excluded to list all those tests with bad
filtering that never build or run. This option produces accurate results
with --all but can be used with default sanitycheck options to see what
does not run/build in CI for example. (limited coverage).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-16 14:13:25 -04:00
Marti Bolivar
ff443c1d23 docs: update west sign docs
Updates for recent changes.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
d371c54f51 scripts: west sign: test for input file existence
Check the CONFIG_BUILD_OUTPUT_HEX and CONFIG_BUILD_OUTPUT_BIN options
are enabled before attempting to build signed versions of these formats.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
2f839da163 scripts: west sign: improve user friendliness
Add more error handling and warnings. Doing this nicely requires a bit
of re-work to the control flow.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
33cbba3457 scripts: west sign: move hex and bin default locations
When signing binaries from multiple build directories, it is
inconvenient to have to specify the output file locations by hand each
time. It's also a little weird that they're not next to zephyr.bin and
zephyr.hex.

Move them to the build directory, next to their unsigned variants.

Suggested by Piotr Mienkowski.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
06c9f8e9e6 scripts: west sign: code style refactor
Let's leave self.args as the actual parsed argument namespace.
Pass the final computed build directory separately.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
3bd07a244a scripts: west sign: make it work again
This got broken in the patches which added the build.dir-fmt config
option when BUiLD_DIR_DESCRIPTION was renamed.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Marti Bolivar
fe91e48418 scripts: runners: add __contains__ to BuildConfiguration
Implement the in operator for this class.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-16 10:16:15 -04:00
Ulf Magnusson
045c809561 scripts/dts: Make extract/flash.py easier to read
Clean up the code a bit:

 - Simplify the loops over the flash 'reg' properties by using range()

 - Build identifier names with a plain .format() where possible. This
   makes them stand out better in the code.

 - Remove redundant variables

 - Move variables close to where they're used

 - Misc. other minor improvements

generated_dts_board.conf and generated_dts_board_unfixed.h were verified
to be identical for disco_l475_iot1 and frdm_kw41z before and after the
cleanup.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-16 10:10:06 -04:00
Kumar Gala
6758e065ae dts/bindings: Cleanup phy bindings
* Fix white space in phy.yaml
* Fix property name in st,stm32-usbphyc.yaml and usb-nop-xceiv.yaml to
  use "#phy-cells" and not "phy-cells"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-16 10:09:51 -04:00
Yannis Damigos
aa8901c332 dts: xtensa: Fix compatible for xtensa lx6
Fix compatible for xtensa lx6

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-06-16 10:07:29 -04:00
Kumar Gala
6589286717 dts/bindings: Add uint8-array type for ethernet mac address
Introduce uint8-array type for local-mac-address as we need to
distinguish it from 'array' meaning a uint32 array.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 13:29:41 -07:00
Piotr Mienkowski
9ac4dc6631 scripts/dts: generate DT_ALIAS_<ALIAS>_<PROP> defines
DT_ALIAS_<ALIAS>_<PROP> defines are a convenient and portable way to get
the device instance name despite different naming conventions used by
the device drivers.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-06-15 11:15:26 -05:00
Alberto Escolar Piedras
132f02eb07 CODEOWNERS: Add reviewer for native_posix docs and flash driver
Add aescolar as reviewer for the posix arch boards
and flash driver

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-06-15 12:03:14 -04:00
Kumar Gala
dca8a62afa drivers/uart_rv32m1_lpuart: Fix DT define usage
The driver was using a mix of instance defines and alias, move to just
using the alias defines so its consistent.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Kumar Gala
d4a0c3a2aa dts: Convert new/missed DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-15 07:14:12 -04:00
Johan Hedberg
4396dc9c71 Bluetooth: Simplify bt_gatt_notify_cb() API
This API had several issues:

 - The parameter types and order were inconsistent with e.g.
   bt_le_adv_start()
 - There were no real users of num_params, which just caused increased
   code size and memory consumption for no good reason.
 - The error handling policy was arbitrary: if one of the
   notifications would fail it would be impossible for the caller to
   know if some notifications succeeded, i.e. at what point the
   failure happened. Some callers might also want to make note of the
   failure but continue trying to notify for the remaining parameters.

The first issue is easily fixable, but because of the other two I
think it's best we don't have this code as part of the stack, rather
require whoever needs it to do the for loop themselves. It's just a
few lines of code, so the benefit of having this in the stack was
anyway quite minimal.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-06-15 10:37:19 +03:00
Ulf Magnusson
a84ded74ea dts: Replace status = "ok" with status = "okay"
The DT spec. only has "okay" and not "ok". The Linux kernel has around
12k "okay"s and 300 "ok"s.

The scripts/dts scripts only check for "disabled", so should be safe re.
those at least.

The replacement was done with

    git ls-files | xargs sed -i 's/status\s*=\s*"ok"/status = "okay"/'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-06-14 19:51:13 -05:00
Kumar Gala
b28abf9e90 dts/binding: Update compatible type in base.yaml
compatible should have the type of string-array not string.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 17:38:17 -04:00
Kumar Gala
eb00774c87 dts/bindings: Rename stringlist to string-array
* Rename stringlist to string-array to be closer inline with upstream
  dtschema definitions.
* Add string-array to the device_node.yaml.template

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 17:38:17 -04:00
Marti Bolivar
343f5baed5 west.yml: update open-amp SHA
Bring in a small build system change.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-14 17:37:01 -04:00
Marti Bolivar
c98acc2a9a getting_started: changes for custom toolchains
This option uses a lot of typing, so point out there's a way to save
keystrokes using -C.

Tweak the language around the target toolchain.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-14 14:19:09 -04:00
Marti Bolivar
a506baf7f6 doc: clear up qemu + zephyr sdk interaction
Make it clearer that the note about setting QEMU_BIN_PATH only applies
if you've got the Zephyr SDK installed.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-06-14 14:19:09 -04:00