Commit graph

41120 commits

Author SHA1 Message Date
Andrzej Głąbek
036791364c usb: kconfig: nrf52840: Enable REMOTE_WAKEUP option only when needed
This patch removes the "hard" selection of the USB_DEVICE_REMOTE_WAKEUP
Kconfig option for USB devices made on the nRF52840 SoC. Now it's up to
the application to decide if it wants to enable the option. This change
makes it possible to pass the USB3CV Chapter 9 Tests for applications
that don't use the remote wakeup feature, since when a USB device only
reports that it supports this feature, and the mentioned option makes
it to do so, one of the test cases expects the USB device to actually
perform the remote wakeup. And when the feature is not reported as
supported, the test case is skipped.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-06-27 12:17:45 +02:00
David B. Kinder
b30b52abd5 doc: fix doxygen INPUT path; brand html output
Clean up the INPUT paths for doxygen scanning:

- directory scans include sub-directories so no need
  to include them explicitly
- remove excluded (legacy) includes that no longer exist

Sync directory changes in the CMakeLists.txt (as noted in the comments)

Add content to the home page of the doxygen-generated HTML, and add a
Zephyr branding theme.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>

Fixes: #6773
2019-06-26 21:24:33 -04:00
Alexander Wachter
7a73bb7efe samples: CAN: Add FRDM-K64F defconfig
This commit adds a board defconfig for the FRDM-K64F board.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-06-26 16:05:51 -05:00
Alexander Wachter
5946028671 boards: frdm-k64f: Enable CAN support
This commit enables CAN support for the FRDM-K64F board.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-06-26 16:05:51 -05:00
Alexander Wachter
14e31ba419 soc: nxp: k6x: Add CAN support
This commit adds CAN support for Kinetis K6x family.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-06-26 16:05:51 -05:00
Alexander Wachter
f5b227641c drivers: can: mcux_flexcan: Add support for MK64
Add support for Kinetis MK64 series.
Interrupts are adapted because MK64 has other interrupts than KEx1F.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-06-26 16:05:51 -05:00
Parthiban Nallathambi
b7b9458ec6 wifi: eswifi: add UDP support
Add UDP support for eswifi driver. eswifi now can co-exist
with TCP and UDP functionality with 4 as max socket connection.

Tested UDP with custom DNS sample (wifi connect + DNS)

Signed-off-by: Parthiban Nallathambi <parthitce@gmail.com>
2019-06-26 23:20:22 +03:00
Armando Visconti
ab4f280661 driver/sensor: lis2dw12: make use of STdC definitions
Port the lis2dw12 sensor driver on top of the lis2dw12_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-06-26 15:41:40 -04:00
Armando Visconti
fe74224e43 modules/hal_st: Add stmemsc HAL library
Add stmemsc (STdC) HAL i/f module reference.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2019-06-26 15:41:40 -04:00
Erwan Gouriou
8e76e68f94 west: Update hal_stm32 module to head following cube updates
This update contains the following changes

* Introduce STM32G0 Cube V1.2.0
* Update API for STM32MP1 IPCC
* Update Cube version for following series:
STM32F0XX: from version: V1.9.0 to version: V1.10.1
STM32F1XX: from version: V1.6.1 to version: V1.7.0
STM32F4XX: from version: V1.21.0 to version: V1.24.1
STM32F7XX: from version: V1.12.0 to version: V1.15.1
STM32L0XX: from version: V1.10.0 to version: V1.11.2
STM32L1XX: from version: V1.8.0 to version: V1.9.0
STM32L4XX: from version: V1.13.0 to version: V1.14.0
STM32WBXX: from version: V1.0.0 to version: V1.1.1
* Includes a fix for L4 following package update
* Includes a fix for G0 following package introduction

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-06-26 15:40:37 -04:00
Vinayak Kariappa Chettimada
ebda8fe1ef mailmap: Fix entry needing both name and email replace
Fix mailmap entry to replace both name and multiple email
aliases.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-26 13:54:03 -04:00
David B. Kinder
3a16001cdd doc: simplify doc redirection messages
We have directives in conf.py to create redirect links for docs that
have been moved around because of content reorganization.  Reduce the
number of messages written out while debugging was going on and add some
comments to conf.py to explain how the directive works.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-26 12:43:23 -04:00
Carles Cufi
41f1f648f6 west: runners: Guess build folder
When using a build folder format with build.dir-fmt that includes any
parameters that need resolving, the west runners cannot find the folder
since the required information (board, source dir or app) is not
available.
Add a very simple heuristic to support the case where a build folder
starts with a hardcoded prefix (for example 'build/') and a single build
is present under that prefix.
The heuristic is gated behind a new configuration option:
build.guess-dir

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-26 11:50:26 -04:00
Yaël Boutreux
2192f1d0a4 boards: arm: stm32mp157c_dk2: Add Arduino R3 connector definition
Add Arduino R3 connector equivalence to the stm32mp157c_dk2.

