Commit graph

41120 commits

Author SHA1 Message Date
Luiz Augusto von Dentz
e891c290cb net: buf: Assert on invalid parameters
This assert in case NULL is passed as parameter tha cannot be NULL
which is useful to detect possible bugs.

Change-Id: If8d521642bed83cb9b183b95dd1a02d604417435
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-28 14:57:43 +00:00
Luiz Augusto von Dentz
1cbd6b1939 net: buf: Fix warnings related to legacy API
This removes the use of sys_thread_self_get replacing with
k_current_get and also remove the use __func__ macro as that is already
added by SYS_LOG macros.

Change-Id: I9949896c76070183b3c1ea40100d82291748fc68
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-28 14:57:42 +00:00
Luiz Augusto von Dentz
62111b70ea net: buf: Use NET_BUF_SIMPLE_ASSERT with net_buf_simple API
NET_BUF_ASSERT shall only be used with pure net_buf APIs.

Change-Id: I5283fb6af93a1284c664d8e6b86bb8bf14282dfb
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-28 14:57:42 +00:00
Yossi Havusha
85b954dc4c logging: add exeternal hook to sys_log
By adding external hook to sys_log we will allow applications
the flexibility of using various output mechanism such SPI,
flash, FS etc.

Jira: ZEP-1172

Change-Id: Ie32a5e52c3946ada0349b75a35cc107bb29385a1
Signed-off-by: Yossi Havusha <yossi.havusha@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 23:07:35 -05:00
Anas Nashif
247a4509ce drivers: nrf timer: remove unused variable
retval is not being initialised or set.

Change-Id: Iaab4f1acbb009b1fb9cdbc4b3c29ffb696dc8615
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 22:36:02 -05:00
Ramesh Thomas
87a2b02189 quark_se_ss: power_mgmt: Fix a bug in call to sleep instruction
When sleep instruction is called with interrupts enabled, the
interrupt priority threshold bits need to be set. Only interrupts
with equal or higher priority will wake the sleep. Currently it
is set to 0 unintentionally and only priority 0 interrupt can
wake the sleep.

Jira: ZEP-1349
Change-Id: I927e259345cc37c5ecc4dfdcde996dd16443e61b
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-28 01:00:35 +00:00
Ramesh Thomas
4a09593714 quark_se: power_mgmt: Fixes a cpu context save bug
The cpu context save function was manipulating stack and
returning to C caller. This can corrupt stack if the calling
function has data saved and it pops before entering deep
sleep. Moved sleep functions into assembly to avoid this.

Jira: ZEP-1345
Change-Id: I8a6d279ec14e42424f764d9ce8cbbef32149fe84
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-28 00:59:51 +00:00
Vinayak Chettimada
a100ada866 drivers: timer: nRF SoC Series RTC system clock implementation
The nRF5x series SoCs do not implement systick, hence we disable
CORTEX_M_SYSTICK.
Instead, use nRF SoC Series NRF_RTC1 for system clock interfaces.
The kernel system clock interface is implemented using the low
power real time counter NRF_RTC1. NRF_RTC0 is used by the BLE
controller.

In addition, cleanup nRF5x series defconfig to be consistent.

Jira: ZEP-742
Jira: ZEP-1308
Jira: ZEP-1315

Change-id: I0f6cc1836fe0820a65f2cbb02cf5ae7e9eb92e1d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 19:39:27 +00:00
Anas Nashif
92c5f91413 arm: systick: Some SoCs do not have systick
Make the systick feature optional that can be selected by the SoC.

Change-Id: I4a405640b84daecc17fc1882743d3cafb78ff861
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-27 19:39:26 +00:00
Szymon Janc
bde20d5447 printk: Add basic support for width modifier and zero padding
This adds basic support for width modifier when printing integers.
Supported specifiers are u,i,d,x,X. Width '*' is not supported.
Flag '0' for left-pading number with zero is also supported.

examples:
printk("0x%x 0x%02x 0x%04x 0x%08x\n", 1, 1, 1, 1);
0x1 0x01 0x0001 0x00000001

printk("0x%x 0x%2x 0x%4x 0x%8x\n", 1, 1, 1, 1);
0x1 0x 1 0x   1 0x       1

This should make printk usable for pretty printing u8 and u16 integers.

