Commit graph

187 commits

Author SHA1 Message Date
Anas Nashif 1092a25978 kconfig: move GDB_INFO kconfig to subsys/debug
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-27 22:15:30 -05:00
Anas Nashif 1f1143ac87 build: use kconfig to select generated artifacts
Not all boards require the various binary formats zephyr generates. So
be selective based on the arch, SoC or board and only geenrate the
binaries actually needed.

Fixes #5009

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-11-23 07:29:13 -05:00
Johan Hedberg 7d71c0656f printk: Add padding support to string format specifiers
The numeric format specifiers already have this support, but strings
didn't. This makes it possible to add padding after strings, using
format specifiers such as %-10s.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 21:32:20 +02:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Gustavo Lima Chaves c94760045f build: make kernel entry symbol a config option
This might change for different ports, so make it configurable.

Signed-off-by: Gustavo Lima Chaves <gustavo.lima.chaves@intel.com>
2017-11-07 08:58:49 -05:00
Leandro Pereira 6f99bdb02a kernel: Provide only one _SYSCALL_HANDLER() macro
Use some preprocessor trickery to automatically deduce the amount of
arguments for the various _SYSCALL_HANDLERn() macros.  Makes the grunt
work of converting a bunch of kernel APIs to system calls slightly
easier.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-16 13:42:15 -04:00
Andrew Boie ef2b138130 printk: only do buffering in user mode
This has extra stack overhead, no need to impose this on the caller
unless it's needed to avoid doing a system call for every
character.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-13 12:56:14 -07:00
Andrew Boie 225e4c0e76 kernel: greatly simplify syscall handlers
We now have macros which should significantly reduce the amount of
boilerplate involved with defining system call handlers.

- Macros which define the proper prototype based on number of arguments
- "SIMPLE" variants which create handlers that don't need anything
  other than object verification

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-12 16:26:28 -05:00
Andrew Boie 756f907274 misc: userspace support for printk()
To avoid making a system call for every character emitted, there is now
a small line buffer if userspace is enabled. The interface to the kernel
is a new system call which takes a sized buffer of console data.

If userspace is not enabled this works like before.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-11 09:23:57 -07:00
Anas Nashif da7cc84655 subsystem: cleanup misc and make cpp a subsystem
Move a way from misc/ and put in its own subsystem to allow enhancements
in the future and make it a core part of Zephyr, not just something
misc.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-06 09:13:46 -05:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
Adithya Baglody be1cb961ad tests: benchmark: boot_time: Reading time stamps made arch agnostic
1. Changed _tsc_read() to k_cycles_get_32(). Thus reading the
time stamp will be agnostic of the architecutre used.
2. Changed the variable names from *_tsc to *_time_stamp.

JIRA: ZEP-1426

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
2017-06-16 07:37:37 -05:00
Andy Gross 84628e8b53 kconfig: misc: Conditionally remove FLASH_LOAD options
This patch adds a condition on the FLASH_LOAD_OFFSET and FLASH_LOAD_SIZE
to make them conditionally excluded if HAS_DTS is enabled.  FLASH
partition information must be defined for all DTS platforms which
utilize flash.

For DTS enabled platforms, CONFIG_FLASH_LOAD_OFFSET and
CONFIG_FLASH_LOAD_SIZE will be generated from the flash information
defined in the DTS file.  The values used for these variables will be
determined by the zephyr,code-partition chosen node.  If no chosen
node is specified, the zephyr,flash chosen node will be used.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-06-08 07:37:44 -05:00
Andrew Boie 5963904e4c printk: fix printing of long long types
64-bit types were not being handled properly and depending on the
calling convention could result in garbage values being printed.

We still truncate these to 32-bit values, the predominant use-case
is printing timestamp delta values which generally fit in a 32-bit
value. However we are no longer printing random stuff.

Test case for printk() updated appripriately to catch this regression.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-30 19:42:22 -04:00
Maciek Borzecki fed96bf1bc misc: _char_out can be a static symbol
Fixes sparse warning:
<snip>/zephyr/zephyr/misc/printk.c:50:5: warning: symbol '_char_out' was not declared. Should it be static?

Change-Id: I5af0860e9f8f827002ae9a142b5924d3de8d51b6
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2017-05-18 12:41:56 -05:00
David B. Kinder f930480e16 doc: misspellings in Kconfig files
fix misspelling in Kconfig files that would show up in configuration
documentation and screens.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-05-05 19:38:53 -04:00
Leandro Pereira 86b0260e97 kconfig: Move debugging-related options from misc/ to subsys/debug/
This should fix the grouping for debugging options appearing in the
main "menuconfig" menu.