Signed-off-by: Yaël Boutreux <yael.boutreux@st.com>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
2019-06-26 09:36:52 -05:00
Vinayak Kariappa Chettimada
4fe004ad87 Bluetooth: controller: Fix handling zero length L2CAP start frame
Added a fix handling L2CAP start frame with payload length
of zero which otherwise sent zero length data start PDU on
air.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-06-26 16:32:14 +02:00
Laczen JMS
5f19c8160a subsys/settings: Update bluetooth module
Updated the bluetooth module to use static handlers. Removed the
old bt specific static registration.

The routine bt_settings_init() is still calling settings_init() which
IMO is not needed anymore.

Updates:

changed SETTINGS_REGISTER_STATIC() to SETTINGS_STATIC_HANDLER_DEFINE()
changed settings_handler_stat type to settings_handler_static type
removed NULL declarations
renamed bt_handler to bt_settingshandler, as bt_handler already exists.
renamed all bt_XXX_handler to bt_xxx_settingshandler to avoid any
overlap.
changed SETTINGS_STATIC_HANDLER_DEFINE() to create variable names from
_hname by just prepending them with settings_handler_.
updated all bt_xxx_settings_handler to just bt_xxx.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2019-06-26 16:31:01 +02:00
Laczen JMS
c20ff1150f subsys/settings: Enable handler ROM registration
Add the possibility to register handles to ROM using a new macro
SETTINGS_REGISTER_STATIC(handler), the handler is of type
settings_handler_stat and has to be declared as const:

```
const struct settings_handler_stat test_handler = {
	.name = "test", /* this can also be "ps/data"
	.h_get = get,
	.h_set = set,
	.h_commit = NULL, /* NULL defines can be ommited */
	.h_export = NULL  /* NULL defines can be ommited */
};
SETTINGS_REGISTER_STATIC(test_handler);
```

To maintain support for handlers stored in RAM (dynamic handlers)
`CONFIG_SETTINGS_DYNAMIC_HANDLERS`must be enabled, which is by default.

When registering static handlers there is no check if this handler has
been registered earlier, the latest registered static handler will be
considered valid for any set/get routine, while the commit and export
routines will be executed for both registered handlers.

When a dynamic handler is registered a check is done to see if there was
an earlier registration of the name as a static or dynamic handler
registration will fail.

To get to the lowest possible RAM usage it is advised to set
`CONFIG_SETTINGS_DYNAMIC_HANDLERS=n`.

Updates:

a. Changed usage of RAM to DYNAMIC/dynamic, ROM to STATIC/static
b. Updated settings.h to remove added #if defined()
c. Make static handlers always enabled
d. Corrected error introduced in common-rom.ld.
e. Changed return value of settings_parse_and_lookup to
   settings_handler_stat type to reduce stack usage.
f. Updated the name generated to store a handler item in ROM. It now
   uses the name used to register in combination with the line where
   SETTINGS_REGISTER_STATIC() is called.
