New top-level dts/ folder and description added.
Fixed error in bullet list in subsys/ description (needed
a blank like before the list.
Alphabetized folder list (subsys/ was listed after tests/)
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Upcoming memory protection features will be placing some additional
constraints on kernel objects:
- They need to reside in memory owned by the kernel and not the
application
- Certain kernel object validation schemes will require some run-time
initialization of all kernel objects before they can be used.
Per Ben these initializer macros were never intended to be public. It is
not forbidden to use them, but doing so requires care: the memory being
initialized must reside in kernel space, and extra runtime
initialization steps may need to be peformed before they are fully
usable as kernel objects. In particular, kernel subsystems or drivers
whose objects are already in kernel memory may still need to use these
macros if they define kernel objects as members of a larger data
structure.
It is intended that application developers instead use the
K_<object>_DEFINE macros, which will automatically put the object in the
right memory and add them to a section which can be iterated over at
boot to complete initiailization.
There was no K_WORK_DEFINE() macro for creating struct k_work objects,
this is now added.
k_poll_event and k_poll_signal are intended to be instatiated from
application memory and have not been changed.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This patch amounts to a mostly complete rewrite of the k_mem_pool
allocator, which had been the source of historical complaints vs. the
one easily available in newlib. The basic design of the allocator is
unchanged (it's still a 4-way buddy allocator), but the implementation
has made different choices throughout. Major changes:
Space efficiency: The old implementation required ~2.66 bytes per
"smallest block" in overhead, plus 16 bytes per log4 "level" of the
allocation tree, plus a global tracking struct of 32 bytes and a very
surprising 12 byte overhead (in struct k_mem_block) per active
allocation on top of the returned data pointer. This new allocator
uses a simple bit array as the only per-block storage and places the
free list into the freed blocks themselves, requiring only ~1.33 bits
per smallest block, 12 bytes per level, 32 byte globally and only 4
bytes of per-allocation bookeeping. And it puts more of the generated
tree into BSS, slightly reducing binary sizes for non-trivial pool
sizes (even as the code size itself has increased a tiny bit).
IRQ safe: atomic operations on the store have been cut down to be at
most "4 bit sets and dlist operations" (i.e. a few dozen
instructions), reducing latency significantly and allowing us to lock
against interrupts cleanly from all APIs. Allocations and frees can
be done from ISRs now without limitation (well, obviously you can't
sleep, so "timeout" must be K_NO_WAIT).
Deterministic performance: there is no more "defragmentation" step
that must be manually managed. Block coalescing is done synchronously
at free time and takes constant time (strictly log4(num_levels)), as
the detection of four free "partner bits" is just a simple shift and
mask operation.
Cleaner behavior with odd sizes. The old code assumed that the
specified maximum size would be a power of four multiple of the
minimum size, making use of non-standard buffer sizes problematic.
This implementation re-aligns the sub-blocks at each level and can
handle situations wehre alignment restrictions mean fewer than 4x will
be available. If you want precise layout control, you can still
specify the sizes rigorously. It just doesn't break if you don't.
More portable: the original implementation made use of GNU assembler
macros embedded inline within C __asm__ statements. Not all
toolchains are actually backed by a GNU assembler even when the
support the GNU assembly syntax. This is pure C, albeit with some
hairy macros to expand the compile-time-computed values.
Related changes that had to be rolled into this patch for bisectability:
* The new allocator has a firm minimum block size of 8 bytes (to store
the dlist_node_t). It will "work" with smaller requested min_size
values, but obviously makes no firm promises about layout or how
many will be available. Unfortunately many of the tests were
written with very small 4-byte minimum sizes and to assume exactly
how many they could allocate. Bump the sizes to match the allocator
minimum.
* The mbox and pipes API made use of the internals of k_mem_block and
had to be ported to the new scheme. Blocks no longer store a
backpointer to the pool that allocated them (it's an integer ID in a
bitfield) , so if you want to "nullify" them you have to use the
data pointer.
* test_mbox_api had a bug were it was prematurely freeing k_mem_blocks
that it sent through the mailbox. This worked in the old allocator
because the memory wouldn't be touched when freed, but now we stuff
list pointers in there and the bug was exposed.
* Remove test_mpool_options: the options (related to defragmentation
behavior) tested no longer exist.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Unline k_thread_spawn(), the struct k_thread can live anywhere and not
in the thread's stack region. This will be useful for memory protection
scenarios where private kernel structures for a thread are not
accessible by that thread, or we want to allow the thread to use all the
stack space we gave it.
This requires a change to the internal _new_thread() API as we need to
provide a separate pointer for the k_thread.
By default, we still create internal threads with the k_thread in stack
memory. Forthcoming patches will change this, but we first need to make
it easier to define k_thread memory of variable size depending on
whether we need to store coprocessor state or not.
Change-Id: I533bbcf317833ba67a771b356b6bbc6596bf60f5
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
More general spelling fixes, and cleaning up stray UTF-8 characters
such as curly-quotes, em- and en-dashes. Use replacement strings
for |reg| and |trade|.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Version 1 kernel (release 1.5 and earlier) is far enough from memory now
to remove the "version 2" wording in the kernel documentation and just
call it "the kernel".
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I731cc91517436685836023cbda34f894586a54bc
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
fix :file: reference to include/misc/ring_buffer.h
Change-Id: I0d7b32150ef66757fb6e5328c0e1b1bc6b9f3e55
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
A recent mailing list question asked for clarify about
the duration and period parameters for starting a timer.
Change-Id: I9bf8dd93dbbb9bbb94c95c2d7072f446ea1d6b01
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Put them in order where they are most likely to be useful.
Change-Id: Ia9c358a096556a9838b2b69311e10aba3b9ca587
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
Promote a glossary.rst up into the doc/ folder, merge wiki
glossary entries (and remove from the wiki), and format use
the .. glossary directive to allow references by using the
:term: role (using :term:`ISR` will make a link to the
glossary entry for ISR)
Jira: ZEP-1321
Change-Id: Ie1461037ab456371604594488f01df9f21284561
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
These interrupts are for ISRs that need the lowest possible latency.
They do not take parameters and are installed directly in the interrupt
vector table.
Issue: ZEP-1038
Change-Id: I7583e9191dd32d9253ad933181d2103a6e191dea
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Merge build system and application primer into one and put
all in one file to make it easier to follow.
Jira: ZEP-686
Change-Id: I64ec7ef7a6aa2ad80496ca0ee3ddc3d7fe09a5d7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The shell is not a kernel feature, it is more of a subsystem.
Change-Id: Iaba60b2086ddfe77af427d70b8fc8d06a8bebe14
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Ability to use Zephyr shell by multiple modules simultaneously, each
module for its own usage.
Old shell implementation enabled the user to call only one module
commands, not all of the modules simultaneously.
Change-Id: I0ef8fa2fd190b7490c44fe91d1016363258302c9
Signed-off-by: Yael Avramovich <yael.avramovich@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Documentation is using an incorrect name for the macro available to
allocate memory maps.
Change-Id: Ic2a93d3851219cb91f3c9c01e2aa19e38913abdd
Signed-off-by: Rohit Grover <rohit.grover@arm.com>
Replaced the term "platform" with "board" or "SoC" depending
on context as per, ZEP-534.
Change-Id: I14c13d4eed429fe6e41e2221d6ff6afe97e942eb
Signed-off-by: Evan Couzens <evanx.couzens@intel.com>
The x86 architecture is no longer the only one that supports hardware
floating point operations.
Change-Id: Ib23e032f00661bab87a20872651b284580b8e7e5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This line was missed when the task IRQ APIs were deprecated
by commit a83f895dd5.
Change-Id: I0135eebb2f7bd0991364fdaab8a0a1fd6981d50d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Incorporates the brief discussion of device driver support into
the Device Drivers document, so that the driver material is all
in one place. (Also converts a few unprintable characters in the
latter document to spaces, since they appear to have been used
by accident.)
Removes the empty discussion of networking support, to avoid
duplicating stuff already covered in the Networking document.
Change-Id: Ia5b8a92ade72a0634ee142afb45928016442d7dd
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Relocates material that outlines the structure of a Zephyr application
so that it appears at the beginning of the "Application Development
Primer". (i.e. The primer now tells the reader the file structure of
an application, then explains how to create these files.)
Revises the description of the MDEF file to make it a bulleted item
(like the other file types are) and improve readability.
Change-Id: I9f003b8317257c927bea752da55cc434f957592c
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Relocates material that describes the most fundamental terms used
in Zephyr documentation so that it appears in the "Introducing Zephyr"
document. (i.e. Ensures that the terms are defined before they are
used in the "Getting Started Guide" that follows.)
Transforms the material into a definition list to make it easier
for readers to locate and understand the mateial. Revises the text
to give it a consistent look-and-feel.
Change-Id: I0187d99b1bdac37397a4c907d57bc1f24d7698e7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Per:
commit a83f895
Author: Andrew Boie <andrew.p.boie@intel.com>
Commit: Benjamin Walsh <benjamin.walsh@windriver.com>
microkernel: deprecate task IRQs
This mechanism does not add enough value to the kernel to be worth
maintaining it. Drivers that need deferred processing of interrupts
can simply define their own task and have the interrupt handler
release an event that the task waits on.
The API is marked as deprecated and it is removed from unit test
coverage as well as the documentation.
Change-Id: Ib87b91cb41e9b6d7fdf0dc62b240a531b6a8889f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Change-Id: I0d891772b1fb4246ec9ee9f4764b2121333ae972
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Original link "fiber services" does not exist, so renamed to the one
at the head of "nanokernel_fibers.rst".
Change-Id: I39c89e5dbe9b8d0462eb2aa8d84db65b22625fdc
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Must use :c:type instead of :cpp:type.
Change-Id: I600c7a018e1b1492e967b05f44fec14afd87eccc
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
:c:option:`xyz` is non usable without a . c:option:: declaration, so moved
to *xyz`; likewise :option:`xyz` where no .. option:: xyz is declared.
Change-Id: I011ccf2aac244125dbe2d09d197e443bd4c12fe2
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Move to use :option:`CONFIG_XYZ` vs :option:`XYZ` to generate propert
links and avoid warnings about unexistant targets.
Change-Id: I4b46041f25e538462b123ccc8337f733033cc0e7
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Config options KERNEL_EVENT_{INTERRUPT, CONTEXT, SLEEP} don't exist
any more, removed.
Move to use :option:`CONFIG_XYZ` vs :option:`XYZ` to generate propert
links and avoid warnings about unexistant targets.
Change-Id: Ibafa155f474a05329a8cac7bff5c55800d9f31a4
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Four code snippets fail to be properly recognized by the code
highlighter; the makefile snippets seem to be because of the $
character (and I have found a way to escape it out). The C code, I
haven't been able to find out why.
Killed the warning by setting the code-block style to 'none' on all of
them. It is not the best sollution, but it beats a polluted build
process.
Change-Id: I8fa7d327354a93bacad40e25596c9dbaf9ea1e92
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Add a blank line in most places is the fix needed, to have the
formatting engine recognize it properly.
Change-Id: Iccaa0e51146b1e2c138e89ab1dd0067fc1409e4d
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
The "IDT Security" section was removed since the IDT is now always
in a read-only region; dynamic IRQs have been deprecated and will
be removed from the kernel.
Change-Id: Idbb7ff987bbb4f777b524d87690485d34f372d43
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Few lines in the doc were out of sync with the code base.
Jira: ZEP-312
Change-Id: Ic0d3508f0f903e43000e17b4a32c1280ae0978dc
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
By default, kernel event logger is using the system timer. But on
some platforms where the timer driver maintains the system timer
cycle accumulator in software, such as ones using the LOAPIC timer,
the system timer behavior leads to timestamp errors. For example,
the timer interrupt is logged with a wrong timestamp since the HW
timer value has been reset (periodic mode) but accumulated value not
updated yet (done later in the ISR).
This patch is adding the possibility to register a timer callback
function that will be used by the kernel event logger. For example,
on Quark SE, this allows using RTC or AON counter which accuracy is
sufficient and behavior more straight forward compared to system
timer.
Change-Id: I754c7557350ef29fc10701e62a35a5425e035f11
Signed-off-by: Fabrice Olivero <fabrice.olivero@intel.com>
Added CONFIG_KERNEL_EVENT_PROFILER_DYNAMIC flag for enabling that
capability. When set, nothing will be logged by default
Change-Id: I03552483e5a6bfd9e2505eda56908f0d0ae98618
Signed-off-by: Fabrice Olivero <fabrice.olivero@intel.com>