Change-Id: I7ddf3a6f3d025bf82ba63099b30e47a40d7c3187
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-28 23:41:16 +00:00
Marti Bolivar dc91536855 printk: add vprintk()
This is needed by application code that wants to print formatted
strings, but only has a fmt and va_list, and lacks memory to spare for
"buf" and something like:

	 vsnprintk(buf, sizeof(buf), fmt, ap);
	 printk("%s", buf);

Change-Id: Ic9cc915ec7e5f8f9492c730667f39788ecae65f6
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-22 14:29:33 +00:00
David B. Kinder 61de8f892b spell: Kconfig help typos: /kernel /misc /subsys
Fix misspellings in Kconfig help text

Change-Id: I6eda081c7b6f38287ace8c0a741e65df92d6817b
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-22 01:04:56 +00:00
Leandro Pereira 99a7168b08 misc: Support left-justification in printk()
This is supported by printf(), and is an important formatting feature
to print out some complex, nicely-formatted information.  This is
accomplished by using a negative padding in the formatting string.

The following code:

      printk("none:         |%u| |%x|\n", 12345, 12345);
      printk("zero_before:  |%08u| |%08x|\n", 12345, 12345);
      printk("space_before: |%8u| |%8x|\n", 12345, 12345);
      printk("space_after:  |%-8u| |%-8x|\n", 12345, 12345);

Will produce the following output:

      none:         |12345| |3039|
      zero_before:  |00012345| |0000000000003039|
      space_before: |   12345| |            3039|
      space_after:  |12345   | |3039            |

Change-Id: I9c2d85a1790087d53b52b7713854adaf99282f09
Jira: ZEP-1599
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-04-21 11:06:16 +00:00
Kumar Gala bf50c245ec misc: convert to using newly introduced integer sized types
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: Ia38862a5d408f4b4512cd2840ee46e686ae342e3
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 11:56:00 -05:00
Anas Nashif 45a7e5d076 kernel: remove legacy.h and MDEF support
Change-Id: I953797f6965354c5b599f4ad91d63901401d2632
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-04-19 10:59:35 -05:00
David Brown fe7aa3f4fa misc: Allow flash image size to be constrained
The CONFIG_FLASH_LOAD_OFFSET allows the zephyr image to be placed at
an offset from the start of flash.  This is useful for situations,
such as with a bootloader, to allow the image to not occupy the very
beginning of flash.

Complement this by adding a CONFIG_FLASH_LOAD_SIZE config, that can
constrain the size of the flash image.  With the default of zero, the
behavior is as before, with the image allowed to occupy the rest of
the flash.  It can also be defined to a non-zero value which will
constrain the image to occupy that many bytes of flash.

Although this is defined generally, it is currently only supported on
cortex-m targets.

Change-Id: I6e4a0e79c8459f931cd4757c932d20dac740f5f6
Signed-off-by: David Brown <david.brown@linaro.org>
2017-04-14 01:35:59 +00:00
David Brown 0c476a58b7 misc: Generalize LOAD_OFFSET support
Instead of FLASH_LOAD_OFFSET being something specific to cortex-m, add
it generally to misc/Kconfig, along with a hidden config
HAS_LOAD_OFFSET which can be selected by the architectures as they add
support for the functionality.

Change-Id: I256ff8cf4e9b8493b26354c3b93fe1f7017d4887
Signed-off-by: David Brown <david.brown@linaro.org>
2017-04-14 01:35:59 +00:00
Daniel Thompson f9733e492d misc: Let the compiler choose whether to omit frame pointer
Currently CONFIG_OMIT_FRAME_POINTER is a boolean and defaults to N,
which increases code size. This is intended to improve debugability
but on many architectures the use of this option does not actually
compromise debugging. Further the compiler already knows whether or not
omitting the frame pointer is harmful to debugging and its defaults
are selected accordingly.

By making this choice optional we can have a sane default on *all*
architectures by letting the compiler decide for us.

This patch significantly improves the default code generation on
arm (thumb), nios2 and arc. The benefit looks to be about between 5%
and 10% code size reduction depending upon architecture). x86 is
unaffected.

Change-Id: I5790634a40e2462cc1089dce4087040833793ae7
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2017-02-08 13:14:16 +00:00
Tomasz Bursztyka a7e82666bc misc/printk: Add a function to get the current hook function.
This can be necessary at run-time if a switch of one console to
another has to be made, with the possibility to reinstall the former
hook at some point.

