Commit graph

41120 commits

Author SHA1 Message Date
Andrew Boie
edeb1f1c52 x86: interrupts: optimize and simplify IRQ stubs
Interrupt stubs now just push the ISR and parameter onto the stack
and jump to the common interrupt code, never to return.

Change-Id: I82543d8148b5c7dfe116c43f41791f852614bb28
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:06 +00:00
Dmitriy Korovkin
9558d47fd3 unified: Build kernel objects as a static library
Building kernel objects as a static library allows not
to include the initialization function for an object
type if this type is not used by the application.
It reduces memory footprint

Change-Id: I2b3c79cb2591fdd1ce15d27684c4a874e759c559
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-28 19:13:36 +00:00
Dmitriy Korovkin
284042d746 unified: Invoke kernel object initialization with SYS_INIT macro
Kernel object initialization needs to follow the common initialization
scheme.

Change-Id: I6693678ed7c4975b3c588061013fa0c5d24968c3
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-28 19:13:35 +00:00
Dmitriy Korovkin
4223ba7964 unified: Add initialization priority level for kernel objects
The separate initialization priority provides more
flexibility when it's needed to arrange the initialization
sequence.

Change-Id: Ie1b7b48d282618f6d641320bf3b24f63716a7342
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-28 19:13:35 +00:00
Benjamin Walsh
aabf74cda5 Dining philosophers demo for unified kernel.
The demo can be configured to use different object types for its
synchronization: SEMAPHORES, MUTEXES, STACKS, FIFOS and LIFOS. To
configure a specific object, set the value of FORKS to one of these.

By default, the demo uses MUTEXES.

The demo can also be configured to work with static objects or dynamic
objects. The behaviour will change depending if STATIC_OBJS is set to 0
or 1.

By default, the demo uses dynamic objects.

The demo can be configured to work with threads of the same priority or
not. If using different priorities, two threads will be cooperative
threads, and the other four will be preemtible threads; if using one
priority, there will be six preemtible threads of priority 0. This is
changed via SAME_PRIO.

By default, the demo uses different priorities.

The number of threads is set via NUM_PHIL. The demo has only been tested
with six threads. In theory it should work with less than six threads,
but not with more without making changes to the forks[] array in the
phil_obj_abstract.h header file.

Change-Id: If7a0a34b216929a661245fd921a32ec413df8a4a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-28 14:14:02 +00:00
Andrew Boie
f83134130e segmentation.h: fix get_gdt/get_idt
The location needs to be dereferenced first.

Change-Id: I302765ced3d970b99960e64def5adfef3546c14f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-26 12:13:27 -07:00
Andrew Boie
2d7490c7ce x86: don't unconditionally run ISRs with interrupts enabled
Re-enabling interrupts before running the ISR must only be done
when CONFIG_NESTED_INTERRUPTS is turned on.