g. renamed settings_handler_stat type to settings_handler_static
h. renamed SETTINGS_REGISTER_STATIC to SETTINGS_STATIC_HANDLER_DEFINE()

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2019-06-26 16:31:01 +02:00
Howard Liu
f91d8386a3 doc: fix build command on Windows for VEGAboard
The path was changed during generating Ninja-based build system,
so the path of link script file was wrong when testing the
cross-compiler. Fix it by giving the absolute path for link script.

Signed-off-by: Howard Liu <howardliu7874@hotmail.com>
2019-06-26 09:15:03 -05:00
Ioannis Glaropoulos
1e29d40e87 tests: kernel: arm runtime nmi: add arm tag
Add the arm tag to tests/kernel/arm_runtime_nmi test.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:55:13 -04:00
Ioannis Glaropoulos
e5c0e3caa1 tests: kernel: submit a simple test for zero-latency irqs
The commit contributes a simple test for the Zero-Latency
IRQ feature (CONFIG_ZERO_LATENCY_IRQS=y) for ARM platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:55:13 -04:00
Anas Nashif
94cb13fffe arc: logging: fix logging expression
Fix log expressions to use %lx instead of %x for uintptr_t variables.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-26 09:51:14 -04:00
Ioannis Glaropoulos
ff07fc7f0a lib: libc: fix alignment of HEAP base address for ARM
In ARM builds with support for user mode, i.e. with
CONFIG_USERSPACE=y, we need to align the beginning
of the heap space, to respect the ARM MPU region
alignment requirements.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:11:45 -04:00
Ioannis Glaropoulos
53ec19c3cc lib: libc: newlib: define USED_RAM_END_ADDR only where it is needed
USED_RAM_END_ADDR is not used when Kconfig option
CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE is defined,
therefore, we do not need to define the macro in
that specific case.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:11:45 -04:00
Kumar Gala
8226aa128b samples: out_of_tree_board: remove board.h
We don't use board.h in general so lets remove it from this sample.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-26 09:11:07 -04:00
Wayne Ren
54b229fc42 soc: arc: optmize and bug fix the compile options
* when -mcpu is given, e.g. -mcpu=em4_dmips,-mnorm,-mdiv_em
etc. are already given, no need to duplicate

* use zephyr_compiler_options to replace zephyr_cc_option
zephyr_cc_option will do compile option check first then add
the checked options into option list. It's too strict that makes
options like -mfpu, -mmpy-option cannot be added.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-06-26 09:10:44 -04:00
Wayne Ren
27fbe34718 soc: nsim: nsim em targets are EM4_FPUDA
the nsim em targets in zephyr are configured
as EM4_FPUDA

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-06-26 09:10:44 -04:00
Nicolas Pitre
659fa0d57d lifo/fifo: first word is not always first 4 bytes
The first word is used as a pointer, meaning it is 64 bits on 64-bit
systems. To reserve it, it has to be either a pointer, a long, or an
intptr_t. Not an int nor an u32_t.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-26 09:08:42 -04:00
Anas Nashif
002bebdf63 mailmap: Update mailmap with full names and emails
Helps with `git shortlog -ns`

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-26 09:07:27 -04:00
David Leach
70f25eb329 logging: Fix misspelled CONFIG_RISCV32
The conditional CONFIG_RISCV32 was misspelled in is_rodata() resulting
in the test failing all strings that are in RODATA section.
Additionally, it was using wrong section names for riscv.

Fixes #17065

Signed-off-by: David Leach <david.leach@nxp.com>
2019-06-26 09:07:01 -04:00
Ioannis Glaropoulos
39c8451422 kernel: mem_domain: fix warning in ASSERT expression
While fixing the ASSERT expressions in mem_domain.c to use
%lx instead of %x for uintptr_t variables, commit
f32330b22c has overlooked
one ASSERT expression specific to ARMv8-M. This causes
printk compilation warnings for ARMv8-M builds, so we
provide a fix here.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-06-26 09:06:38 -04:00
Johan Hedberg
46ea1df2ec Bluetooth: Fix not using log_strdup() for bt_uuid_str()
The string returned by bt_uuid_str() is not in ROM so log_strdup()
must be used on it. This also eliminates the following kind of warning
messages: "<err> log: argument 3 in log message "%s: start_handle
0x%04x end_handle 0x%04x type %s" missing log_strdup()."

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-06-26 13:37:44 +02:00
Manivannan Sadhasivam
9ad071cdbe boards: arm: Add 96Boards Avenger96 board support
Add board support for 96Boards Avenger96 board from Arrow Electronics
based on STM32MP157A MPU from ST Microelectronics. This board is one
of the consumer editions boards of the 96Boards family following the
Extented CE form factor. More information about this board can be found
in 96Boards website: https://www.96boards.org/product/avenger96/