Change-Id: I60efc74b1c94953bdc2585b99cc4816c46715372
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-01-27 12:35:52 +02:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Anas Nashif c1347b4730 kernel: replace all remaining nanokernel occurances
replace include <nanokernel.h> with <kernel.h> everywhere and also fix
any remaining mentions of nanokernel.

Keep the legacy samples/tests as is.

Change-Id: Iac48447bd191e83f21a719c69dc26233216d08dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 14:34:43 -05:00
Anas Nashif 2f203c2f92 tracing: rename CONFIG_DEBUG_TRACING_KERNEL_OBJECTS
Use a short name for this option CONFIG_OBJECT_TRACING.

Change-Id: Id27de7ef9ca299492b6b7d2324d9f5bcf8059a31
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 14:59:35 -05:00
Anas Nashif c7f73140f6 kconfig: group options into menus
Change-Id: I24cbf7e244d74e1a2736f18d7da170d68ee47971
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 14:59:35 -05:00
Anas Nashif 569f0b4105 debug: move debug features from misc to subsys/debug
Change-Id: I446be0202325cf3cead7ce3024ca2047e3f7660d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:40 +00:00
Anas Nashif a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Anas Nashif f323c00daf kconfig: remove unused TASK_DEBUG options
Change-Id: I19731bd0148aed6916844f7abf6eacc7fe4e5e2c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:38 +00:00
Anas Nashif fe958df4dd libc: rework libc selection and reduce Kconfigs
Moved all libc Kconfigs to where the code is and remove the default
Kconfig for selecting the minimal libc. Minimal libc is now the default
if nothing else is configured in.

Removed the options for extended libc, this obviously was restricting
features in the minimal libc without a good reason, most of the
functions are available directly when using newlib, so there is no
reason why we need to restrict those in minimal libc.

Jira: ZEP-1440
Change-Id: If0a3adf4314e2ebdf0e139dee3eb4f47ce07aa89
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 22:31:28 +00:00
Benjamin Walsh c3a2bbba16 kernel: add k_cpu_idle/k_cpu_atomic_idle()
nano_cpu_idle/nano_cpu_atomic_idle were not ported to the unified
kernel, and only the old APIs were available. There was no real impact
since, in the unified kernel, only the idle thread should really be
doing power management. However, with a single-threaded kernel, these
functions can be useful again.

The kernel internals now make use of these APIs instead of the legacy
ones.

Change-Id: Ie8a6396ba378d3ddda27b8dd32fa4711bf53eb36
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 16:17:38 -05:00
Johan Hedberg 244a4dfe73 printk: Export _vprintk similar to how _prf is exported
There are some corner cases where direct access to the formatter
function is needed. Export _vprintk() so code can use it in a similar
way that _prf() can be directly used.

Change-Id: I9dfb68f87f310e900c662dc8beb320bb4ff7d8b2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-11 04:26:05 +00:00
Johan Hedberg d2d62ae484 logging: Remove bogus SYS_LOG dependency on STDOUT_CONSOLE
Since the SYS_LOG macros don't use printf anymore STDOUT_CONSOLE is no
longer a dependency for them.

Change-Id: Ia488759c9103dcd70cec30c8fb0bb7023ca7ca3a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-10 12:38:16 +00:00
Johan Hedberg c899cd0d12 printk: Add APIs to print into strings instead of default output
These correspond to the libc snprintf and vsnprintf APIs.

Change-Id: If3944972ed95934a4967756593bb2932c3359b72
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-05 20:08:40 +00:00
Johan Hedberg 3ab60466de printk: Refactor to allow passing a parsing context around
Pass a parsing context around, allowing counting the number of
characters written, which is then returned in the return value of
printk(). This makes printk more similar to printf and prepares the
way to extend the implementation to support printing to strings.

Change-Id: Ib28a18a4f36fc58b98b228fd5763b2c05f5af7bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-05 20:08:39 +00:00
Andrew Boie 82f11bf099 build: x86: add some flexibility in custom linker scripts
If a particular project needs to add additional data to the
binary image, in most cases the entire linker script needs to
forked into the project space, causing maintenance issues if
the main linker script is changed.

Now we add some Kconfig options to allow a project to specify
some additional linker scripts which get included by the main
one in a few key areas:

1) In the definition to the 'rodata' section, which can allow
additional data to be included in this ROM section.

2) In the definition to the 'datas' section, which allows
additional data to be included in this RAM section.

3) Arbitrary additional sections to be included at the end of
the binary.

For 1 and 2, this is useful to include data generated outside of
the normal C compilation, such as data structures that are created
by special build tools.

