It is possible that the device driver API pointer is null.
For example if the device driver returns an error, the device
code will make the API pointer NULL so that the API would not
be used. This can cause errors in networking code where we
typically do not check the NULL value.
Fixes#15003
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
- renaming functions to better names
- reordering functions place (register, then unregister for instance)
- centralizing logs to relevant place
Fixes#8722
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Also, there is no need for unspecified address bit. If specified address
bit is not set, then it will be obvious address is unspecified. Reducing
the amount of bits from 6 to 4.
This permits to reduce net_conn structure of 4 bytes. Its size is as
before indroducing node attribute.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This will optimize path when unused an connection is required or when
looking up a used one.
That said, at this stage, it bloats up the net_conn structure with 4
added bytes. More optimization will overcome this drawback.
Fixes#8722
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Most of present #ifdef can be removed via using IS_ENABLED() macro.
Only small part of cache related logic still require #ifdef.
Fixes#8722
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
There were various flaws in it that motivated its removal:
- No hash collision handling mechanism. In case that would happen, the
behavior of the network connection would be unknown. This is the main
drawback
- The lookup is not that much more efficient than the default one. The
only difference of gain is in connection comparison (a u32t comparison
vs a full connection compare). But the list handling is the same. It's
made worse by the presence of a negatives match array which can be
easily filled in and becomes then fully usless, appart from consuming
CPU. As well as adding a new connection: it requires the whole cache
to be cleared which is unefficient.
- Not memory efficient, even compared to a proper hash table.
Two arrays instead of one etc...
All of this could be fixed by using a proper hash table, though it
remains to be seen if such object could fit in Zephyr core.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
During net_pkt/net_context API changes, some ip handling blocks were
ordered ipv4 first, ipv6 second. While it is the contrary everywhere
else. So reordering to get things consistent.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
- Not all #ifdef can be removed: those which have a dedicated attribute
in struct net_context.
- For CONFIG_NET_CONTEXT_CHECK: switching the NET_ASSERT_INFO to
NET_DBG (simpler to read and anyway an error code is returned)
Fixes#8725
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It will help to use IS_ENABLED in place of #ifdef in relevant place.
Only struct net_if uses this structure.
In case only IPv4 is used, it will bloat up this struct by 12 bytes.
There are few reasons why this is "ok" in this case:
- On limited rom/ram system it will be unlikely to find a lot of
network interfaces so it should not harm much to raise the size of
struct net_addr.
- If IPv4 is the only enabled IP version, it gains a good amount of
rom/ram to discard IPv6 support so it is fine to steal a bit of this
gain to bloat up a bit struct net_addr.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thit will help removing usage of #if defined(CONFIG_NET_OFFLOAD) in
relevant places.
Note that static inlines are used instead of #define foo(...), to keep
the parameter check at build time.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Partially revert commit ea177e785c
("usb: dfu: set bwPollTimeout dynamically")
Introduced fix does not work proper because there is no way to be
sure that a control stage had success before start erase process.
Instead IMG_ERASE_PROGRESSIVELY configuration should be used
if the erase of the flash takes longer time.
resolves: #15497
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
The Holyiot YJ-16019 board is a small, coin cell driven board based on
the Nordic Semiconductors nRF52832. It provides one LED and one push
button.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Zephyr implementation of OpenThreads utilsFlashErasePage platform
function did not disable flash protection before calling `flash_erase`
function. This resulted in an error instead of actual flash erase on
platforms that properly implement flash write protection.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This reverts commit bd24b31139.
While the test case failure described in #14186 is associated with the
cycle-based busy-wait implementation, that test is fragile, and fails
less frequently once the incongruence between ticks-per-second and the
32 KiHz RTC clock are resolved. It also assumes that the system clock
is more stable than the infrastructure underlying the the busy-wait
implementation, which is not necessarily true.
The gross inaccuracies in the standard busy-wait on Nordic described in
issue #11626 justify restoring the custom solution.
As this applies to all Nordic devices, move the setting to the top-level
Kconfig.defconfig.
See: https://github.com/zephyrproject-rtos/zephyr/issues/11626#issuecomment-487243369
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The default system clock on all Nordic devices is based on a 32 KiHz
(2^15 Hz) timer. Scheduling ticks requires that deadlines be specified
with a timer counter that aligns to a system clock. With the Zephyr
default 100 clocks-per-sec configuration this results in 100 ticks every
32700 ticks of the cycle timer. This reveals two problems:
* The uptime clock misrepresents elapsed time because it runs 0.208%
(68/32768) faster than the best available clock;
* Calculation of timer counter compare values often requires an integer
division and multiply operation to produce a value that's a multiple
of clock-ticks-per-second.
Integer division on the Cortex-M1 nRF51 is done in software with a
(value-dependent) algorithm with a non-constant runtime that can be
significant. This can produce missed Bluetooth deadlines as discussed
in upstream #14577 and others.
By changing the default divisor to one that evenly divides the 2^15
clock rate the time interrupts are disabled to manage timers is
significantly reduced, as is the error between uptime and real time. Do
this at the top level, moving SYS_CLOCK_HW_CYCLES_PER_SEC there as well
since the two parameters are related.
Note that the central_hr configuration described in upstream #13610 does
not distinguish latency due to timer management from other
irq_block/spinlock regions, and the maximum observed latency will still
exceed the nominal 10 us allowed maximum. However this does occur
much less frequently than changing the timer deadline which can happen
multiple times per tick.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Inside function test_net_pkt_basics_of_rw result of function call
net_pkt_read_be16 is not checked which might result performance
of the program and cause errors.
Coverity-CID 198003
Fixes#15776
Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
Making a clean slate for a pylint test in CI.
'_' is a common name for non-problematic unused variables in Python.
pylint knows not to flag it.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Szymon is no longer actively looking at Bluetooth code, whereas Joakim
from Nordic has been assigned for Bluetooth host support.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This is a follow up to commit 0eaa5e53a3.
`HAL_SW_SWITCH_RADIO_ENABLE_S2_PPI_BASE` is a base number for two PPI
channels, so two bits need to be marked in the used channel bit mask.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This make use of NET_IF_NO_AUTO_START flag so Bluetooth interfaces are
not automatically enabled after initialized.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fix calling bt_gatt_foreach_attr with start handle parameter set
to last static attribute handle.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The approved trademark name is Wi-Fi so update references to WiFi and
other spellings to Wi-Fi in documentation and Kconfig help strings.
(Note that use of spelling variatios of "wifi" in module names, CONFIG
names, link names and such are untouched.)
https://www.wi-fi.org/
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Within the past few days, an update to the Ubuntu 18.04 toolchain has
begun emitting code sections during link that are messing with our
stub generation. They are appearing in the 32 bit stub link despite
not being defined in the single object file, and (worse) being
included in the output segment (i.e. at the start of the bootloader
entry point!) despite not being specifically included by the linker
script. I don't understand this behavior at all, and it appears to be
directly contrary to the way the linker is documented.
Marc Herbert discovered this was down to gcc being called with
--enable-default-pie, so -no-pie works to suppress this behavior and
restore the default. And it's correct: we aren't actually generating
a position independent executable, even if we don't understand why the
linker script is being disregarded (to include sections we don't
include). See discussion in the linked github issue.
Fixes#15877
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
k_stack_alloc_init() was creating a buffer that was 4 times
too small to support the requested number of entries, since
each entry in a k_stack is a u32_t.
Fixes: #15911
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Moves the flash memory definitions from Kconfig to device tree for the
rv32m1 ri5cy and zero-riscy cores.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Moves the sram memory definitions from Kconfig to device tree for the
rv32m1 ri5cy and zero-riscy cores.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
The west build --help output no longer fits in a single page. Move
details and examples into the documentation, so the -h output doesn't
require scrolling around.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Analogously to the Make options with the same names, these print the
commands which would have run without running them.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Adjust them so "west build -v" prints ZEPHYR_BASE and any CMake
commands, but none of the other more esoteric bits of information.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
This can be used to override the default CMake generator
permanently. Its values are the same as those acceptable to cmake's -G
option.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Try to make the language simpler. Introduce each example with a
paragraph that says "To <DO XYZ>" to make them easier to find.
Move the config options to the documentation for that command to make
them easier to find.
Add some more examples for use cases we've gotten questions about.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
- Respect the BOARD environment setting.
- Don't require --force if the board can't be figured out: it might be
set in CMakeLists.txt, for example. Instead, downgrade to a warning
which can be disabled with "west config build.board_warn false".
- Add a build.board configuration option used as a final BOARD fallback
after CACHED_BOARD (in the CMake cache), --board (command line), and
BOARD (environment).
- Keep the config docs up to date.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
- This script didn't get fixed when cmake.py was renamed zcmake, so it
won't run; fix that.
- Change the default format string to '{name}' to keep things simple
- Flake8 lint
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Adds a new argument to the openocd runner to optionally specify the
config file. Updates the rv32m1_vega board to use different openocd
config files for the ri5cy and zero-riscy cores.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Introduces a new rv32m1_vega board configuration for the zero-riscy
core. It assumes that the soc has been reconfigured with openocd to boot
to the zero-riscy core instead of the ri5cy core.
Refactors the board-level device tree so the ri5cy and zero-riscy
configurations share common definitions for the led, button, and sensor
nodes.
Tested with:
- samples/hello_world
- samples/synchronization
- samples/basic/blinky
- samples/basic/button
- samples/sensor/fxos8700
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>