Change-Id: I58fa869e9c295a052f97fbf052291ef4d132811e
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2016-11-27 19:26:55 +00:00
Marcus Shawcroft
7df7862749 sensor/bmc150: Limit name space, add static.
Change-Id: Ifd9ec1aec4e6486c14121b30bcd009b61456276d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
c3b2861572 sensor/bmc150: Fix filename in comment.
Change-Id: I0a5aaf0f3633034fabef351dc419899f9bb9c8fd
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
91bc741255 sensor/bmc150: Fix logging configuration.
Change-Id: Iae06066b568f51c8b63f00e973a411dcbb396dac
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
40d2572d12 sensor/lsm9ds0_gyro: Limit name space, add static.
Change-Id: Ifff624a2c0f619d7bb3e005b4e52b4602730a66d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
8f92c5462e sensor/lsm9ds0_gyro: Fix filename in comment.
Change-Id: I6de8806fbe6ec25c83042bc52274fd91a76ae280
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
9048cb91d0 sensor/lsm9ds0_gyro: Fix logging configuration.
Change-Id: I332d9515e61d83f243f49353d4b67f854fec7f2e
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
744e438a33 sensor/lsm9ds0_mfd: Fix logging configuration.
Change-Id: I925a683e0ac961f05065b25782fc30d007e1aba6
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:56 +00:00
Marcus Shawcroft
aba867d5e9 sensor/fxos8700: Switch to generic SYS_LOG_SENSOR_LEVEL
Change-Id: I21607836b2fe0cd1cd62759bed499af70a93e1be
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
f112e8e9bc sensor/lps25hb: Limit name space add static.
Change-Id: I707fd3666f27a982f9b4ef0facf7a3a211db8914
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
5fe0a759ee sensor/lps25hb: Fix filename in comment.
Change-Id: Ie5529544248d408cb314be83a609b8d1d9ecaaa5
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
052a67f88d sensor: Remove unsued LPS25HB_SYS_LOG_LEVEL config.
Change-Id: I5af84fd420a9c50f943938faf7ed966385c19f08
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
14cd63a92a sensor/lsm6ds0: Limit name space, add static.
Change-Id: I227865ebbb6bf66b63694639dede3f0276c4cf22
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
9dc050d15e sensor/lsm6ds0: Fix filename in comment.
Change-Id: I50df25c209c322f404e7a78c5df57c2c7d75964b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:27:55 +00:00
Marcus Shawcroft
79a4d35043 sensor: Remove unsued LSM6DS0_SYS_LOG_LEVEL config.
Change-Id: I7b994b33a1202cbc75a8ce5afd0385a45627f45d
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-11-27 10:26:53 +00:00
Benjamin Walsh
8641c9e6a5 arm: fix bug when Zero Latency Interrupts are enabled
An IRQ would always register as a ZIL interrupt.

Change-Id: If82a85f472a60512745652aacc7e8b7dfacaa268
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-26 14:04:19 +00:00
Benjamin Walsh
6741561ae4 arc: fix missing _firq_stack symbol when INIT_STACKS=y and NUM_BANKS=1
There is no FIRQ stack in the system in this case, so do not initialize
it.

Change-Id: I8bc068ce43ac8a39909994d8cc01ba0c6a17f4ae
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-26 14:04:19 +00:00
Benjamin Walsh
a36e0cf651 kernel: remove K_TIMING thread flag
The fact that a thread is timing out was tracked via two flags: the
K_TIMING thread flag bit, and the thread's timeout's
delta_ticks_from_prev being -1 or not. This duplication could
potentially cause discrepancies if the two flags got out-of-sync, and
there was no benfits to having both.

Since timeouts that are not parts of a thread rely on the value of
delta_ticks_from_prev, standardize on it.

Since the K_TIMING bit is removed from the thread's flags, K_READY would
not reflect the reality anymore. It is removed and replaced by
_is_thread_prevented_froM_running(), which looks at the state flags that
are relevant. A thread that is ready now is not prevented from running
and does not have an active timeout.

Change-Id: I902ef9fb7801b00626df491f5108971817750daa
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-26 14:04:18 +00:00
Benjamin Walsh
b2974a666d kernel/arch: move common thread.flags definitions to common file
Also remove NO_METRIC, which is not referenced anywhere anymore.

Change-Id: Ieaedf075af070a13aa3d975fee9b6b332203bfec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-26 14:04:18 +00:00
Flavio Santes
f6f60dc2c8 tests/drivers: Update pinmux application
This commit updates the pinmux test case application
to match with the hello_world sample app.