3 is useful for including arbitrary binary blobs inside the final
image, such as for peripheral or co-processor firmware.

Change-Id: I5738d3d6da25f5bc96cda8ae806bf1a3fb34bd5d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-30 22:47:02 +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
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
Benjamin Walsh f6ca7de09c kernel/arch: consolidate tTCS and TNANO definitions
There was a lot of duplication between architectures for the definition
of threads and the "nanokernel" guts. These have been consolidated.

Now, a common file kernel/unified/include/kernel_structs.h holds the
common definitions. Architectures provide two files to complement it:
kernel_arch_data.h and kernel_arch_func.h. The first one contains at
least the struct _thread_arch and struct _kernel_arch data structures,
as well as the struct _callee_saved and struct _caller_saved register
layouts. The second file contains anything that needs what is provided
by the common stuff in kernel_structs.h. Those two files are only meant
to be included in kernel_structs.h in very specific locations.

The thread data structure has been separated into three major parts:
common struct _thread_base and struct k_thread, and arch-specific struct
_thread_arch. The first and third ones are included in the second.

The struct s_NANO data structure has been split into two: common struct
_kernel and arch-specific struct _kernel_arch. The latter is included in
the former.

Offsets files have also changed: nano_offsets.h has been renamed
kernel_offsets.h and is still included by the arch-specific offsets.c.
Also, since the thread and kernel data structures are now made of
sub-structures, offsets have to be added to make up the full offset.
Some of these additions have been consolidated in shorter symbols,
available from kernel/unified/include/offsets_short.h, which includes an
arch-specific offsets_arch_short.h. Most of the code include
offsets_short.h now instead of offsets.h.

Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-11-12 07:04:52 -05:00
Ramesh Thomas a3dc53f2a6 power_mgmt: Do not notify deep sleep if bootloader does context restore
Some bootloaders have power management support to restoer context
upon resume from deep sleep. In such cases, the OS startup code
should call the notification hook. Create Kconfig flags to configure
this option.

Jira: 1257
Change-Id: I9f40c5fa077c2f17dc8e9f11604c3ed17e549ed5
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-11-11 20:40:53 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.

New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.

Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.

Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-09 17:59:44 +00:00
Juro Bystricky f3bf5abd52 newlib: add support for nano-formatted-io
If newlib is configured with --enable-newlib-nano-formatted-io,
floating-point support is split out of the formatted I/O code into
weak functions which are not linked by default. This leads to a smaller
code by about 16~20k when using newlib "printf" and/or "sscanf" but not
using floating point I/O.

Programs that need floating-point I/O support must explicitly request
linking of one or both of the floating-point functions:

    _printf_float or _scanf_float.

This can be done at link time using the -u option which can be passed
to either gcc or ld.

Implemented via new configuration options:
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF
    CONFIG_NEWLIB_LIBC_FLOAT_SCANF

Change-Id: I57f9d9f02e6d21d6011d14de7153b1d3ba6f6e32
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2016-11-09 02:47:43 +00:00
Andrew Boie 625acd5f4b build: remove old kernel support
Change-Id: If1d29573a0ad4a863f0058c8b8e2c35f5ced6d9e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-11-07 11:34:18 -08:00
Anas Nashif 559b46f37d shell: move shell Kconfig to drivers/console/shells
Cleanup some unneeded ifdefs in C files.

Change-Id: Icd1f34f2d24b531ad5320e3436cce048d236a4f0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 13:48:15 +00:00
Yael Avramovich d5db35204a console: shell: Support multiple modules
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>
2016-11-02 00:23:18 +00:00
Marcus Shawcroft 1bc999cb8d drivers/uart: Refactor UART input hook.
This refactor is in preparation for making driver API structures
const.

The console driver provides a mechanism to install an input and an
output hook function.  These are primarily used by the onboard
gdb-server.  The output hook is entirely implemented within the
console driver.

The input hook is partially implemented in the top of the uart driver
and within the console driver.  The hook function itself is installed
in the uart API structure, but is invoked only by the console driver.

Installing the hook function directly into the uart API structure
prevents the API structure being const.  There are two approaches to
fixing this:

1) Implement setting of the input hook in the same way as
uart_irq_callback_set().

2) Move the input hook entirely to the console driver.

We implement the latter.  This approach has two benefits, first it
removes the need for every uart driver to implement the behaviour and
second, the current placement of the callback function in the uart API
seems odd given that the callback is only invoked by the console
driver, never by a uart driver.

