Commit graph

41120 commits

Author SHA1 Message Date
Benjamin Walsh
e3340576ae misc: fix off-by-one error in sys_memcpy_swap's assert
__ASSERT() would trigger if the two buffers were on a common boundary.

Change-Id: Ie9af12abc407dd43615f543b43397493d981057e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-15 04:14:43 -04:00
Peter Mitsis
d93078cb5b unified: Mailboxes to use size_t
Change-Id: I67c1b11d2b6c09e96eb72c3e16f67f5b5acbed3a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:41:24 +00:00
Peter Mitsis
1209270bf8 unified: Relocate mailbox doxygen style function headers
Change-Id: I06e9ce40da650df67f05db8779a5f6199e6091d5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:41:23 +00:00
Peter Mitsis
40680f6eb9 unified: Tweak mailbox API parameters
Tweak mailbox API parameters so that not only are their descriptions
correct, but their names match across header file and C file.

Change-Id: Ieeb3a40fb7c535a5eac2e06533d01d13aaf69181
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:41:23 +00:00
Peter Mitsis
2fef023c3d unified: Conditionally declare k_pipe_block_put()
The routine k_pipe_block_put() is only available if the system has
been configured for asynchronous pipe sends.

Change-Id: I642fecc961ca4ef4ac8839a01ffd4125c30794b8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:09:59 +00:00
Peter Mitsis
e5d9c58301 unified: Tweak pipe API parameters
- Reorders parameters where necessary
 - Adds alignment parameter to K_PIPE_DEFINE()
 - Renames parameters where necessary so they are sync'd
   between header and source files

Change-Id: I4f2367abc28aff646cc90beb9f08bb266e143b0c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:09:58 +00:00
Peter Mitsis
59f59088ea unified: Remove unused K_PIPE_SIZE() macro
Change-Id: If7d3a0c9153365222c85072e62a537317b998bdb
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-15 07:09:57 +00:00
Kumar Gala
c04f055daa MAINTAINERS: Update ARM & overall maintainer
Add Kumar to the ARM & overall maintainer list.

Change-Id: I7aa32f727166de8ecfcddb52fda39ffa2c48f258
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-10-14 22:12:06 +00:00
Tomasz Bursztyka
f72dcf595c byteorder: Add buffer swap helpers
Two functions are proposed:
- sys_memcpy_swap(): will memcpy and swap the 2 given buffers
- sys_mem_swap(): will swap the buffer in place.

The idea is to propose 2 different functions optimized for 2 different
usage.

Change-Id: I1c23907c1f287b72d9be077ccf3aadbb8d379e71
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-10-14 21:28:57 +00:00
Allan Stephens
be315245a0 unified: Fix bug in memory pool defragmentation code (ZEP-1051)
Reverts a change that was made to the defragmentation routine
when memory pool support was ported from the microkernel to the
unified kernel.

The change was intended to improve the readability of the algorithm,
but introduced a subtle change in behavior. For example, when
k and i are zero and the number of block set entries is one
the original algorithm did not execute the while loop, while the
revised algorithm executed the loop once.

Change-Id: I2b0263a8d7b80846013c459847817d314f803457
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-14 21:15:42 +00:00
Benjamin Walsh
b4b108de4d unified: rename sched.h to ksched.h
Build breaks when enabling CONFIG_NEWLIB_LIBC because it has its own
sched.h file.

This is a bad symptom of a greater issue: the build system passes many
'-I<path>' options to the compiler, and that allows including header
files by simply specifying their names (when located somewhere else than
<zephyr>/include/) and can cause clashes when several files in different
locations have the same name, like in this case.

Fixes ZEP-1062.

Change-Id: I81d1d69ee6669a609cd0c420b1b8f870d17dcb67
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-14 20:49:36 +00:00
Benjamin Walsh
3751123fa9 unified: align prototype and definition of k_thread_priority_set
Change-Id: I7299ded2fc66acb5806499ea26e1e5daedc7cc9c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-14 20:49:36 +00:00
Anas Nashif
45616f24e7 Revert "net: fetch valid conn. to determine MSS in data_is_sent_and_acked()"
This reverts commit 627feb92d4.

This patch breaks TCP/IPv4 support in echo_server.

