Use the white box validation and test rig added as part of the
sys_heap work. Add a layer that puts hashed cookies into the blocks
to detect corruption, check the validity state after every operation,
and enumerate a few different usage patterns:
+ Small heap, "real world" allocation where the heap is about half
full and most allocations succeed.
+ Small heap, "fragmentation runaway" scenario where most allocations
start failing, but the heap must remain consistent.
+ Big heap. We can't test this with the same exhaustive coverage
(many re/allocations for every byte of storage) for performance
reasons, but we do what we can.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The existing mem_pool implementation has been an endless source of
frustration. It's had alignment bugs, it's had racy behavior. It's
never been particularly fast. It's outrageously complicated to
configure statically. And while its fragmentation resistance and
overhead on small blocks is good, it's space efficiencey has always
been very poor due to the four-way buddy scheme.
This patch introduces sys_heap. It's a more or less conventional
segregated fit allocator with power-of-two buckets. It doesn't expose
its level structure to the user at all, simply taking an arbitrarily
aligned pointer to memory. It stores all metadata inside the heap
region. It allocates and frees by simple pointer and not block ID.
Static initialization is trivial, and runtime initialization is only a
few cycles to format and add one block to a list header.
It has excellent space efficiency. Chunks can be split arbitrarily in
8 byte units. Overhead is only four bytes per allocated chunk (eight
bytes for heaps >256kb or on 64 bit systems), plus a log2-sized array
of 2-word bucket headers. No coarse alignment restrictions on blocks,
they can be split and merged (in units of 8 bytes) arbitrarily.
It has good fragmentation resistance. Freed blocks are always
immediately merged with adjacent free blocks. Allocations are
attempted from a sample of the smallest bucket that might fit, falling
back rapidly to the smallest block guaranteed to fit. Split memory
remaining in the chunk is always returned immediately to the heap for
other allocation.
It has excellent performance with firmly bounded runtime. All
operations are constant time (though there is a search of the smallest
bucket that has a compile-time-configurable upper bound, setting this
to extreme values results in an effectively linear search of the
list), objectively fast (about a hundred instructions) and amenable to
locked operation. No more need for fragile lock relaxation trickery.
It also contains an extensive validation and stress test framework,
something that was sorely lacking in the previous implementation.
Note that sys_heap is not a compatible API with sys_mem_pool and
k_mem_pool. Partial wrappers for those (now-) legacy APIs will appear
later and a deprecation strategy needs to be chosen.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
When retrying failed tests, make sure we keep old results and only
update those tests that were retried.
Also, remove duplication of code for creating the reports and make the
report function a bit more generic.
sanitycheck.xml is now listing or tests, not only the test application.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
I personally don't find it very useful to have to maintain prj.conf
and prj_spi.conf for this sample. The information we need to make
this application "just work" with regards to the bus is available in
the devicetree, and Kconfig can now access it using
dt_compat_on_bus().
Do so, enabling I2C and SPI appropriately when a sensor of the right
type is on either of those buses.
If no sensors are enabled, the user gets the build-time error message
in main.c about no devices being found.
This approach is prone to the "stuck symbol" Kconfig problem covered
in our documentation, so a pristine build is necessary to change the
default settings from a previous build.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Use instance zero of the compatible to get the device instead of
fixing a label. Print the used label for help debugging, and the
results of finding the device (or not), with a hint about what might
have gone wrong in case of failure.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This can be used from Kconfig to detect if any enabled nodes of a
compatible are on a bus. This can be useful if a compatible might
appear on multiple buses, to enable them by default from application
code without having to change prj.conf settings depending on what's in
the devicetree.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The nrf52840-DK doesn't have this sensor built-in, so it's likely
users will be getting this sensor from a breakout board. The ones that
Sparkfun and Adafruit sell pull up the LSB address pin, so the default
address is 0x77 on those boards.
Let's follow along with them instead of using 0x76, because those are
the boards that come up first in the results when you google "BME280
breakout board" from where I'm sitting.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This helps debug issues with the device. Samples should try to be
helpful to first-time users. Send printk() to logging so it doesn't
fight over the UART.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
The 32 KiBy bulk erase command was being invoked without respecting
the flag that indicates it's supported. Make the invocation
conditional.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Makes a common link_closed function for PB-GATT, getting rid of a bug
where cb_data is reset before the link closed callback. Also ensures
that the link close and reset order is the same in both scenarios.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
This commit fixes the incorrect memory (FLASH and SRAM) size
specification in the device tree and the board test yaml files.
The `qemu_cortex_r5` board (using `fdt-single_arch-zcu102-arm.dtb` FDT)
has 64MiB RAM at the address 0 and 32MiB QSPI flash at 0xc0000000.
QEMU `info mtree`:
0000000000000000-ffffffffffffffff (prio 0, i/o): memory@00000000
0000000000000000-000000000002ffff (prio 0, ram): ddr_bank1_1@0x0
0000000000030000-000000000003ffff (prio 0, ram): ddr_bank1_2@0x30000
0000000000040000-0000000003ffffff (prio 0, ram): ddr_bank1_3@0x40000
00000000c0000000-00000000c1ffffff (prio 0, i/o): lqspi
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Use the new devicetree API. Remove per-board enabling of ADC_0 by
setting ADC_0 to default y when the 'adc' node label points at an
enabled node of the expected compatible (depending on SoC).
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Fixes: #23922, #24252, #11103
This commit switches to use the find_package(Python3) introduced with
CMake 3.12.
This removes the need for a Zephyr backport of Python detection module.
The search order for Python3 is following CMake search order and can be
controlled through CMake flags (See CMake documentation).
Default it will use the Python version found in PATH.
If multiple Python3 versions are found in PATH, the newest version will
be selected (Can be controlled using `Python3_FIND_STRATEGY`)
Using find_package(Python3) also ensures Python2.7 will never be
selected, issue #11103, which was re-introduced in Zephyr.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Add bq274xx sample with reading and showing all
possible values from the sensor.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
Now that all entropy drivers use DTS we can remove HAS_DTS_ENTROPY being
set everywhere as well as Kconfig ENTROPY_NAME since that is now coming
from DT_ENTROPY_NAME.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Replace CONFIG_ENTROPY_NAME with DT_CHOSEN_ZEPHYR_ENTROPY_LABEL. We now
set zephyr,entropy in the chosen node of the device tree to the entropy
device.
This allows us to remove CONFIG_ENTROPY_NAME from dts_fixup.h. Also
remove any other stale ENTROPY related defines in dts_fixup.h files.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Add a devicetree/zephyr.h header, which is meant to contain
definitions for /chosen properties specific to Zephyr.
Currently, this just deals with zephyr,entropy. We add a
DT_CHOSEN_ZEPHYR_ENTROPY_LABEL macro which expands to the label for the
node pointed to by zephyr,entropy.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Move the include of files from include/devicetree/*.h to the end so that
when those files are processes they have access to all previous defined
macros.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Since gen_defines.py is run using execute_process() at CMake time, the
entire build system must be regenerated if it changes. Add the
dependency tracking to make this possible.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Add generation of the following macros:
DT_N_<node-id>_P_<prop-id>_NAME_<NAME>_EXISTS
DT_N_<node-id>_P_<prop-id>_IDX_<idx>_EXISTS
This will be useful to check availability of named or indexed
property like dmas/dma-names.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
dmas and dma-names properties could be used by a wide range
of potential dma client, hence put them in base.yaml, as
optional properties.
Since current stm32-i2s driver implementation only support
dma, set these properties as required.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit updates the west.yml to point to the CMSIS module commit
that updates the CMSIS version to 5.7.0.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Pun all workqueue tests under 1 doxygen group.
This removes kernel_workqueue_triggered_tests and
kernel_workqueue_delayed_tests doxygen groups.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Those are used only in tests, so remove them from kernel Kconfig and set
them in the tests that use them directly.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The last user of the .conf file format DTS data has been removed. We
can now remove the generation and associated support for the .conf file.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The variables passed by sanitycheck and west were being ignored because
cmake knows nothing about them.
Fixes#24178
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Use the UNALIGNED_GET() macro instead of the
flash_sam0_read_unaigned_u32() function to ensure
word alignment of the source address.
Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
drivers: flash: sam0: fix whitespace
Fix checkpass whitespace error.
Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
At least one flash driver requires that the source and destination
buffers be word-aligned. Annotate the synthesized definitions to make
sure this happens.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>