Change-Id: I258b312d3055df1c2bdeb896bd4f4f39c40838f7
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-25 11:31:08 +00:00
Allan Stephens b9a4bd906c kernel: Relocate ring buffer suppport to 'misc' directory
Moves the source code for ring buffers to the 'misc' area, since
it isn't really a central component of the kernel. (This also
aligns the ring buffer source code with its include file, which
is already under 'include/misc'.)

Change-Id: I765a383a05f51fa67d154446f412496e689f9702
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-10-21 15:33:31 +00:00
Anas Nashif ecf96d2cfa arduino 101: make factory bootloader config the default
The Arduino 101 comes with a bootloader that supports DFU
and flashing of all cores using the dfu-util package.

This changes the memory layout of the image built for the
Arduino 101 and remove previous work-arounds to allow booting,
including the version-header section in the linker script.

The bootloader expects the text section at +0x30 from the physical
load address and thus requires special treatment in the linker
script.

Other changes by Andrew Boie:
The flash size parameters were both wrong. X86 side has 192K
of flash from 0x4003000 - 0x40060000, the entire span of
sys_flash1.

ARC side is now the span from 0x40010000 - 0x40030000, 128K.

Change-Id: Iecfa5d2b84a3f522d9eca06268d6b8b71a094aaa
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-17 11:13:59 +00:00
Benjamin Walsh 7e6dacd65f unified/build: allow building the unified kernel
Added needed kconfig options. KERNEL_V2 selects MICROKERNEL to allow
middleware and application that differentiate between NANOKERNEL and
MICROKERNEL to run unmodified.

Build the unified/ kernel directory: do not touch the
nanokernel/microkernel directories.

Invoke sysgen for both microkernel and unified kernel. Only have sysgen
reference include/microkernel if building an original microkernel.

Change-Id: If74779146143434f7ee274bbef32d6c894b9f1a1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-09-13 17:12:55 -04:00
Andrew Boie a811cc5085 printk: make _char_out globally accessible
This is to support a printf test case where we need to know
the existing value so we can chain it.

Change-Id: I671429aa7dab1391840f49f54cc6c23baccf265c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 4c64805336 printk: print leading '0x' for %p
Change-Id: I0140d1721ecaef47245e0fab61300c1dd44b9aff
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Andrew Boie 907a99933a printk: "support" some modifier codes
We now allow modifier codes h, l, and z, although at the
moment they are simply dropped. This is to allow us to warn on
incorrect printk() usage by the compiler. These arguments get
promoted to int when they are passed as arguments so this
may never need to be addressed, although there may be implications
for (future) support for systems with 16-bit integers.
We still don't print 64-bit integers properly. but this is
nothing new.

Change-Id: I112d1257c4ec70c3fa7ae65dc56a6076ff29a8c0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
David B. Kinder d748577706 doc: Fix terminology in Kconfig files for 'platform'
Completing the terminology change started with change 4008
by updating the Kconfig files processed to produce the
online documentation, plus header files processed by
doxygen.  References to 'platform' are change to 'board'

Change-Id: Id0ed3dc1439a0ea0a4bd19d4904889cf79bec33e
Jira: ZEP-534
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2016-08-18 21:17:29 +00:00
Andrew Boie 17c0b372a2 x86: improve exception APIs
Previously, exception stubs had to be declared in assembly
language files. Now we have two new APIs to regsiter exception
handlers at C toplevel:

 _EXCEPTION_CONNECT_CODE(handler, vector)
 _EXCEPTION_CONNECT_NOCODE(handler, vector)

For x86 exceptions that do and do not push error codes onto
the stack respectively.

In addition, it's now no longer necessary to #define around
exception registration. We now use .gnu.linkonce magic such that
the first _EXCEPTION_CONNECT_*() that the linker finds is used
for the specified vector. Applications are free to install their
own exception handlers which will take precedence over default
handlers such as installed by arch/x86/core/fatal.c

Some Makefiles have been adjusted so that the default exception
handlers in arch/x86/core/fatal.c are linked last. The code has
been tested that the right order of precedence is taken for
exceptions overridden in the floating point, gdb debug, or
application code. The asm SYS_NANO_CPU_EXC_CONNECT API has been
removed; it was ill- conceived as it only worked for exceptions
that didn't push error codes. All the asm NANO_CPU_EXC_CONNECT_*
APIs are gone as well in favor of the new _EXCEPTION_CONNNECT_*()
APIs.

CONFIG_EXCEPTION_DEBUG no longer needs to be disabled for test
cases that define their own exception handlers.