By default Zephyr console output is available via RAM console, but it
can also be changed to UART7 exposed as UART0 on 40 pin LS header.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2019-06-26 07:37:35 -04:00
Manivannan Sadhasivam
12faf11f75 dts: arm: st: mp1: Add missing uart4 and uart7 pinmux nodes
Add missing uart4 and uart7 pinmux nodes for STM32MP157 MPU.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2019-06-26 07:37:35 -04:00
Manivannan Sadhasivam
4d05cdfac0 drivers: pinmux: stm32mp1: Add missing UART4 and UART7 pinctrl definitions
Add missing UART4 and UART7 pinctrl definitions for STM32MP157 MPU.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2019-06-26 07:37:35 -04:00
Scott Worley
7808b6e92c ext : hal : microchip Header updates for MEC1501
Updated MEC1501 HAL headers. Add interrupt routing defines for timers.
Fix eSPI virtual wire source access. Add new headers for Port80
capture and TFDP.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2019-06-26 07:16:47 -04:00
Carles Cufi
d4083b6638 Bluetooth: hci_uart: Assert if device is NULL
Assert if the UART device is NULL to help with debugging whenever
there's an issue locating the correct UART instance.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-26 12:37:04 +02:00
Carles Cufi
3b3bbc1ee0 Bluetooth: hci_uart: Use DT for the hci_uart UART
Use Device Tree,and in particular a new 'bt-c2h-uart' to select which
UART is being used to communicate with an external BLE Host when acting
as a Controller.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-06-26 12:37:04 +02:00
Andy Ross
c0630346c8 Revert "tests: tickless_concept: Fix slicing time measurement"
Unfortunately this seems to have introduced spurious failures on (at
least) qemu_x86 and qemu_xtensa.

The change limits the timeslice tolerance to +/- 1ms, which isn't
necessarily correct when the tick rate is less than 1ms (though it
will probably work on deterministic hardware as long as the system is
hitting the target at exactly the right tick), and isn't even
theoretically achievable on emulation environments where timing
granularity is limited by the host scheduling quantum.

What this needs to do is check the deadline is off by at most one
tick, and trust the platform integration to have set the tick rate
appropriately.

(I do worry that the earlier version of the test was trying to set the
limit at half the TICKLESS_IDLE_THRESHOLD, though -- that seems weird,
and hints that maybe the test is trying to do something more
elaborate?)

Fixes #17063.

This reverts commit 62c71dc4d8.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-06-26 09:59:47 +02:00
Marc
c790d5b498 Apply David's English corrections from code review
Co-Authored-By: David Kinder <david.b.kinder@intel.com>
2019-06-25 23:34:41 -04:00
Marc Herbert
3022fcecc6 doc: how to unset Clear Linux' CFLAGS and CXXFLAGS
Clear Linux exports to all users a list of "aggressive" compiler and
linker flags. Zephyr's CMake build system will either warn or fail
because of these. Add one magic command that solves the issue.