Change-Id: I86f459062527b7e2831bd7a3dfaf6bf8b28ef132
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-26 10:46:11 +00:00
Flavio Santes
1818d6addc tests/multilib: Update README file
Remove nano kernel references found at the README file.

Change-Id: Ib71a9a2900a5cb02a3b6038f74e51e5f860792be
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-26 10:46:10 +00:00
Flavio Santes
328ecb8dfd samples/sensors: Update README files
Remove nano kernel references found at the README files.

Change-Id: Id42f4797561f3d7674110bb84531b5f6e487decd
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-26 10:46:10 +00:00
Flavio Santes
5f52743f09 samples/nfc: Update sample app
This commit updates the nfc_hello sample application:

- Use new kernel API
- Update testcase.ini platform whitelist
- Coding style issues

Jira: ZEP-1348

Change-Id: I2c17e40d654e33a46af02ee2f20d4a88136fcf2d
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-25 16:50:20 +00:00
Flavio Santes
90fefd6dd4 samples/nfc: Update README file
This commit updates the README file adding:

- Build instructions
- Sample output

Jira: ZEP-1348

Change-Id: If2ade8ad505bd24e7fd76f5b835355cf398d8e82
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-25 16:50:20 +00:00
Flavio Santes
c7fe8f2193 samples/nfc: Remove x86 asm code
This commit replaces the x86 asm line:

__asm__ __volatile__ ("bswap %0" : "=r" (x) : "0" (x));

by the sys_cpu_to_be32 macro.

By removing the x86 asm instruction, the nfc_hello sample app
can run on other platforms.

Jira: ZEP-1348

Change-Id: I440e96cd06e70a88552d179a2288c9918e6ca0b0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-11-25 16:50:19 +00:00
Benjamin Walsh
516e79c8da kernel: disable INIT_STACKS by default
Now that we're out of the unified kernel development phase, turn off
that debugging option.

Change-Id: I89decbdf445b1ba111a829edf2c8a36846419586
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-24 16:37:01 +00:00
Benjamin Walsh
194f45cc66 arm: fix early boot on Cortex-M0 with init stack
The assembler was passed immediate values that are too large for the
limited Cortex-M0 thumb assembly. Load values in registers instead of
using immediate values.

Change-Id: Ib5541c92dea03e0efb1b88ab91eeb408d151a71b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-24 01:45:00 +00:00
Vincenzo Frascino
9f04723439 arm: Enable REBOOT when RUNTIME_NMI is selected
This patch enables REBOOT when RUNTIME_NMI is selected via defconfig
file. This action is required to prevent compilation errors.

Change-Id: I67c18b2860ac34ba8f96e780737b4857a6063ece
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-23 20:13:51 -05:00
Vinayak Chettimada
3bc143962c arm: make _timer_int_handler optional
If CORTEX_M_SYSTICK is not selected, do not reference
_timer_int_handler. SoC will need to define a custom system
clock implementation.

Change-Id: I655f3abf66953e434fef69ed16db2d9c2dcc486e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-23 20:13:31 -05:00
Inaky Perez-Gonzalez
11a52750d3 libc: remove useless code in _prf()
Coverity reported a block of deadcode in _prf() that seems to be a
leftover carcass from a previous time. Replaced with a comment in case
someone decides it was needed back.

Change-Id: Id97e84f3279f807e6188371f27f6af157e6d5038
Coverity-ID: 131631
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-11-23 00:57:48 +00:00
Vincenzo Frascino
4d8c021820 arm: Fix CONFIG_RUNTIME_NMI behavior
Zephyr kernel is unable to compile when CONFIG_RUNTIME_NMI is enabled in
defconfig on ARM's architectures.

This patch addresses the following issues:
* In nmi.c _DefaultHandler() is referencing a function
(_ScbSystemReset()) not defined in Zephyr. This has now been replaced
with sys_arch_reboot.
* nmi.h is included in ASM files and due to the usage of "extern" the
compilation ends with an error. Added the directive _ASMLANGUAGE to
prevent the problem.

Jira: ZEP-1319
Change-Id: I7623ca97523cde04e4c6db40dc332d93ca801928
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-23 00:27:56 +00:00
Benjamin Walsh
04c542d9d0 kernel/mbox: add missing dummy thread timeout init
It was possible for a dummy thread to be not timing, but not having
timeout.delta_ticks_from_prev not be -1 at the same time, which is a big
no-no.