Change-Id: Ia1e2cf8dfa94f845d3a8282c83bba40b36ee782c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-14 07:12:06 +00:00
Allan Stephens
1d07bd1bff unified: Eliminate support for dynamic timers
Gets rid of official support for dynamic timer allocation
in the unified kernel, since users can easily define and
initialize timers at any time. Legacy support for dynamic
timers is maintained for backwards compatibility reasons
for the time being ...

Change-Id: I12b3e25914fe11e3886065bee4e96fb96f59b299
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-13 13:54:00 +00:00
Allan Stephens
018cd9a656 unified: Eliminate k_stack_init_with_buffer()
Folds this API into k_stack_init() to provide a single API
that requires the caller to pass in the stack buffer, just
as is done for other kernel objects initialization APIs
involving the use of a buffer.

Change-Id: Icad5fd6e5387d634738d1574f8dfbc5421cd642d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-13 13:54:00 +00:00
Allan Stephens
399d0ad55a unified: Rationalize thread priority APIs
* Gets rid of k_current_priority_get(). Users can just call
  k_thread_priority_get(k_current_get()) instead.

* Declares k_thread_priority_get() in kernel.h, where it
  really belongs.

* Removes duplicate declaration of k_thread_priority_set().

Change-Id: I616ae6f2e06c95ecba3b92324186b3fa29162fd1
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-13 13:53:59 +00:00
Allan Stephens
b03955033b unified: Eliminate unimplemented unified kernel APIs
Gets rid of unified kernel APIs that will never be implemented.
(i.e. They were proposed, but are no longer considered desirable.)

Change-Id: I63ff0d2cdef355d21595f2a778ef5d5b18796149
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-13 13:53:59 +00:00
Allan Stephens
f817d2c25d unified/doc: Update memory pools section of Kernel Primer
Also tweaks the memory maps section so that the two sections
are laid out in a similar manner.