More background information at https://superuser.com/a/1452523/111302

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-06-25 23:34:41 -04:00
David B. Kinder
8de9cc7079 doc: use @rst/@endrst for ReST in headers
Folks found the use of @rststar/@endrststar non-intuitive (wanted to use
@rststart).  The "star" was there indicating the doxygen comment lines
had a leading asterisk that needed to be stripped, but since our
commenting convention is to use the leading asterisk on continuation
lines, the leading asterisk is always there.  So, change the doxygen
alias to the more expected @rst/@endrst.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-25 23:33:55 -04:00
Anas Nashif
e573970abe CODEOWNERS: add / at the end of a directory
missed a trailing slash at the end of what is a directory.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 23:29:46 -04:00
Nicolas Pitre
f32330b22c stdint.h: streamline type definitions
Compilers (at least gcc and clang) already provide definitions to
create standard types and their range. For example, __INT16_TYPE__ is
normally defined as a short to be used with the int16_t typedef, and
__INT16_MAX__ is defined as 32767. So it makes sense to rely on them
rather than hardcoding our own, especially for the fast types where
the compiler itself knows what basic type is best.

Using compiler provided definitions makes even more sense when dealing
with 64-bit targets where some types such as intptr_t and size_t must
have a different size and range. Those definitions are then adjusted
by the compiler directly.

However there are two cases for which we should override those
definitions:

* The __INT32_TYPE__ definition on 32-bit targets vary between an int
  and a long int depending on the architecture and configuration.
  Notably, all compilers shipped with the Zephyr SDK, except for the
  i586-zephyr-elfiamcu variant, define __INT32_TYPE__ to a long int.
  Whereas, all Linux configurations for gcc, both 32-bit and 64-bit,
  always define __INT32_TYPE__ as an int. Having variability here is
  not welcome as pointers to a long int and to an int are not deemed
  compatible by the compiler, and printing an int32_t defined with a
  long using %d makes the compiler to complain, even if they're the
  same size on 32-bit targets. Given that an int is always 32 bits
  on all targets we might care about, and given that Zephyr hardcoded
  int32_t to an int before, then we just redefine __INT32_TYPE__ and
  derrivatives to an int to keep the peace in the code.

* The confusion also exists with __INTPTR_TYPE__. Looking again at the
  Zephyr SDK, it is defined as an int, even even when __INT32_TYPE__ is
  initially a long int. One notable exception is i586-zephyr-elf where
  __INTPTR_TYPE__ is a long int even when using -m32. On 64-bit targets
  this is always a long int. So let's redefine __INTPTR_TYPE__ to always
  be a long int on Zephyr which simplifies the code, works for both
  32-bit and 64-bit targets, and mimics what the Linux kernel does.
  Only a few print format strings needed adjustment.

In those two cases, there is a safeguard to ensure the type we're
enforcing has the right size and fail the build otherwise.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:29:22 -04:00
Nicolas Pitre
f57ba2d30c cmake: toolchain_cc_imacros: don't use space separated arguments
Because CMake explicitly deduplicates arguments, it is not possible
to use toolchain_cc_imacros() multiple times as the later "-imacros"
are stripped away, leaving the associated file arguments dangling.
The documented workaround in the CMake manual involves some "SHELL:..."
construct but that doesn't get through zephyr_compile_options()
undammaged.

Let's simply remove this issue altogether by replacing "-imacros x.h"
with the joined form "--imacros=x.h" instead. Both gcc and clang
support this syntax.

FYI, this joined form is also available for other arguments such as:

	-include x.h   -->   --include=x.h
	-A foo         -->   --assert=foo
	-D foo         -->   --define-macro=foo
	-U foo         -->   --undefine-macro=foo

Etc.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:29:22 -04:00
Nicolas Pitre
d4b60d691c malloc: no longer need to round mempool's max_sz
Since commit 465b2cf31b this value is rounded at compile time instead.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:24:53 -04:00
Nicolas Pitre
744df1ef82 mempool: don't over-size the free block bitmap
Currently, the free block bitmap is roughly 4 times larger than it
needs to, wasting memory.

Let's assume maxsz = 128, minsz = 8 and n_max = 40.

Z_MPOOL_LVLS(128, 8) returns 3. The block size for level #0 is 128,
the block size for level #1 is 128/4 = 32, and the block size for
level #2 is 32/4 = 8. Hence levels 0, 1, and 2 for a total of 3 levels.
So far so good.

