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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Use a short name for this option CONFIG_OBJECT_TRACING.
Change-Id: Id27de7ef9ca299492b6b7d2324d9f5bcf8059a31
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
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>
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>
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>
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>
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>
These correspond to the libc snprintf and vsnprintf APIs.
Change-Id: If3944972ed95934a4967756593bb2932c3359b72
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>