Commit graph

42249 commits

Author SHA1 Message Date
Benjamin Walsh
72e5a39ba7 unified: fix misc issues with APIs in kernel.h
ZEP-1022

Change-Id: I88a043cb0127631fcbb48c91504fe4fcd6ae1ecc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Benjamin Walsh
9091e5d253 unified: use correct init macro for k_fifo objects
Was using dlist macro instead of slist macro.

ZEP-1021.

Change-Id: I374ae88289669ca03e3c0c76d33fa0229977e403
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Benjamin Walsh
d3cfc8602d slist: add static initialization macro
Change-Id: Ic0d057ed68dc6513bcc1d4b68fbdfb86c28d1fda
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Vinicius Costa Gomes
0dfc9db815 samples/zoap-client: Add a README.txt to zoap-client
Change-Id: I2373d87cda125036cce169aaa492aeedcbe200dd
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:27 +00:00
Vinicius Costa Gomes
fcb3297b32 samples/zoap-server: Add a README.txt to zoap-server
Change-Id: I136d405e520ed8550e0b5012128a0c673bb9954a
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:27 +00:00
Vinicius Costa Gomes
76e81874f0 samples/zoap_client: Make it work with zoap-server
The path and port used by zoap-client were different than the ones used
by zoap-server.

Even if they are different applications, for consistency, it makes sense
for them both to be able to talk to each other.

Change-Id: I883d59c77bc3800b4f0965ba7bcf96a08e545d29
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:26 +00:00
Vinicius Costa Gomes
08e0e86bb0 tests/zoap: Add tests for the observe feature
Change-Id: I993437169715ce57f6c5c9f3e95689f785db65c4
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:26 +00:00
Vinicius Costa Gomes
7079a18267 iot/zoap: Add helpers for dealing with integer options
A good number of option values represent numbers, so add these helpers
so applications can avoid repeating this.

Change-Id: Ied2a844c51808dcafe751a77492d00f2063de7d6
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:25 +00:00
Vinicius Costa Gomes
441d22a371 iot/zoap: Add port information to network addresses
uIP keeps the port separated from the IP addresses, so if the
application wants to communicate with a remote endpoint we must also
have the port information available.

Change-Id: I8e2b01fe5717166e1f9cebcc74b2056325b8ccc3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:25 +00:00
Vinicius Costa Gomes
92a79f7351 iot/zoap: Add support for observing resources
This adds support for observing resources, for client and server side.

For the server side we augment the resource struct so it can hold
information about each interested observer.

For client side, observing a resource abstracted as an reply that
can be called multiple times.

Change-Id: If3f0b41e302cff357ab891e6e91ec2d41579fb92
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:24 +00:00
Jaakko Hannikainen
54c90bcbd5 tests: Add gcov support
If the -C flag is given to sanitycheck, generate gcov files for unit
tests and render them with lcov.

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: Ic25eae6a3cfc2c45595bd6aa235df2c483aaf6ec
2016-09-30 21:17:42 +00:00
Jaakko Hannikainen
bdfe417020 tests: Add a sample for testing natively
This simple unit test runs basic sanity checking on buffers from
net_buf_get. It demonstrates the mocking support in a real-world case,
where it is used to remove the dependency to nano_fifo.

Origin: Original

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: If2757823bebbc0fa22b3064a432032cdbccdfe2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:42 +00:00
Jaakko Hannikainen
6f8e7b33b1 tests: convert tests/net/buf to the new framework
This is a sample how to use the framework in an integration test
environment.

Change-Id: I01619fce06759ed523c8c878e8bbda6d8d87d604
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:41 +00:00
Jaakko Hannikainen
349a6c5c28 ztest: Add simple integration and unit tests
These tests mainly test the stack whether it compiles and runs fine
under normal conditions. They do not test most failure conditions.

Origin: Original

Change-Id: Iaac73511a0664abd84685112b4e526eab3eb5748
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:41 +00:00
Jaakko Hannikainen
891c369807 ztest: Add documentation
Origin: Original

Change-Id: I0927c25fbbba5d4863f199d058d311c10d52d784
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:40 +00:00
Jaakko Hannikainen
ca505f8452 ztest: Add native building support
This commit allows building tests using the ztest framework without
including Zephyr. This can be used to enable unit testing single
functions, even static ones.

Origin: Original

Change-Id: Ib7e84f4bd9bbbf158b9a19edaf6540f28e47259f
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:39 +00:00
Jaakko Hannikainen
9167a0305f tests: Add a generic testing framework
This framework makes testing in most parts a lot easier, since it gives
an unified base to work with, removing a lot of unnecessary code from
tests. This framework currently features simple assertions and basic
mocking support. The framework works both with and without Zephyr
running, so it can be used for real unit testing.