Change-Id: I3abd69dd7e6c65cd1d6a4f12b3b14aa1b166ca5b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 21:49:09 +00:00
Ricardo Salveti
b0e0c51b47 arm: move atomic operations selection to the Cortex-M Kconfig
Builtin might not be available for ARMv6 (Cortex-M0/M0+) depending on
the toolchain used (not available by Zephyr's SDK GCC), so move the
atomic operations selection to the Cortex-M family Kconfig file.

Change-Id: I20a5a0c5fdd2bcff2d304139f5a7e8502fdb1cb3
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-10-11 20:47:49 +00:00
Allan Stephens
da912ba68f unified/doc: Minor updates to thread sections in Kernel Primer
Change-Id: Id090413b51bf194b358c8b25e860af01368774a0
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 20:21:04 +00:00
Allan Stephens
f0d6c033aa unified/test: Fix issues affecting LIFO object test application
Revises the test to account for changes in LIFO object behavior
in the unified kernel.

Note: A LIFO object shouldn't really be used to try and pass
data items between two different threads in an ordered manner,
as this test is doing. Ordered behavior should only be expected
when a single thread is adding and removing items from a LIFO.
A LIFO is typically used to pass data items between different
threads when ordering doesn't matter -- for example, when using the
LIFO to implement a shared pool of data items that can be allocated
and returned by a bunch of threads. (A LIFO object is more efficient
than a FIFO object for implementing this kind of pool.)

Change-Id: Ic4cbd8b8368477e72c1bf0bca35600b78f963933
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
8472a63317 unified/test: Fix issues affecting XIP test applications
The nanokernel version of this application now uses its own source
files to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ie7254cce314dc8d55ab325f784bd4f3309329baa
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
b5f9543535 unified/test: Fix issues affecting static idt application
The nanokernel version of this application now uses its own source
files to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ief1d90251df62b54a6814e82cb95730088d40d99
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
98e1e0674c unified/test: Fix issues affecting stack canary applications
The nanokernel version of this application now uses its own source
file to eliminate its reliance on the build system setting the
CONFIG_MICROKERNEL and CONFIG_NANOKERNEL options correctly
(which the unified kernel build system doesn't do).

Change-Id: Ife27f8172b2be33b95136ccdfa29522c8a6fba0b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
16376d00e6 unified/test: Fix issues affecting test_critical application
Adjusted thread priorities to lie within the default priority
range for the unified kernel.

Change-Id: I130c60b382a6205c4c41b6f74f77679c87e6dc4d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
6f96335a39 unified/test: Fix issues affecting task test applications
Fixes bug with the private definition of the helper task
that incorrectly added task to the EXE task group.
(This is problematic because the regression task also
starts the helper task!)

Revises test code to use legacy kernel types for task id and
task priority values, rather than using "int", since these
types are not necessarily integer values in the unified kernel.

Revises task/thread priorities used by test so they fit within
the unified kernel's default priority range.

Change-Id: I431120e5d1b44c65f423addfff1330f994fed71b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
ea6cfd1d83 unified: Add legacy DEFINE_TASK support
Allows unified kernel to support legacy microkernel applications
that use private tasks.

Also renames the unified kernel macro for defining a thread
to be consistent with the naming used for defining other kernel
objects.

Change-Id: I667d87056138c45c291dd848344e4051bf9fd1ff
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:59:16 -05:00
Allan Stephens
0cdcc6c08c unified: Extend unified kernel sanity test coverage
Updates unified kernel sanity test to include more
applications that are known to work properly.

Change-Id: Ice15bd1034f92269ef6ce9e3cd08599497814bd8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:54:44 -05:00
Allan Stephens
77d1b3f3ca unified: Enable legacy isr_task_id_get() & isr_task_priority_get()
Change-Id: Icb23be1c8098a5e0b55d137ef37e4a31e1c034d0
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:54:44 -05:00
Allan Stephens
86ea333b5a unified: Remove unimplemented kernel workload APIs
These can be re-introduced if a kernel workload measuring
capability is added to the unified kernel.

Change-Id: Id7ad9c1239667511ffcecf571126301c9b278929
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:54:44 -05:00
Allan Stephens
a28da06c0f kernel: Fix to DEFINE_TASK() macro
Adds type cast to convert task group argument to a numeric value,
in case the caller passes in "NULL" (as Kernel Primer says to do
when the task isn't a member of any task group).

Change-Id: I549f86aba0f340c2fb256c4fceeaf786fb8eb5fc
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-11 09:54:44 -05:00
Benjamin Walsh
a6e85b248a unified: fix remaining issues for building without SYS_CLOCK_EXIST
Do not include timeout_q.h when !SYS_CLOCK_EXIST, this allows removing
_unpend_thread_timing_out() in that case.

Have _abort_thread_timeout() return 0 (success) when !SYS_CLOCK_EXIST.

With this change, the minimal footprint nanokernel project compiles for
the unified kernel.

Change-Id: Ifbf9167a82fb3ebcf6941bf3f85c105c23c9060c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:44 +00:00
Benjamin Walsh
ce9f782a7f unified: use _is_thread_pending() rather than poking in _timeout
That's what the interfaces are for.

Change-Id: Ida0b4d6561c7848a63bcb06537e0dbaafd8dbbfd
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:43 +00:00
Benjamin Walsh
48efb384f8 unified: do not compile out _k_neg_eagain when !CONFIG_ERRNO
It is always needed by the kernel, since the return codes are now
errnos. CONFIG_ERRNO is the mechanism for having a per-thread errno, not
using errno values.

Change-Id: I4ed14896a342f4122793d91b13c41b4a6a74716d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:42 +00:00
Benjamin Walsh
1a5450bb8e unified: merge NANO_TIMERS and NANO_TIMEOUTS with SYS_CLOCK_EXISTS
Timers are based off timeouts now, which can only be enabled when the
system clock is enabled. So the three are really just one setting now.

Keep the NANO_TIMERS and NANO_TIMEOUTS around for now until all
middleware that rely on them is updated. They are always enabled when
SYS_CLOCK_EXISTS is enabled.

Change-Id: Iaef1302ef9ad8fc5640542ab6d7304d67aafcfdc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:41 +00:00
Benjamin Walsh
8ae55deaf9 unified: remove unused references from nano_private.h
Leftover from the nanokernel.

Change-Id: I06f43f182ddbf40617b97aea424252e9c46a95e1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:40 +00:00
Benjamin Walsh
c742d7e6b3 unified: cleanup kernel initialization
- ensure dummy thread's stack is aligned
- rename nano_init() to prepare_multithreading
- move _Swap() to main thread into its own function

Change-Id: I6c8dbe2a4e034f3db90b55d1a5e30bc73bac3d50
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:39 +00:00
Benjamin Walsh
b7ef0cba5f unified: remove last instances of struct tcs
Change-Id: I956bf0e96266e68ac1743f02a82ffafe77ebb0e8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:38 +00:00
Benjamin Walsh
055262c159 unified: remaining timeout cleanup
Rename remaining functions to fit with kernel naming convention for
internal interfaces. Use struct k_thread instead of struct tcs.

Change-Id: I28cd7f6f4d7ddaeb825c8d2999242d8d2dd93f31
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:37 +00:00
Benjamin Walsh
601b354ffe unified: clean-up timeout code for unpending a thread
Integrate _timeout_remove_tcs_from_wait_q() into
_unpend_thread_timing_out().

Change-Id: Id57d9fd8f9e877e580460091172aaabf451f3d4b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:37 +00:00
Benjamin Walsh
688973e5ab unified: streamline "timeout add" internal interfaces.
Rename _do_timeout_add to _add_timeout, rename _TIMEOUT_ADD to
_add_thread_timeout to better reflect their functionalities. Have the
latter call the former, remove _do_timeout_add and
_nano_timer_timeout_add.

Change-Id: Ica86bea10d99d72bf78379598a942d277e7002d0
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:36 +00:00
Benjamin Walsh
0bd7e0d148 unified/mem_pool: use K_NO_WAIT, not TICKS_NONE
TICKS_NONE is only for legacy API.

Change-Id: Iffd53fbd4115da51dac18b4d74786d164353dbfb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:35 +00:00
Benjamin Walsh
7caef4581d unified: streamline "timeout abort" internal interface
Rename _do_timeout_abort to _abort_timeout, rename _timeout_abort to
_abort_thread_timeout to better reflect their functionalities. Have the
latter call the former, remove _do_timeout_abort and
_nano_timer_timeout_abort.

Change-Id: I0fea9474b19a2eb47a37489eb06c0d1d56886c9c
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:34 +00:00
Benjamin Walsh
179fd3a80c unified/legacy: disable clock-based work_q APIs when no system clock
Change-Id: I15e76499a8425539a631819960976801356d8fa6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:33 +00:00
Benjamin Walsh
57d55dcc7a unified: have __ticks_to_ms() return 0 when no system clock
Change-Id: I0834dfff2a631ef365be7ae3a55d5ad4ace3dbf5
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:32 +00:00
Benjamin Walsh
35497d6c5e unified: cache the next thread to run
When adding a thread to the ready queue, it is often known at that time
if the thread added will be the next one to run or not. So, instead of
simply updating the ready queues and the bitmask, also cache what that
thread is, so that when the scheduler is invoked, it can simply fetch it
from there. This is only done if there is a thread in the cache, since
the way the cache is updated is by comparing the priorities of the
thread being added and the cached thread.

When a thread is removed from the ready queue, if it is currently the
cached thread, it is also removed from the cache. The cache is not
updated at this time, since this would be a preemptive fetching that
could be overriden before the newly cached thread would even be
scheduled in.

Finally, when a thread is scheduled in, it now becomes the cached thread
since the fact that it is running means that by definition it was the
next one to run.

Doing this can speed up considerably some context switch times,
especially when a thread is preempted by an interrupt and the same
thread is scheduled when the interrupt exits.

Change-Id: I6dc8391cfca566699bb9b217eafe6bc6a063c8bb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:31 +00:00
Benjamin Walsh
7bc86c0344 unified: use sys_dlist_peek_head_not_empty()
When fetching the next thread to run, we know at least one thread is
available.

Change-Id: I568c33a61b6a0a6d6a7f79c337caecffd5ef70b6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:30 +00:00
Benjamin Walsh
71d5228ca9 unified: un-comment k_thread_[suspend|resume|abort_handler_set]
They are now available.

Change-Id: Iae15636396fdf4d5da96f6735345857d83cd3d51
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:30 +00:00
Benjamin Walsh
02e59e199e dlist: add sys_dlist_peek_head_not_empty()
Can speed up some kernel code paths that know a list is not empty.

Change-Id: Ic1261b2e9bf242b7fe49e8a36aeacf9e03f3026b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-10 21:27:29 +00:00
Anas Nashif
698ef0e3c0 test: build all possible drivers on all platforms
This also removes sensor and sensor2 tests, both are now included in this
single test.

Additionally, set footprint tag to show foorprint changes in gerrit.

Change-Id: I81a9357052adcc4fd910476e0ffc66bfdbdd3bce
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-10 21:26:33 +00:00