Now let's look at Z_MPOOL_LBIT_WORDS(). We get:

Z_MPOOL_LBIT_WORDS_UNCLAMPED(40, 0) = ((40 << 0) + 31) / 32 = 2
Z_MPOOL_LBIT_WORDS_UNCLAMPED(40, 1) = ((40 << 2) + 31) / 32 = 5
Z_MPOOL_LBIT_WORDS_UNCLAMPED(40, 2) = ((40 << 4) + 31) / 32 = 20

None of those are < 2 so Z_MPOOL_LBIT_WORDS() takes the results from
Z_MPOOL_LBIT_WORDS_UNCLAMPED().

Finally, let's look at _MPOOL_BITS_SIZE(. It sums all possible levels
with Z_MPOOL_LBIT_BYTES() which is:

  #define Z_MPOOL_LBIT_BYTES(maxsz, minsz, l, n_max)    \
        (Z_MPOOL_LVLS((maxsz), (minsz)) >= (l) ?        \
         4 * Z_MPOOL_LBIT_WORDS((n_max), l) : 0)

Or given what we already have:

Z_MPOOL_LBIT_BYTES(128, 8, 0, 40) = (3 >= 0) ? 4 * 2  : 0 = 8
Z_MPOOL_LBIT_BYTES(128, 8, 1, 40) = (3 >= 1) ? 4 * 5  : 0 = 20
Z_MPOOL_LBIT_BYTES(128, 8, 2, 40) = (3 >= 2) ? 4 * 20 : 0 = 80
Z_MPOOL_LBIT_BYTES(128, 8, 3, 40) = (3 >= 3) ? 4 * ??

Wait... we're missing this one:

Z_MPOOL_LBIT_WORDS_UNCLAMPED(40, 3) = ((40 << 6) + 31) / 32 = 80

then:

Z_MPOOL_LBIT_BYTES(128, 8, 3, 40) = (3 >= 3) ? 4 * 80 : 0 = 320

Further levels yeld (3 >= 4), (3 >= 5), etc. so they're all false and
produce 0.

So this means that we're statically allocating 428 bytes to the bitmap
when clearly only the first 3 Z_MPOOL_LBIT_BYTES() results for the
corresponding 3 levels that we have should be summed e.g. only
108 bytes.

Here the code logic gets confused between level numbers and the number
levels, hence the extra allocation which happens to be exponential.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:24:05 -04:00
Nicolas Pitre
1140bd090c mempool: properly use the inline free block bitmap
The free block bitmap uses either extra memory specified by a pointer
in struct sys_mem_pool_lvl or the space occupied by that pointer
directly if the bitmap length is small enough to fit it.

But the test is wrong. the inline bitmap should be used if the number
of required bits is smaller or _equal_ to the pointer size. Not doing so
would wrongly bounce the free block bitmap to extra memory when the
number of blocks is exactly 32, which is in disagreement with
Z_MPOOL_LBIT_WORDS() that correctly returns 0 in that case.

In theory that mean that this bug would causes an overflow of the free
block bitmap whenever one level has exactly 32 blocks. But right now
there is a separate bug fixed separately that over-sizes the extra block
bitmap mitigating this bug.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:24:05 -04:00
Nicolas Pitre
cf5c22d8be sflist: SYS_SFLIST_FLAGS_MASK must be a long not an int
When splitting the pointer from the flag, ~SYS_SFLIST_FLAGS_MASK remains
a 32-bit value because of the lack of an L qualifier. Let's qualify it
with UL so the top half of 64-bit pointers is not truncated.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-06-25 23:21:39 -04:00
Anas Nashif
549bd60624 CODEOWNERS: remove non-existing files
Remove entries of moved files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 23:16:35 -04:00
Andrew Boie
643f86f1f2 tests: thread_apis: exercise some system calls
We had no system call coverage for k_thread_suspend
and k_thread_resume.

Some unnecessary cleanup tasks in the test case have
been removed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-06-25 22:45:09 -04:00