Issue: ZEP-203
Change-Id: I782e0143fba832d18cdf4daaa7e47820595fe041
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-28 18:13:24 +00:00
Inaky Perez-Gonzalez 9b3b36bd7a gdb-server: update call to uart_register_input()
uart_register_input()'s signature changed with the addition of a
callback. gdb_server.c was never updated so now the compilation fails
when enabling the GDB server.

Fix by setting a NULL completion (as seems the code would not use it
anyway).

Change-Id: I4c0df65a31bd906db704f7f4a564e7d6f065aae7
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-22 17:40:01 +00:00
Inaky Perez-Gonzalez b4bbc71369 gdb_server: fix semicolon that depends on #define
supported_features_cmd is a string which part of is added based on a

However, the semicolon to do so was being only included if the #define
was there; if not it was generating a syntax error. Place it out of
the #ifdef block.

Change-Id: Idd7e80519719b5ad432971e758a05546df8a89e2
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-22 17:39:43 +00:00
Andrew Boie 63cea24896 misc: add config to omit frame pointer
Change-Id: Ia69c14addded7563a24f15d4a3408fcc2c8e673a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-16 18:15:59 +00:00
Kumar Gala 9ec2f3be80 Cleanup whitespace in Kconfig files
Convert leading whitespace into tabs in Kconfig files.  Also replaced
double spaces between config and <prompt>.

Change-Id: I341c718ecf4143529b477c239bbde88e18f37062
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-05-25 13:28:07 -05:00
Benjamin Walsh 0107c80c29 misc: clean up __ASSERT warnings during build
By default, instead of spamming the build output with one warning per
file where __assert.h is included when CONFIG_ASSERT=y, only display a
warning at the end of the build.

Also limit the range of CONFIG_ASSERT_LEVEL between 0 and 2.

Change-Id: I95ffd1bcec9535de1afabc047814e5c6f5b9c2c1
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-05-18 22:06:54 +00:00
Anas Nashif 0b2c44a771 tinycrypt: move from lib to regular objects
tinycrypt was built using the lib- scripts without any real benefit. We
also had a wrong placement of the Kconfig files under misc/ and a Kconfig
file for Crypto that was never used before.

Change-Id: I82d5902d92e7c06e10a95f418d9ead3cbcabcce4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-16 19:43:50 +00:00
Anas Nashif 909dd7ee05 arduino_101: support booting with original bootloader
To boot zephyr on the Arduino 101 running the original bootloader
which supports DFU, set the following in your application configuration
file:

CONFIG_SS_RESET_VECTOR=0x40034000
CONFIG_PHYS_LOAD_ADDR=0x40010000
CONFIG_VERSION_HEADER=y

Jira: ZEP-219
Change-Id: Ia015a7b6fce888b49ed22c558de992132d4713ea
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-30 13:56:54 -04:00
Benjamin Walsh 43592b1127 x86/debug: GDB server needs to handle some exceptions
GDB server needs ownership of some exceptions to display information when
taking a fatal exception (DIVIDE_ERROR, PAGE_FAULT).

Introduce a Kconfig option that can work for any debugger.

Change-Id: I39aef22a820543a7fe9ac333b487592946abc0f3
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:22 +00:00
Benjamin Walsh f703f7d0f6 debug: add target GDB server
The GDB server implements a set of GDB commands, such as read/write
memory, read/write registers, connect/detach, breakpoints, single-step,
continue. It is not OS-aware, and thus provides a 'system-level'
debugging environment, where the system stops when debugging (such as
handling a breakpoint or single-stepping).

It currently only works over a serial line, taking over the
uart_console. If target code prints over the console, the GDB server
intecepts them and does not send the characters directly over the serial
line, but rather wraps them in a packet handled by the GDB client.

Change-Id: Ic4b82e81b5a575831c01af7b476767234fbf74f7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:22 +00:00
Benjamin Walsh 270d602efd debug/x86: add runtime info needed by target debuggers
Introduce an x86 interrupt stack frame that contains more information
than the non-debug one, namely the caller-saved GPRs, as well as an API
to retrieve it. Able to handle nested interrupts stack frames.

Change-Id: If182aaa2f34e4714b16ca65ff79da63b72d962f7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:22 +00:00
Benjamin Walsh 45d9689dc8 debug: add missing MEM_SAFE dependency
Change-Id: Ia13b84d1bacfcc9ff7e429be41db31e5e63ae282
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:21 +00:00
Benjamin Walsh 6ec02cc807 debug: fit Kconfig lines in 80 columns
Change-Id: I2df06d14cf0c219006adf7609542498b78ce342e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:21 +00:00
Genaro Saucedo Tejada 34d497118a sys_log: Adds the common log API header
The header sys_log.h concentrates logging macro definitions so it can be
reused by all code, change aims create an API to replace replace
currently duplicated logging macro definitions. Later enhancements to
log can now be performed in a single file. Features:

* Optional printing of colored messages
* Incremental log levels per-module
* Optional printing of logging level label (info, error, warning, debug)
* Caller function name printing
* One point log disable
* Global override log level
* Print function detection (printf or printk)

JIRA item ZEP-111 refers to this change.

Origin: Original
Change-Id: I34492b0148b4e9d0094f69c511b96f4fd640ef44
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-03-18 00:01:21 +00:00
Anas Nashif 84a5557eb3 kconfig: move ARM bootloader options to bootloader menu
Change-Id: Ia3612413f68691d9e9364f278aada6b9c3296fb5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-03-14 16:50:50 -04:00
Jithu Joseph 4ad7f2a5a3 libc-hooks: newlib's heap may use entire unused RAM
Use linker symbol and board configs to determine the start
and extent of remaining RAM present in a board and use
it as newlib's heap.

Change-Id: I7128cf2857664331d83f212f27e8af7ad3bb8936
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2016-02-27 09:57:19 +00:00
Iván Briano 428d51b5db libc-hooks: Make newlib's heap size configurable
While we don't have a proper heap that can make use of all the
available RAM, make it possible for applications using Newlib to
configure the size of the heap exposed via the sbrk() hook.

Change-Id: I4e3193c1f2df0ace1dbc5b1f6ceb2cdc61479762
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-02-20 14:57:53 +00:00
Benjamin Walsh a4ec963138 init: use SYS_INIT() where it makes sense
Mostly SoC initialization and some kernel subsystems, but also some
device drivers like the interrupt controllers.

Change-Id: I8dc1844c33acd877c075b6b03558fdca6f87500b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh d340d4cb3f device: use DEVICE_INIT everwhere
This is the last step before obsoleting DEVICE_DEFINE() and
DEVICE_INIT_CONFIG_DEFINE().

Change-Id: Ica4257662969048083ab9839872b4b437b8b351b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 0303d8cab9 device: rename SYS_DEFINE_DEVICE()
Rename it to DEVICE_DEFINE() so that it fits in the 'device' namespace.

Change-Id: I3af3a39cf9154359b31d22729d0db9f710cd202b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh bfc27206b2 device: rename DECLARE_DEVICE_INIT_CONFIG()
Rename it to DEVICE_INIT_CONFIG_DEFINE(), because (a) it was not fitting
in any namespace and (b) it is not used to declare, but rather define a
object.

Change-Id: I1da5822f06b85a9fb024b5b184afd0ccc01012ec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:25 -05:00
Benjamin Walsh 2e27adb569 mem_safe: prevent writing to .text in XIP systems
The sys_mem_safe_write_to_text_section() now always fails in XIP
systems, since their .text section is in ROM.

Change-Id: Ie47a5dbf5f75a4bfe8e9fc9852d0037a3546aae8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:25:24 -05:00
Peter Mitsis 8e35cc8eb4 build: Add C++ support
Adds C++ support to the build system.

Change-Id: Ice1e57a13598e7a48b0bf3298fc318f4ce012ee6
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:23 -05:00
Anas Nashif 6fa8588145 kconfig: add mising option TASK_DEBUG
The option is used in the code but was never declared.

Change-Id: I17552c225936652e9208f53a884311eb81cb79a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:13 -05:00
Anas Nashif 9fe306bc2a Generate stack usage information only when enabled
This will only generate the .su files when CONFIG_STACK_USAGE
is specified, otherwise the tree will be full of .su files.

Change-Id: I3ffc7a7f5ab09aaae49ff65e8ad5de0832370777
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif 94b29b562b kconfig: put bootloader and reboot options in a menu
Some options appear in the top level menuconfig, group them
and put put them in a menu.

Change-Id: Ib0285176e7f0ed7ec9ff54dd80c0f02ec4817f2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Dmitriy Korovkin 57f2741e4f init: Implement fine-grained initialization policy
Put initialization priorities as device driver Kconfig
parameter.

Initialization priority value for each platform is defined
in the platform Kconfig file.

Drivers and platform code use SYS_DEFINE_DEVICE to add
and initialization function.

Change-Id: I2f4f3c7370dac02408a1b50a0a1bade8b427a282
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:54 -05:00
Anas Nashif 77ba3c3b8b kconfig: define architecture as a kconfig variable
Do not depend on environment variables and use a kconfig variable
for defining the architecture.