Change-Id: I2c04f2ce08d41cfef5553ee8554a90d1be0e86a3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-26 17:53:45 +00:00
Qiu Peiyang
2a2291d430 remove unused whitespace in arch/arc/core/fault_s.S
commit  e57b21c78c ("irq: Use lowest priority not a
hard-coded priority 2") introduce a wrong whitespace,
not complying with coding style. Remove it.

Change-Id: Ie7e48843e5da6cb3417773ef8a57cf9a166c70d6
Signed-off-by: Qiu Peiyang <peiyangx.qiu@intel.com>
2016-09-25 20:35:09 -04:00
Chuck Jordan
e57b21c78c irq: Use lowest priority not a hard-coded priority 2
In this file was found an assumption about how many
priorities are being used. This is configurable with
CONFIG_NUM_IRQ_PRIO_LEVELS, however, so it should be using that
instead. This line of code changes:
or r3,r3,(1<<(CONFIG_NUM_IRQ_PRIO_LEVELS-1))
so as to use the correct bit to OR.

Change-Id: I8c6297e98b5163aa27460a68b203e8a27d1e2506
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-09-24 23:22:03 +00:00
Chuck Jordan
8e5c813a24 irq: _ARC_V2_DEF_IRQ_LEVEL should be set to last legal priority
Set _ARC_V2_DEF_IRQ_LEVEL to the last legal priority value, and not 15.
The last legal value is: (CONFIG_NUM_IRQ_PRIO_LEVELS-1).
This is safer because we don't want priorites not configured to be 
enabled.

Change-Id: I1689cc00aa7e707a204d16ec17d7f396566e8638
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-09-24 23:22:03 +00:00
Anas Nashif
6ab9701330 samples: remove unused MDEF file
This is a nanokernel sample and the MDEF file is not being used at
all.

Change-Id: I344adfa9394329258144de88521764974238f6a3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-24 08:26:57 -04:00
Anas Nashif
f720bb12a7 mvic: fixed printk format
Jira: ZEP-970
Change-Id: Ie57938d3d1c4740a7a4aa0ed403d2b2cc0e36eae
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-24 08:12:47 -04:00
Anas Nashif
89ead817b7 usb: do not assert on a variable we do not have
Jira: ZEP-967
Change-Id: I98ef740bb72f8779079ba2ae469b1079c292840d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-24 08:12:35 -04:00
Andrew Boie
4dd1ca2c1a x86: add _init_irq_gate and use it in gen_idt
Change-Id: Id655e5c42ca82e48c5e6d80dcb1c7db8d207eb25
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-24 01:23:18 +00:00
Benjamin Walsh
ba5ddc189e unified: implement k_uptime_{get,delta}()
Simple conversion from ticks for now.

Change-Id: Ib81fc738d45641a6a3a88d2adec1f3eb861f3f97
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-23 21:39:40 +00:00
Benjamin Walsh
a9604bd895 unified: move basic ticks-to-ms conversion to kernel.h
The basic conversion, i.e. not handling the TICKS_UNLIMITED case, is
useful internally since the kernel is still tick-based.

Change-Id: I00a01047ec48dad6834dd8ea5dc831eb8c0c2501
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-23 21:39:40 +00:00
Peter Mitsis
19547d09f7 unified: Eliminate useless check in idle thread
There is no reason to check if the idle thread is a cooperative thread
before invoking k_yield(); it is safe to unconditionally invoke it every
iteration.

Rationale: If the idle thread is cooperative, k_yield() must be invoked
to allow a new thread to get scheduled to run. If the idle thread is
preemptive, then k_yield() effectively becomes a no-op.

Change-Id: Ide3204c92381640b5d12b39ca0f258d56d8cc3d0
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:22 +00:00
Peter Mitsis
ba26615a47 unified: Remove unused _nano_get_earliest_deadline()
The routine _nano_get_earliest_deadline() is still used by both
the microkernel and nanokernel.

Change-Id: I14501e6d41ca5faac27dead5873ef897e79831aa
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:22 +00:00
Peter Mitsis
7e9d7058cc unified: Remove #if 0 code block from wait_q.h
Change-Id: Ic916c161b7faa9260e85899682c43d97f24e5197
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:21 +00:00
Peter Mitsis
e02c720e3d unified: Remove obsolete wait_q.h macros
Removes the following wait_q.h macros
  _NANO_OBJECT_WAIT()
  _TIMEOUT_UPDATE()
  _TIMEOUT_TICK_GET()

Change-Id: I7cb78728aaad74acf7f121c79f03d32fa6af5aac
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:21 +00:00
Peter Mitsis
b27249486a unified: Remove references to obsolete task_timeout
Change-Id: I7c3b1b8418809914d3daf9d68ed8e4c3b99dd0b1
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:20 +00:00
Peter Mitsis
3259d0e3c4 unified: Replace _nano_get_earliest_deadline()
Replaces _nano_get_earlist_deadline() with the more streamlined
routine _timeout_get_next_expiry().

Change-Id: Iee7ec727f0500cb28e37a364036fd40a483b40c3
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 19:53:20 +00:00
Dmitriy Korovkin
5a92f4b54f unified: Make test_pend unified capable.
test_pend test checks task_offload_to_fiber() routine.

Change-Id: I1d23e371accd633cce94db71b94f224b9b99a385
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-23 18:51:07 +00:00
Dmitriy Korovkin
bf9972113f unified: Add legacy task_offload_to_fiber() routine
For unified kernel the routine is implemented through
a wait queue.

Change-Id: Iceab7b821e3b55e0773ad780f4b9b0a1dfc21f5d
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-09-23 18:51:06 +00:00
Peter Mitsis
653ff0b949 unified: Remove check in _reschedule_threads()
The routine _reschedule_threads() does not need to check that the
scheduler is locked as this is done as part of _must_switch_threads().

Change-Id: I701b811512836eef591b2adcd708991ec9324b3d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-23 18:25:49 +00:00
Andy Ross
8d8b2acb26 k_timer: Don't allocate dynamic timers by default
Most apps run fine with static k_timer objects.  Don't pay the cost
for the timer pool if no one asks for it.

Also turn off the allocate/free API in the header if it can't possibly
work at runtime as it's an obviously-detectable error that would
otherwise be visible only at runtime.

Change-Id: I492e6e01c4213e3544f707247eea6e4bc601fefd
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-23 18:25:37 +00:00
Andrew Boie
7c385bd8b1 ioapic: make init-time RTE masking optional
In some cases we can either assume they are already masked
at boot and save some cycles, or the IOAPIC has configuration
from a prior boot stage that needs to be preserved.

Change-Id: I0c71ff0f01a6ee13a3b9c9e239d5a933d6cb6542
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 17:54:19 +00:00
Andrew Boie
d3831180cf apic: set initial PM state at build time
Change-Id: I7531088d0455fb405513787eb61137ff79ca8b29
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 17:53:49 +00:00
Andrew Boie
325cae5c94 kernel: remove lingering irq_connect_dynamic() references
This API no longer exists.

Change-Id: I724bee8c0ebfbbe2d47c00c7645977d817bbcd36
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 15:36:51 +00:00
Andrew Boie
a5b2682ce8 init.h: use a counter when naming system devices
Avoids a build error if two or more system devices are declared
in the same C file that use the same init function.
Use _CONCAT() for token concatenation to ensure the names are
properly generated, needed if any of the components are themselves
macros that need to be expanded.

Change-Id: I559bd987617d8cf3bd8c9ee0c985d670b4f59a64
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-23 15:36:29 +00:00
Kumar Gala
9ec847e608 Revert "rfc: ksdk: Add KSDK ENET driver."
This reverts commit 581e15ced2.

The commit was marked RFC and should not have been merged yet.

Change-Id: Iafd3587f8840e64670c32fa5726ea20ac9c9962a
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-09-23 09:07:26 -05:00
Marcus Shawcroft
581e15ced2 rfc: ksdk: Add KSDK ENET driver.
Provide a network driver wrapped around the KSDK ENET and PHY
drivers.

This driver is functional, just.  It is not in a fit state to be merged to master yet.

Origin: Original

Change-Id: Id29e756f33c6c0263926139188c49f9a9c3d5e09
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-23 01:54:00 +00:00
Marcus Shawcroft
ec60dcc4c1 ksdk: Build ksdk fsl_enet.c and fsl_phy.c
Add ksdk components necessary to build a network driver on k64f to the
build process.

Origin: Original

Change-Id: I777ab2594b4c443d634264625c39c6c875c34d9f
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-09-23 01:53:50 +00:00
Ramesh Thomas
98357de7a3 sample: fs: Add tests for fs_truncate and fs_statvfs
Adds tests for the new APIs fs_truncate() and fs_statvfs()

Jira: ZEP-636 ZEP-622 ZEP-635
Change-Id: Ic1c6dfa4e9592a362b67129df389b4b78cc5f250
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-23 00:06:33 +00:00
Ramesh Thomas
97d8fd1748 fs: Add file system API to flush cache of an open file
This API flushes the cached data of an open file to the
storage media. This can be called after writes to avoid data
loss if power is removed unexpectedly.

Jira: ZEP-767
Change-Id: I0f99f2f34126aa8e6a43f69c7a1b6d903937de11
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-23 00:06:32 +00:00
Ramesh Thomas
524004d54b fs: Adds file system API to get volume statistics
Adds API to return volume statistics. This is similar to
fstatvfs() POSIX function but limited to total size, free space,
allocation unit size and optimal transfer block size.

Jira: ZEP-636
Change-Id: Ie9e7367b9164277875860c2d0e8de883b2fca07a
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-23 00:06:32 +00:00
Ramesh Thomas
211db5352d fs: Adds file system API to grow or shrink a file
Adds fs_truncate() function which can be used to change the size
of a file. The name is counter intuitive but that is how the POSIX
version is named. It shrinks as well as grows a file.

Jira: ZEP-635 ZEP-622
Change-Id: If7b8cad17e1b80479a529c60a32c12fb134cd456
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-09-23 00:06:31 +00:00
Anas Nashif
986596bb91 boards: arduino_101: remove backup/restore scripts
restoring of the original firmware is now possible using the
flashpack utility.

Change-Id: I32df4b5bb63fb5f6a318026e9f89b1504bd37f5e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:34 +00:00
Anas Nashif
179ce1c891 boards: remove obsolete board basic_minuteia
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: I01c825c7eb44d6c321f2ffb88e8899da528921dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:34 +00:00
Anas Nashif
572f4a1a14 boards: remove obsolete board basic_cortex_m3
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: Ied681b6059ad74f9d019054292c919a9f938e7d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:33 +00:00
Benjamin Walsh
70c68b92de unified: change signature of k_sem_reset()
Does not need to return anything, since it simply resets the count.

Change-Id: I1185ea1728a9809178afa53b3dba47f7650218e2
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-22 21:09:44 +00:00
Benjamin Walsh
bee1c0655f test_mem_safe: fix breakage in unified kernel
Linker scripts had not been updated following the addition of
_k_mem_pool sections.

Change-Id: Ic58e893b5296d0f814253e714f8858c272e79913
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-22 21:09:44 +00:00
Benjamin Walsh
0bee91dae1 unified: fix some leftover K_<obj>_DEFINE macros
The K_<obj>_DEFINE macros in the unified kernel create objects of name
'name', and not a pointer named 'name' to an object. Some macros
contained the code from early prototyping.

Change-Id: I7262570fbe0b267012874eac0185b4e0cd7f523d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-22 21:09:22 +00:00
Javier B Perez
14dd53289d drivers: serial: uart_qmsi: update Quark SE C1000 config
Updated CONFIG_SOC_QUARK_SE_SS to CONFIG_SOC_QUARK_SE_C1000_SS

Change-Id: I7dc02d91a4d739f6cd3f84001d1dd29759317163
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-09-22 18:00:07 +00:00
Kumar Gala
3fa32becd5 arm: merge Cortex-M3/M4 memory map into master Cortex-M memory map
Merge the Cortex-M3/M4 memory map bits into the master memory map in
prep for it being shared with Cortex-M7 support and Cortex-M0 support
going forward.

Change-Id: I211fc2a2d7d49082b51463f06e6e71cca75d886f
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-09-22 17:19:40 +00:00
Tomasz Bursztyka
276086da28 kernel: Fix for k_sem where counter is a unsigned int
So let the helper return the right type.

Change-Id: I850937a70fe042e42c06cb53ad736c8904221f1b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-09-22 17:01:48 +00:00
Paul Sokolovsky
dbb9094b8a net: Set uIP context on newly allocated buffers immediately.
This context must be set for TX buffers, and there's no better place to
set it than at the allocation time. If not set, it may end up NULL,
causing adverse effects (one seen by few parties is dereferencing random
memory locations to get (random again) MSS values). For RX buffers, uIP
context is set elsewhere too, but anyway, common sense says that if a
buffer is allocated for network context X, and that context uses uIP
connection Y, the a buffer should be just cross-linked with Y during
allocation time, not somewhere later.

Change-Id: Icdb3cd724802ca263c1cd0e3909be811e53822ba
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-09-22 12:00:24 +00:00
Anas Nashif
58002193e9 drivers: gpio: reuse gpio Kconfigs for sensor subsystem
No need to create new Kconfig that do exactly the same, just
reuse those from the main QMSI driver.

Change-Id: I965055f36845ac0464e4a383b0d05c3ae35c0015
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 01:00:46 +00:00
Vinicius Costa Gomes
47e8893654 tests/zoap: Add simple test for retransmission
Change-Id: I3a552f10e02e3880bbeb00b31f31c31414c6f163
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-09-22 00:54:36 +00:00
Vinicius Costa Gomes
7d0a1279b6 iot/zoap: Fix retrieving the token for every reply
As there is only one response token, we can do this only once at the
beginning of the function, instead of every iteration.

Change-Id: Ibb324a1189929227bd1eb9837c5d330ff8c8dac2
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-09-22 00:54:36 +00:00