counter_callback_t has been previously prefixed with __deprecated
but it is used in prototype of deprecated function (counter_set_alarm).
It seems that compiler generates the warning even though function is
not used. Removed __deprecated prefix from the typedef, keeping it for
the function only.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Deprecating counter legacy API and renaming new counter_set_alarm
to coutner_set_ch_alarm. Deprecating rtc API and modifying rtc
API to call new counter API (compatibility layer).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
counter.h and rtc.h API's share almost the same functionality.
They are unified as a new counter.h. rtc.h will be deprecated.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Adds a new entry in the pixel format enum for RGB 565. This will be used
for the lcd display on the mimxrt1050_evk and mimxrt1060_evk boards.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Replace Cortex-M3 with Cortex-M architecture family
in the header documentation of kernel_arch_data.h and
kernel_arch_func.h, which are generic header files for
the entire familty of ARM Cortex-M CPUs. The commit
adds some more minor style fixes in functions'
documentation.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit improves the documentation of internal ARM core
function _arch_irq_lock(..), adding a more detailed description
of its impact on the different Cortex-M processors.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This Patch add functionality for automatic generation of the flash map
using DTS description. Automatic generation allows to replace
C-hardcoded flash_map.
We generate a set of defines based on the index of a partiion:
#define DT_FLASH_AREA_<IDX>_OFFSET 0
#define DT_FLASH_AREA_<IDX>_SIZE 131072
#define DT_FLASH_AREA_<IDX>_DEV "FLASH_CTRL"
#define DT_FLASH_AREA_<IDX>_LABEL MCUBOOT
Additionally we also define:
#define DT_FLASH_AREA_NUM 4
and:
#define DT_FLASH_AREA_<PARTNAME>_ID 0
Signed-off-by: Findlay Feng <i@fengch.me>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
It is possible to set the filter in user application and that
information is passed to the CANBUS device driver.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As the value 0 is a valid network interface index, we cannot use
unsigned value for interface index as that would not allow to
distinguish an invalid value. So make interface index a signed
8-bit value which is ok as we do not expect to have more than 127
network interfaces in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This is basically a dummy layer that just passes data through.
It is needed so that we can create CANBUS type network interface
to the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This allows user to create a CAN socket and to read/write data
from it. From the user point of view, the BSD socket CAN support
works same way as in Linux.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit adds PF_CAN and AF_CAN protocol family identifiers
that are used by BSD socket CAN support code.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Vipin Anand <vipin.anand@intel.com>
This commit adds basic packet socket support to net_context and
allows application to receive or send network packets in raw
format.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Various defines and helpers for supporting packet sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Add ETH_P_xxx protocol types if they are missing. After this
we can use the protocol types when working with BSD sockets.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Translate HCI error codes to POSIX error codes in order to be able to
distinguish reason of connectable advertising start failure.
Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
This commit enables fine-grained power state locking.
Now, each power state could be independently enabled or disabled.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
add the handling of APP_SHARED_MEM.
privileged threads can access all the mem
explictly defined in user mode, i.e., APP_MEM & APP_SHARED_MEM
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This reverts commit eb6ea28649.
Reverting this to avoid confusion in using the gpio callbacks.
Fixes#11565
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This patch increases the amount of slab memory per item for the shell
history to match the maximum command input buffer size plus the
accounting information for the dnode list item.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
PAE tables introduce the NX bit which is very desirable
from a security perspetive, back in 1995.
PAE tables are larger, but we are not targeting x86 memory
protection for RAM constrained devices.
Remove the old style 32-bit tables to make the x86 port
easier to maintain.
Renamed some verbosely named data structures, and fixed
incorrect number of entries for the page directory
pointer table.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The iterator over registered callbacks failed to account for the
possibility that the callback would remove itself from the list. If
this occurred any remaining callbacks would no longer be reachable from
the node. Switch to the slist iterator that is safe for self-removal.
Note that the slist API remains unsafe for removal of subsequent nodes.
Even with the corrected code removal of the next callback registration
(cached in tmp) will result in it being called anyway, with the
remaining unremoved registrations not being called. If the next
callback were removed and re-registered on a different device, the
callbacks would be invoked for the wrong device.
Resolve this by a documentation change describing the conditions under
which a change to callback registration from within a callback are
permitted. Add a similar note regarding the effect of adding a
callback. The current event invocation behavior for callbacks added
within an event is explicitly left unspecified, though in the current
slist implementation newly added callbacks will not be invoked until the
next event.
Closes#10186
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This reverts the documentation component of commit
eb6ea28649.
The original change broke the API contract: drivers that use GPIOs need
to be able to configure callbacks without being aware of whether a
particular implementation expects to use a mask or a pin ordinal.
Revert the API documentation to its original format, and mark that the
added field should be removed when issue #11565 is resolved.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit re-works the NXP MPU driver implementation so that
it aligns with the implementation for ARMv7-M and ARMv8-M MPU
architectures.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit removes the unnecessary MPU region type definitions
from arm_core_mpu_dev.h, as they are not used any more in any of
the architecture-specific MPU implementations (ARMv7-M, NXP, and
ARMv8-M MPU).
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit removes obsolete ARM CORE MPU API definitions
and related implementation from arm_mpu.c, in the wake of
the transition to the new ARM MPU design.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit updates the ARM Core MPU API for memory domains,
to align with the principle of de-coupling the partitioning
and the access attribution with the architecture-specific
MPU driver implementation.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces an internal ARM MPU API that allows the
user to re-configure a memory partition in run-time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces an ARM API that allows the user to
program a set of dynamic MPU regions at run-time. The API
function is invoked every time the memory map needs to be
re-programmed (for example at thread context-switch). The
functionality is implementated in arm_core_mpu.c.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces and documents the internal ARM MPU
API to configure the dynamic memory regions at run-time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces and documents the internal ARM MPU
API to configure the static memory regions at boot time.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
The ARM core MPU API now uses solely k_mem_partition_attr_t
objects to represent memory region attributes. The objects
now include all attribution properties (including cache-
ability and share-ability). This commit updates the macro
definitions to comply with the new ARM Core MPU standard.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit introduces the generic ARM (core) API, which allows
the user to program a set of static (fixed) MPU regions at boot
time. The API function is invoked upon initialization, in the
ARM-specific call of _arch_switch_to_main_thread(). The API
implementation is provided in arm_core_mpu.c.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Extended shell to be able to process logs in place
(in the context of a log call). In order to achieve that,
shell was extended to support for TX blocking operations. If
CONFIG_LOG_INPLACE_PROCESS is enabled then shell instance
attempts to be initialized in blocking TX mode. If fails to
do so, shell log backend is disabled. If successfully enabled
logs are processed and printed in the context of the call.
Due to that change, user may expirience interleaved output as
shell has no means to multiplex shell output with logger output.
In extreme, huge amount of log messages may prevent shell thread
execution and shell may become unresponsive.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
While k_uptime_get() and k_uptime_get32() return time in
milliseconds, they don't need to have millisecond resolution.
Resolution with default Zephyr settings in 10ms.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
As we are removing net_app and net_pkt based libraries and
applications, CoAP legacy based libraries and apps are moved
to socket based implementations. So removing legacy CoAP.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Currently each SoC has to define own list of power states.
However all these definitions have to be the same, as common power
management code uses them.
This commit replaces per-soc power state list by global definition.
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
This commit adds a new hardware info API.
With this API it is possible to read out the device ID.
Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
Replaced forever loop in assert with call to a function.
In post_assert_action() function, k_panic is called.
Forever loop was preventing logs to be printed and had behavior
ependent on the context (low prioriy thread - system continue to
ork, irq - system is blocked).
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This adds a simple implementation of SMP CPU affinity to Zephyr. The
API is simple and doesn't try to invent abstractions like "cpu sets".
Each thread has an enable/disable flag associated with each CPU in the
system, and the bits can be turned on and off (for threads that are
not currently runnable, of course) using an easy three-function API.
Because the implementation picked requires enumerating runnable
threads in priority order looking for one that match the current CPU,
this is not a good fit for the SCALABLE or MULTIQ scheduler backends,
so it currently can be enabled only for SCHED_DUMB (which is the
default anyway). Fancier algorithms do exist, but even the best of
them scale as O(N_CPUS), so aren't quite constant time and often
require significant memory overhead to keep separate lists for
different cpus/sets.
The intended use here is for apps that want to "pin" threads to
specific CPUs for latency control, or conversely to prevent certain
threads from taking time on specific CPUs to leave them free for fast
response.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This allows to place instances of the class one after another in the
linker section.
Fixes#12908
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Something is going wrong with code generation here, potentially the
inline assembly generated by _arch_irq_un/lock(), and these calls are
not being inlined by gcc. So what should be a ~3 instruction sequence
on most uniprocessor architectures is turning into 8-20 cycles worth
of work to implement the API as written.
Use an ALWAYS_INLINE, which is sort of ugly semantically but produces
much better code.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
The sys_dlist_insert_*() functions had a behavior where a NULL
argument for the insertion position to sys_dlist_insert_after/before()
was interpreted as "the end of the list". We never used that
convention (except in one spot internal to dlist.h which was not
itself used anywhere), and of course already have an API for appending
and prepending to a list.
In practice this was a performance disaster. The NULL check is
virtually never provable statically by the compiler, so that test and
branch is present always. And worse, the check and call to another
function was pushing this beyond the complexity limit for gcc to
inline a function (at -Os optimization anyway), forcing us to use
function calls for what should be a ~8 instruction sequence. The
upshot is that dlist insertions were 2-3x slower than they needed to
be.
Deprecate these older APIs and introduce a new sys_dlist_insert() call
which can be much better optimized.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Its been at least 2 releases since we marked a number of watchdog APIs
as deprecated. Lets remove them.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
The gpio_port_ functions provided by the gpio API do not provide
currently a mask parameter. As such they operate on a full port only.
In practice such functions are not useful. This commit deprecates them
to allow adding port functions with support for a mask parameter in the
future.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit implements a CTF-backend for Zephyr's tracing API.
The CTF-backend itself is split in a middle-layer and a bottom-layer.
- Middle-layer decides the payload in event transactions,
- Bottom-layer implements the IO transport.
A simple POSIX bottom-layer is provided so far.
Signed-off-by: François Delawarde <fnde@oticon.com>
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).
Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Though these are currently used by the core only, it will be then used
by net_context as well. This one of the steps to get rid of net_pkt's
appdata/appdatalen attributes.
Also normalizing all ip/proto parameters name to ip_hdr and proto_hdr.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These will be specifically needed in TCP, as well as being used in
context internally.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Also, store the actual next_hdr value and not it's position.
This permits to reduce net_pkt from some bytes.
Such field was unused until now, but it will be soon.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
It's not anymore up to user to provide the pkt. Context will build the
packet according to its metadata and provided buffer and length.
It currently supports only IPv4 and UDP.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These ones would support linearizing non-contiguous area, however
requiring a bit more complex type as an "accessor".
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Adding a cursor into net_pkt. This is used to read/write data in a much
simpler way, for pre-allocated buffers in net_pkt. This avoids API users
to deal with net_buf below directly.
However, to be used - as for the new allocators - it will require deep
net stack core and API changes.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
These struct net_pkt allocators will give the possibility to allocate at
once the net_pkt and the buffer associated with, taking care of the
header space and MTU relevantly.
This enables to use the variable length allocator from net_buf. However,
it is not yet the default and is set as experimental.
As it is provided in parallel to existing allocators, it has to keep a
slab per-direction and thus a pointer in net_pkt, as well as appdata,
appdatalen etc... Resulting in "bloating" net_pkt. This will be solved
when, finally, former allocators will be removed.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
All as static inline functions to let the compiler check the types
etc... And use ARG_UNUSED() always where relevant.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The net-app API is removed. Users should use the BSD socket API
for application development.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Now that the security data can be loaded into and used from the
security / server objects, we can add support for LwM2M bootstrap.
This is a mode where initially a connection can be made to a server
which can update several LwM2M (including security and server
data) and then trigger a "bootstrap complete". Once this happens
the client will start it's connection process over but now with
the new information.
Signed-off-by: Michael Scott <mike@foundries.io>
In order to support bootstrap mode, we need to store server data
in the security / server objects. Once the connection to the
bootstrap server is made, it will clear these objects and add
new server connection data.
Signed-off-by: Michael Scott <mike@foundries.io>
net_app contexts save the remote address and we use this during
observe notifications and pending handling. If we move to another
network layer such as sockets, then the remote address becomes
harder to reference. Let's save it as a part of the client
context.
Signed-off-by: Michael Scott <mike@foundries.io>
As part of the migration from net_app APIs to socket APIs, let's
stop referencing the net_pkt fragments throughout the LwM2M library.
Establish a msg_data flat buffer inside lwm2m_message and use that
instead.
NOTE: As a part of this change we remove the COAP_NET_PKT setting.
The COAP library reverts to COAP_SOCK behavior.
This doesn't mean we use sockets in LwM2M (yet), it only means we
use the socket-compatible COAP library which parses flat buffers
instead of net_pkt fragments.
Signed-off-by: Michael Scott <mike@foundries.io>
This board is unmaintained and unsupported. It is not known to work and
has lots of conditional code across the tree that makes code
unmaintainable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If the net_context functions are accessed from preemptive priority,
then we need to protect various internal resources.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The original SNTP client library was designed for the net-app API, for
which it makes sense to have a callback function, which is called
asynchronously when an answer is received.
For the socket based interface, the callback is called just before
sntp_request() returns. It gets the status and the epoch_time in
parameter, however the status is already returned by sntp_request(). It
therefore make sense to replace the callback function by a pointer to
epoch_time.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
There are no longer per-partition initialization functions.
Instead, we iterate over all of them at boot to set up the
derived k_mem_partitions properly.
Some ARC-specific hacks that should never have been applied
have been removed from the userspace test.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The public APIs for application shared memory are now
properly documented and conform to zephyr naming
conventions.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Create a reference page for each peripheral and move doxygen API
reference to the main documentation page.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
There was an existing validation layer in the spinlock implementation,
but it was only enabled when both SMP and CONFIG_DEBUG were enabled,
which meant that nothing was using it. Replace it with a more
elaborate framework that ensures that every lock taken is not already
taken by the current CPU and is released on the same CPU by the same
thread.
This catches the much more common goof of locking a spinlock
recursively, which would "work" on uniprocessor setups but have the
side effect of releasing the lock prematurely at the end of the inner
lock. We've done that in two spots already.
Note that this patch causes k_spinlock_t to have non-zero size on
builds with CONFIG_ASSERT, so expect a little data and code size
increase. Worth it IMHO.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Leftovers from legacy MQTT removal commit, now all traces of the
old MQTT implementation are gone.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is the macro name that matters, not its value. Here, that will help
to save 1 bit in struct net_pkt later on.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Added display text management to shell_fprintf function.
Now it can be used from diffrent threads with not risk that
displayed lines will overlay.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Removed foreground command functionality from shell source files.
Removed associated example.
Removed enter/exit command functions from the Bluetooth example
Updated project config files.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
CONFIG_NET_CONTEXT_NET_PKT_POOL is used by Zephyr's TCP stack as
a way of keeping the original packet data when compression and
other l2 specific actions make the data unusable for retries.
LwM2M uses UDP and this option was never used.
Signed-off-by: Michael Scott <mike@foundries.io>
The app shared memory macros for declaring domains provide
no value, despite the stated intentions.
Just declare memory domains using the standard APIs for it.
To support this, symbols declared for app shared memory
partitions now are struct k_mem_partition, which can be
passed to the k_mem_domain APIs as normal, instead of the
app_region structs which are of no interest to the end
user.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
As networking libraries and protocols are moving to socket
based implementation, reworked SNTP client library to use sockets.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Added functions for processing log string and hexdump. Details
are passed as function parameters and not as log_msg. Those
functions can be used when logger works in synchronous mode
and log messages are not created.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Changed 'in place' mode to bypass logger system and directly
call active backends. With this approach memory footprint of
the logger can be significantly reduced in terms of RAM and ROM.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The Bluetooth 5.1 specification was recently released, and has a new
version identifier (10) assigned to it in the Bluetooth Assigned
Numbers.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
It has been observed that some network drivers, f.ex. the SAM E70 GMAC,
call net_pkt_unref from inside the interrupt that signals the successful
transmission of a packet. This conflicts with the net_pkt_unref call
made by ethernet_send after the packet has been given to the driver.
We fix this by using an atomic_t to hold the reference count as there
might be other, difficult to find cases of net_pkt_(un)ref being used
across threads and interrupts.
The name of the element has been changed from "ref" to "atomic_ref" to
cause a compile error when code still has not been converted to use the
atomic_* functions.
Fixes#12708
Signed-off-by: Daniel Glöckner <dg@emlix.com>
This commit introduces a concept of mesh-local IPv6 addresses. Such
addresses should only be used for mesh-local communication, therefore
should not be used to communicate with different subnets (i. e.
destinations outside the mesh).
As `addr_type` field already holds different kind of information
(whether address was created automatically/manually) it was not used in
this case.
Instead a mesh_local flag was added, so that we do not lose information
on how address was created. Address with such flag set will only be
selected as a source address automatically if the destination address
is within the same subnet it belongs to.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A recent change in how the fixup mechanism works caused several
regressions. See
https://github.com/zephyrproject-rtos/zephyr/pull/12680 for more
details about the regressions.
The core of the matter is that using defines to pass on include paths
causes interopability issues when integrating with external build
systems.
To resolve this we re-write the fixup mechanism to instead generate an
aggregated fixup file that is ready to be included at build time. Then
no paths are passed through defines and we resolve the regressions
reported.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This is the same as net_buf_pull(), except that instead of returning
the new buf->data it returns the old buf->data. This was recently
discussed in github issue #12562.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In some cases the Friendship & Low Power Node features aren't
available or feasible, however power saving is nevertheless required.
This patch introduces two new APIs to suspend and resume the Mesh
network. Currently, what this impacts is the LE scanning, the
ability to allocate new outgoing buffers, as well as the model
publishing, beacon and heartbeat timers.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add missing linker section to avoid warning about orphans when building
with host compiler.
Fixes#12719
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Several places in the code have constructions like this:
if (bool_variable) {
atomic_set_bit(flags, FLAG);
} else {
atomic_clear_bit(flags, FLAG);
}
To reduce the amount of code for such situations, introduce a new
atomic_set_bit_to() helper which lets you condense the above five
lines to a single one:
atomic_set_bit_to(flags, FLAG, bool_variable);
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add a level 2 interrupt controller for the RV32M1 SoC. This uses the
INTMUX peripheral.
As a first customer, convert the timer driver over to using this,
adding nodes for the LPTMR peripherals. This lets users select the
timer instance they want to use, and what intmux channel they want to
route its interrupt to, using DT overlays.
Signed-off-by: Marti Bolivar <marti@foundries.io>
Signed-off-by: Mike Scott <mike@foundries.io>
It's not an error if a driver does not implement callback related
function. Let's return -ENOTSUP relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The old legacy APIs use net-app library and as that is being
removed, then the dependencies need to be removed also.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
If we include this headers files in cpp source code,
the compiler say"error: template with C linkage".
Includes must be moved outside the 'extern "C"' section.
Signed-off-by: Benoit Leforestier <benoit.leforestier@sekurity.fr>
extract_dts_includes.py has been generating DT output and then
concatenating it with fixup header files to create
'generated_dts_board.h'.
In this patch we instead introduce a source file named
'generated_dts_board.h' and have it \#include the appropriate DT
output and fixup files.
This results in a simpler system because users can now read
'generated_dts_board.h' as C source code to see how fixup files and
generated DT output relate to each other. Whereas before they would
have to either read documentation or python code to gain the same
understanding.
Also, it reduces the scope and complexity of one of our most bloated
python scripts, extract_dts_includes.py.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
struct timeval is per POSIX defined in sys/time.h, but that also
allowed to pull sys/select.h (and indeed, it does with native_posix),
which then starts to conflict with out select implementation (if
NET_SOCKETS_POSIX_NAMES is defined, and many samples/tests have it).
So, for now follow the existing route of duplicating all definitions
needed by our code in namespaced manner. Things like struct timeval
usage will need to be revisited later, when we'll want socket
subsystem to work with POSIX subsystem, but that's a separate deep
matter.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
It's implemented on top of poll() anyway, and the current
implementation of fd_set uses array of fd's underlyingly, which
leads to O(n) complexity for FD_SET() and friends.
The purpose of select() implementation is to allow to perform
proof-of-concept port of 3rd-party code to Zephyr quickly. For
efficiency, poll() should be used instead.
Fixes: #11333
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Added cpu_idle APIs to a doxygen group, otherwise there were missing
from the project documentation.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Some of macros initially created in the logger has been moved
to util.h. This commit replaces custom macros with the one
from util.h
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added macros for conditional code generation based on a flag.
Additionally, added macros for getting first and second argument
from variable list of arguments and getting all arguments except
the first one.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Building tests/kernel/common/kernel.common with the new crosstools
SDK-ng resulted in an orphan short read-only data section. Fix this by
adding the .srodata section to the RISC-V linker script.
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
Whether a timeout is linked into the timeout queue can be determined
from the corresponding sys_dnode_t linked state. This removes the need
to use a special flag value in dticks to determine that the timeout is
inactive.
Update _abort_timeout to return an error code, rather than the flag
value, when the timeout to be aborted was not active.
Remove the _INACTIVE flag value, and replace its external uses with an
internal API function that checks whether a timeout is inactive.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
The original implementation allows a list to be corrupted by list
operations on the removed node. Existing code attempts to avoid this by
using external state to determine whether a node is in a list, but this
is fragile and fails when the state that holds the flag value is changed
after the node is removed, e.g. in preparation for re-using the node.
Follow Linux in invalidating the link pointers in a removed node. Add
API so that detection of particpation in a list is available at the node
abstraction.
This solution relies on the following steady-state invariants:
* A node (as opposed to a list) will never be adjacent to itself in a
list;
* The next and prev pointers of a node are always either both null or
both non-null.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Although sys_dnode_t and sys_dlist_t are aliases, their roles are
different and they appear in different positions in dlist API calls.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Preliminary work done towards Mesh extensions on the old LL
architecture implementation.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added new UART API, that allows for longer transmissions, leaves
IRQ handling on driver side and allows for DMA usage.
Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
printk is supposed to be very lean, but should at least not
print garbage values. Now when a 64-bit integral value is
passed in to be printed, 'ERR' will be reported if it doesn't
fit in 32-bits instead of truncating it.
The printk documentation was slightly out of date, this has been
updated.
Fixes: #7179
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
15.4 MHR is no longer set in net_buf pointed by net_pkt, but in a
separate net_buf, hence we need to check that net_buf now to
determine if we need to wait for ACK or not.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This adds bt_gatt_write_response_cb works similarly to
bt_gatt_notify_cb which can take a callback to be called when the PDU
is considered transmitted over the air.
Note: This can also be used to disable the ATT flow control which would
blocks sending multiple commands without wainting their transmissions.
Fixes#11558
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Legacy shell removed in order to avoid maintaining two shells
systems.
All examples and tests have been migrated to the new shell.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This patch adds all the required hooks needed in the kernel to
get the coverage reports from x86 SoCs.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This patch adds all the required hooks needed in the kernel to
get the coverage reports from ARM SoCs.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This patch provides support for generating Code coverage reports.
The prj.conf needs to enable CONFIG_COVERAGE. Once enabled, the
code coverage data dump now comes via UART.
This data dump on the UART is triggered once the main
thread exits.
Next step is to save this data dump on file. Then run
scripts/gen_gcov_files.py with the serial console log as argument.
The last step would be be to run the gcovr. Use the following cmd
gcovr -r . --html -o gcov_report/coverage.html --html-details
Currently supported architectures are ARM and x86.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This is a custom Gcov implementation. Taking excerpts from gcc
gcc libgcc/libgcov.h and gcc/gcov-io.h.
Ported to zephyr by Ramakrishna Pallala <ramakrishna.pallala@intel.com>
and Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
Modified drivers to use DEVICE_AND_API_INIT() instead of DEVICE_INIT()
This will make sure driver_api,is populated at build time and is exposed
to user space
Signed-off-by: Varun Sharma <varun.sharma@intel.com>
This commit renames the nrf5_clock_control.h and
nrf5_clock_control.c files to nrf_clock_control.h and
nrf_clock_control.c, respectively, as they are used
in nRF9160 builds, as well.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit renames the CLOCK_CONTROL_NRF5 Kconfig symbol to
CLOCK_CONTROL_NRF. The change is required to aleviates confusion
when selecting the symbol in nRF9160 SOC definition.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
When offloading is enabled, a call to inet_pton() results in a call to
zsock_inet_pton() based on its implementation in include/net/socket.h.
This eventually leads to a call to _impl_zsock_inet_pton(), which is
not defined when offloading is enabled.
In this commit, we have chosen to directly call net_addr_pton() in
inet_pton() in the offload case to be efficient, and keep the
implementation as it is when offload is not enabled.
Fixes#12441
Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Add missing sections being reported as orphan with latest compiler
version for x86 and discard them. Do the same on ARM.
Those sections are used for dynamic linking which we do not support in
Zephyr.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This patch adds a x86_64 architecture and qemu_x86_64 board to Zephyr.
Only the basic architecture support needed to run 64 bit code is
added; no drivers are added, though a low-level console exists and is
wired to printk().
The support is built on top of a "X86 underkernel" layer, which can be
built in isolation as a unit test on a Linux host.
Limitations:
+ Right now the SDK lacks an x86_64 toolchain. The build will fall
back to a host toolchain if it finds no cross compiler defined,
which is tested to work on gcc 8.2.1 right now.
+ No x87/SSE/AVX usage is allowed. This is a stronger limitation than
other architectures where the instructions work from one thread even
if the context switch code doesn't support it. We are passing
-no-sse to prevent gcc from automatically generating SSE
instructions for non-floating-point purposes, which has the side
effect of changing the ABI. Future work to handle the FPU registers
will need to be combined with an "application" ABI distinct from the
kernel one (or just to require USERSPACE).
+ Paging is enabled (it has to be in long mode), but is a 1:1 mapping
of all memory. No MMU/USERSPACE support yet.
+ We are building with -mno-red-zone for stack size reasons, but this
is a valuable optimization. Enabling it requires automatic stack
switching, which requires a TSS, which means it has to happen after
MMU support.
+ The OS runs in 64 bit mode, but for compatibility reasons is
compiled to the 32 bit "X32" ABI. So while the full 64 bit
registers and instruction set are available, C pointers are 32 bits
long and Zephyr is constrained to run in the bottom 4G of memory.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
I was half way through typing up my own one of these when I realized
there was one already in the tree. Move it to a shared header.
(FWIW: I really doubt that most architectures actually benefit from
their own versions of these tools -- GCC's optimizer is really good,
and custom assembly defeats optimization and factorizations of the
expressions in context.)
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This was apparently intended to allow for per-arch linker includes,
but no such includes ever existed. All it does is senselessly throw
an error on unrecognized architectures. Yank.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Added macro that generates simple report descriptor for mouse.
This improves the readability of hid-mouse sample.
Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
Adds support for the device configuration data (DCD), which provides a
sequence of commands to the imx rt boot ROM to initialize components
such as an SDRAM.
It is now possible to use the external SDRAM instead of the internal
DTCM on the mimxrt1020_evk, mimxrt1050_evk, and mimxrt1060_evk. Note,
however, that the default board configurations still link data into
internal DTCM, therefore you must use a device tree overlay to override
"zephyr,sram = &sdram0"
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds support for the boot data, image vector table, and FlexSPI NOR
config structures used by the imx rt boot ROM to boot an application
from an external xip flash device.
It is now possible to build and flash a bootable zephyr image to the
external xip flash on the mimxrt1020_evk, mimxrt1050_evk, and
mimxrt1060_evk boards via the 'ninja flash' build target and jlink
runner. Note, however, that the default board configurations still link
code into internal ITCM, therefore you must set CONFIG_CODE_HYPERFLASH=y
or CONFIG_CODE_QSPI=y explicitly to override the default. You must also
set CONFIG_NXP_IMX_RT_BOOT_HEADER=y to build the boot header into the
image.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Zero length array is a GNU extension that works as an header for a
variable length object. The portable solution for this is using
flexible length array, but this can be used only in the end of a
struct declaration and this is violates MISRA-C rule 18.8.
The easiest way to rif of this is make the macro expand to nothing but
then we will have a trailing semicolon that is not allowed in C99. So
the macro was changed to automatically add the semicolon when needed.
This may break code identation in some editors but it is a fair price
to pay to have portability and compliance.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
net_frag_linearize() is just a wrapper for net_buf_linearize(). As
the latter was refactored to never return error, and instead just
return actual copied length, update the former and its usages too.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Don't try to find "errors" in the values of dst_len and len params
passed to net_buf_linearize(). Instead, do what entails with the
common sense from the values passed in, specifically:
1. Never read more than dst_len (or it would lead to buffer
overflow).
2. It's absolutely ok to read than specified by "len" param, that's
why this function returns number of bytes read in the first place.
The motivation for this change is that it's not useful with its
current behavior. For example, a number of Ethernet drivers linearize
a packet to send, but each does it with its own duplicated adhoc
routine, because net_buf_linearize() would just return error for the
natural use of:
net_buf_linearize(buf, sizeof(buf), pkt->frags, 0, sizeof(buf));
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This API was using variable number of arguments. Which is not
allowed according to misra c guidelines(Rule 17.1). Hence making
this API into a macro and using the util macro FOR_EACH_FIXED_ARG
to get the same functionality.
There is one deviation from the old function. The last argument
shouldn't be NULL.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This new macro will be able to do FOR_EACH with a fixed argument.
This fixed argument will always be called as the 2nd argument
to the function call(_fn).
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
As mentioned in issue #12265, some networking APIs
aren't included in the generated
API docs because doxygengroup directives were missing.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
As mentioned in issue #12265, this API wasn't included in the generated
API docs because a doxygengroup directive was missing.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This should make it more clearer what APIs are intended to be used with
server and client instances, in addition to that mention on the function
documentation when operation is valid only for local attributes.
Fixes#12138
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Used as a checksum on command messages when talking with MMC cards.
Implemented using the unwound bytewise implementation from
https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks
which is a good mix of size and speed.
The API and naming matches lib/crc7.c in Linux.
Signed-off-by: Michael Hope <mlhx@google.com>
Change arg_len to be u16_t in shell_history_get since it is returning
a value that can be hold by u16_t.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Extended shell to allow command to indicate that shell should
halt not accepting any input until termination sequence is
received (CTRL+C) or shell_command_exit() is called. While shell
is in that state it is allowed to print to shell from any thread
context.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Fix misspellings in documentation (.rst, Kconfig help text, and .h
doxygen API comments), missed during regular reviews.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This commit adds minor improvements to the documentation of the
linker symbols related to Application Shared Memory.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Update zephyr integration of openthread to latest api as of 2018-12-17:
2a75d30684
Both echo_server and echo_client compile and are operational.
Signed-off-by: Martin Turon <mturon@google.com>
CMSIS RTOS API provides a generic RTOS interface for embedded
processors (actually for Cortex-M processors but are generic
enough to be used elsewhere). This header file is for V2 version.
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Let's have more orthogonal and cleaner API, where buffers are
configured by tty_set_rx_buf/tty_set_tx_buf, and only them. It
means that newly initialized tty starts in unbuffered mode, which
is somewhat a sidestep from a main usecase behind tty, which is
buffered operation, but again, having a cleaner API (and good
docs, explaining users how it should be and what they should do)
prevails.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
The whole "tty" concept is conceived around efficient
interrupt-driven operation. However, it's beneficial to add
non interupt-driven operation under the same API:
1. Wider usecase coverage in general.
2. Allows to use the same familiar API (based on POSIX concepts)
even for UART implementations without interrupt support.
3. Allows to switch operation dynamically based on the needs.
For example, if the system is in degraded mode and interrupt
handling cannot be trusted/disabled, allows to still output
diagnostic information to user. This was the original motivation
to provide such a mode, to support logging subsystem's "panic"
mode.
To implement this feature, tty_set_rx_buf() and tty_set_tx_buf()
functions are provided, allowing to reconfigure buffers used
dynamically. If configured buffer length is 0, the operation
switched to unbuffered.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Log message get timestamp when being added to shell log message queue.
When adding to log message queue timeouts then all messages added
before timeout are dropped.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
If burst of log messages was passed to the shell log
backend, it was likely that messages were lost because
shell had no means to control arrivals of log messages.
Added log message enqueueing timeout to the shell instance
to allow blocking logger thread if short-term arrival rate
exceeded shell capabilities.
Added kconfig option for setting log message queue size
and timeout in RTT and UART instances. Added section in
shell documentation which explains interaction between
the logger and shell instance acting as a logger backend.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extended log_output interface to handle dropped
messages. Log_output is printing a message containing
number of dropped messages.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The various linker scripts on arc would include autoconf.h in the arch
linker script but might have CONFIG_ symbols referenced in the soc
specific linker script. Move autoconf.h inclusion to top of the soc
specific linker script out of the arch specific one so we know
autoconf.h is seen before any CONFIG_ references.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
For all builds, _image_ram_start is initially set to RAM_ADDR,
before it is (possibly) aligned for MPU.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This is mostly meant to be used in drivers and/or L2.
net_pkt_ll() is going to be removed and is not semantically right.
Also, net_pkt_ip_data() is not semantically right as it is meant to
access IP data start.
So instead, adding a new function: net_pkt_data() which will get the
start of the buffer.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now it does not mangle with any ll reserver space, let's rename it to
net_pkt_lladdr_clear instead.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This is one of the first steps to get rid of ll_reserve attribute and
the related L2 reserve() function.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The main function is just a weak function that should be override by the
applications if they need. Just adding a nop instructions to explicitly
says that this function does nothing.
MISRA-C rule 2.2
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The net-shell "net allocs" command should print network buffer
allocations even if network packet debugging is not enabled.
This is how it used to work earlier but the behaviour got lost
at some point. So user needs to set CONFIG_NET_DEBUG_NET_PKT_ALLOC
in order to see the buffer allocations. The option will be enabled
by default if network packet log level is set to DBG.
The reason for a separate option is that the network packet debug
logging prints just too much data and it is very difficult to
track allocations when that happens.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
As extend fdtable usage to more cases, there regularly arises a need
to forward ioctl/fcntl arguments to another ioctl vmethod, which is
complicated because it defined as taking variadic arguments. The only
portable solution is to convert variadic arguments to va_list at the
first point of entry from client code, and then pass va_list around.
To facilitate calling ioctl with variadic arguments from system code,
z_fdtable_call_ioctl() helper function is added.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Function name prefix is now configurable (by default only debug
messages are prefixed) and log macros can be simplified.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extended logger configuration to allow function name prefix for
messages with certain severity levels. By default only debug
messages are prefixed with function name.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
As we subtracting pointers of the same type, it is not necessary cast
it to u8_t. This simplify and avoid some MISRA-C violations, e.g rule
11.8.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
So far to deleting av existing key-value pair it was
required to storing NULL value using setting_save_one().
This patch introduce more intuitive API which takes only
the name key string.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Such API is convinient for check the persistent storage
value size or whether the value is NULL.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>