Origin: Original

Change-Id: I8c5bf2e6b8d6656b6197ee91699b61e730c1cfe3
Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:39 +00:00
Juan Manuel Cruz
5469ff50a1 win-doc: Adds the dependency with the pthread library
Jira: ZEP-779

Change-Id: If9f1714a28c8614fc82cc42c9835eaf4682ce09b
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-30 17:49:41 +00:00
Juan Manuel Cruz
99db9741ec win-doc: Add recommendation for regex library configuration
Jira: ZEP-779

Change-Id: I7a49be6f10959dae81e00d5dc66ef01463e88980
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-09-30 17:49:40 +00:00
Amit Kucheria
9b5a4647e0 boards: Rename the nRF52 Nitrogen to 96Boards Nitrogen
Point to a new wiki page for the documentation. The old page can be removed
once this patch is committed.

Change-Id: I2b031bfffe10ec24c41c58d0754f2b14d95f5e53
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
2016-09-30 17:13:39 +00:00
Jukka Rissanen
d8083bd6c7 toolchain: Use ALIAS_OF() in FUNC_ALIAS() macro
Use the ALIAS_OF() macro instead of using alias attribute
directly.

Change-Id: I2f904644df2212b72d8d973bc3651dcf9e7a8b0d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-09-30 15:55:40 +00:00
Jukka Rissanen
fca95109a8 toolchain: Make ALIAS_OF() macro public
Removing _ prefix from ALIAS_OF() macro in order to indicate
that it is for public use.
The macro can be used whenever the FUNC_ALIAS() cannot. The
FUNC_ALIAS() macro can give errors if the aliased function
has parameters like uint16_t etc.

Change-Id: I2f5bc51268072141bb6fb73efe034eb743db3257
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-09-30 15:55:39 +00:00
Johan Hedberg
27fc467e74 net: buf: Allow NULL head pointer when inserting to frag list
To avoid extra logic in code that creates net_buf fragment lists, make
it possible to pass a NULL pointer as the head net_buf when there are
no previous buffers. Before this change the code would look like this:

	if (head) {
		net_buf_frag_add(head, buf);
	} else {
		head = net_buf_ref(buf);
	}

After the patch the code can simply do:

	head = net_buf_frag_add(head, buf);

This will then do the right thing regardless if head is NULL or
non-NULL.

Change-Id: I300394242e2e243ed3839b25629ec816dd98c148
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-30 15:07:32 +00:00
Johan Hedberg
8afb6fc229 net: buf: Allow head deletion with net_buf_frag_del()
Extend the net_buf_frag_del() API to be usable for deleting the head
of a fragment chain. This is useful when parsing a stream-based
protocol encoded into a fragment chain, making code such as the
following possible:

	...parse data from 'head' buffer...

	/* If current buffer is empty, move to the next one */
	if (!head->len) {
		head = net_buf_frag_del(NULL, head);
	}

Change-Id: I65794bd7fab4e6dadfd2d6b2fa367f9424fd1bde
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-30 15:07:32 +00:00
ksimanto
1006f94998 doc: Update the device power management API documentation
Updated the device power management documentation to reflect
the updated API.

Change-Id: I6e4da7e1ae3642d28205504b8f19d9c8f9a08727
Signed-off-by: Keren Siman-Tov <keren.siman-tov@intel.com>
2016-09-30 11:04:41 +00:00
Daniel Thompson
9a81ffa7ad device: Make device_get_binding() const correct
Currently passing a constant string (other than a string
literal) to device_get_binding() generates a spurious warning.
The warning is spurious because device_get_binding() does not,
nor is it ever likely to, modify its argument. To fix the
warning we modify the prototype to make clear name will never
be modified.

Change-Id: I2df22de61eb2580b2086a685549900d7ed4a322d
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-09-29 13:46:43 +00:00
Andrew Boie
26b1651f0c intstub.S: fix argument to _sys_power_save_idle_exit on IAMCU
Change-Id: I5aa1abe464ba2b8f9c36be78a95705ffcf993c7d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:27 +00:00
Andrew Boie
70d8a32740 x86: interrupts: consolidate duplicated code in idle path
Change-Id: I16b80f363fef17d3ea99fec0ced4f49238f8e6c7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:07 +00:00
Andrew Boie
e56f61f5aa x86: exceptions: simplify exception stubs
Exception stubs now just push the handler and in some cases a dummy
error code before jumping to the exception handling code, never to
return.

Change-Id: I6a79d9243deb3fc7ccdae003dd0917364c0aa304
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-28 20:28:07 +00:00
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