In addition, remove the X86_32 variable, it just duplicates X86 for
not good reason, at least until start supporting MCUs with 64bit.

Change-Id: Ia001db81ed007e6a43f34506fed9be1345b88a4b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:52 -05:00
Benjamin Walsh 826edfc16b reboot: add reboot infrastructure
Add the REBOOT kconfig option, along with the sys_reboot() API.

This infrastructure is not enough to actually perform a reboot.
Architecture/platform code must be provided as well, in the form of a
sys_arch_reboot() function.

Change-Id: I5b2b15855ff06453f2764f3e3b3b7d6a4a078723
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh 760f191b1e debug: add safe memory access routines
Introduces the following routines to provide safe access to memory:
   _mem_probe()
   _mem_safe_read()
   _mem_safe_write()
   _mem_safe_write_to_text_section()
Those routines will return an error if the memory is not accessible rather
than potentially crash.

This implementation is based on the image's boundaries; thus it allows
read/write access to the data/bss/init sections and read access only to
the text/rodata sections.  All other memory is considered invalid, even
if addressable. This includes the leftover from the RAM at the end of
the image, since there is no support for using it (e.g. there is no
dynamic allocator).

Change-Id: I6093688ecfd9b00d61be0fd453ada7bb8915c897
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:42 -05:00
Allan Stephens 1e03a8efc9 printk: Standardize support for %%
Tweaks printk() internals to avoid unnecessary special case handling
of %% formatting.

Change-Id: I816b04b458f416a45fd06b5a7b3bebf27453c722
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:36 -05:00
Allan Stephens a1d47ba539 printk: Add support for %c
printk() now supports format strings containing %c.

Change-Id: I3de290db59cb1ae5a65a928842e7a74bbf8ecce8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:36 -05:00
Yonattan Louise 815513a11d OS Awareness: Add debug object trace configuration.
Add the Kconfig option for enabling the debug object tracing.

Change-Id: I56bf48568905604f6f50a06db2c5eaf4d91ded1d
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:32 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Anas Nashif 1dc809b23b kconfig: use zephyr as the binary name globally
do not use microkernel or nanokernel as the output binaries,
instead, use zephyr globally.

Also change the documentation to reflect this.

Change-Id: I8405761d1a0392c90cdfeec5c67d72eb4e5a76ff
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:22 -05:00
Anas Nashif ee743c7d42 build: allow usage of a custom linker script
This change will allow the use of a custom linker script by
setting the config variable CUSTOM_LINKER_SCRIPT to a path outside
of Zephyr tree.

This is useful when an application needs to add sections into the
linker script and avoid having to change the script provided by
Zephyr.

Change-Id: Ibe31abcc8c0227e734f59bc26d3c8d5619951b29
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:22 -05:00
Dirk Brandewie 9af81cc280 kernel: kconfig: remove boot options menu
Change BOOTLOADER_UNKNOWN to be a top level option the depends on
X86_32.

Change-Id: I1a92324038b53234730cc7324f43413f8ac18827
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie f37a4fcd71 kernel: kconfig: remove dependencies on EXPERIMENTAL
Remove the hard dependencies on EXPERIMENTAL symbol. Mark all the
symbols the relied on EXPERIMENTAL as EXPERIMENTAL in their prompt

Change-Id: I2779b0ed0776b3d510a8e2e44b35b83d7ad2377c
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie c55c858ffc x86: remove obsolete option PROT_MODE_SWITCH
Zephyr requires that the processor be in 32 bit protected mode on
entry.

Change-Id: I71792eeb154281881e8516a7a8a2291a52f83fc6
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie c033a6d609 misc/kconfig: remove references to non-existant features
Cleanup help text to remove references to non-existant features

Change-Id: I360cdf3de4d6132f1ffdde627004b730b3392299
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Dirk Brandewie 3012166000 x86: remove legacy BOOT_A20_ENABLE option
BOOT_A20_ENABLE relies on the kernel being on a system that has a full
PC BIOS and requires that the A20 line be enabled to boot
correctly. None of the supported platforms satisfy either requirment.

Change-Id: I05805a050f5531de0348b60a4f0cb974e464b279
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:20 -05:00
Andrew Boie 858decd162 misc: don't depend on serial drivers for printk()/printf()
We are introducing other kinds of drivers which support a console
that isn't over a UART.

Change-Id: I0dddbdce958437b5709c5ab26252ed47d030413d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00