Use _init_thread_base() to do a full initialization of the dummy thread.

Fixes ZEP-1312.

Change-Id: I16a2373be3329c142cf26f5dca6bfdbe6014ac5e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:27:43 +00:00
Benjamin Walsh
069fd3624e kernel: streamline initialization of _thread_base and timeouts
Move _thread_base initialization to _init_thread_base(), remove mention
of "nano" in timeouts init and move timeout init to _init_thread_base().
Initialize all base fields via the _init_thread_base in semaphore groups
code.

Change-Id: I05b70b06261f4776bda6d67f358190428d4a954a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:27:42 +00:00
Benjamin Walsh
50eb51a745 arc: support interrupt/FIRQ stacks with CONFIG_INIT_STACKS
Use the main stack during very early boot so that we can call memset on
the interrupt and FIRQ stacks. Iniitalize the them before one of them is
used for the rest of the pre-kernel initialization.

Change-Id: Ib57856a66273dda9382e08fa91da5a54847b77c2
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:24:01 +00:00
Benjamin Walsh
0c9268784e arm: support interrupt stack with CONFIG_INIT_STACKS
Use the main stack during very early boot so that we can call memset on
the interrupt stack. Initialize the interrupt stack before it is used
for the rest of the pre-kernel initialization.

Change-Id: I6fcc9a08678afdb82e83465cda1c7a2a8c849c9b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:24:01 +00:00
Vinayak Chettimada
09ba96d856 kernel: declare main and idle stack as globals
Renamed main_stack and idle_stack, to _main_stack and
_idle_stack, respectively, and made them globals. This does
not affect performance. They are still kept kernel private
symbols and not part of kernel API.

This will allow these symbols to be referenced in calls to
stack_analyse misc functions to profile stack usage in
applications.

Change-id: Id6b746c5cfda617c26901c6e62c3e17114471f57
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-11-23 00:24:00 +00:00
Benjamin Walsh
83e6df26f9 arc: use one of the interrupt stacks during early init
Same issue as with ARM. ARC can use _Swap() though, because the call to
it is serial, not generating a low-priority exception and interrupts are
locked until the main() thread is context-switched into and the
interrupt stack is released.

Fixes ZEP-1310.

Change-Id: Ie1f27f7ad0502191ca2867b5400d6e0bfb7f0fc6
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:23:59 +00:00
Benjamin Walsh
7f4c294e5c arm: use interrupt stack during early init
The ARM Cortex-M early boot was using a custom stack at the end of the
SRAM instead of the interrupt stack. This works as long as no static
data that needs a known initial value occupies that stack space. This
has probably not been an issue because the .noinit section is at the
very end of the image, but it was still wrong to use that region of
memory for that initial stack.

To be able to use the interrupt stack during early boot, the stack has
to be released before an interrupt can happen. Since ARM Cortex-M uses
PendSV as a very low priority exception for context switching, if a
device driver installs and enables an interrupt during the PRE_KERNEL
initialization points, an interrupt could take precedence over PendSV
while the initial dummy thread has not yet been context switched of and
thus released the interrupt stack. To address this, rather than using
_Swap() and thus triggering PendSV, the initialization logic switches to
the main stack and branches to _main() directly instead.

Fixes ZEP-1309

Change-Id: If0b62cc66470b45b601e63826b5b3306e6a25ae9
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:23:59 +00:00
Benjamin Walsh
296a234ddb kernel: add support for switching to main thread without _Swap()
It's possible that an architecture needs a custom way of switching to
the main() task, rather than using _Swap() with a dummy thread.

Change-Id: I14e9bc67be35174ff16209bcea27b18a069ff754
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:23:58 +00:00
Benjamin Walsh
8fcc7f69da kernel/arch: remove unused uk_task_ptr parameter from _new_thread()
Artifact from microkernel, for handling multiple pending tasks on
nanokernel objects.

Change-Id: I3c2959ea2b87f568736384e6534ce8e275f1098f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-23 00:23:57 +00:00
Ramesh Thomas
eec187e11e tests: power_mgmt: Fix wrong value being passed to post_ops func
The app passes the index into an array storing power states
instead of the power state to _sys_soc_power_state_post_ops

Jira: ZEP-1341
Change-Id: I6ddf0a2dbadfd06aafbcafa88be7441e99694a51
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-23 00:21:52 +00:00