Commit graph

137 commits

Author SHA1 Message Date
Andy Ross 718a4cd245 include/toolchain/gcc.h: Fix static assert detection
The logic for using _Static_assert() was a little broken.  We were
using it when on GCC 4.6+ AND when __STDC_VERSION__ said we were on
C99 or better.  But it's not a C99 feature, it's a C11 feature.  And
if GCC provides it as an extension, that's unrelated to a particular
language version.  This should have been "GCC 4.6+ OR C11+".

This actually broke on the ESP-32 IDF toolchain, where (when using
-std=c99) the compiler was actually defining a C99 macro instead of
the C11 one, and choosing to use the wrong (and independently broken)
handling incorrectly.  Fixes #8093.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-06-04 11:56:43 -04:00
Rajavardhan Gundi 08172cdf83 xtensa: provide XCC compiler support for Xtensa
This patchset provides Xtensa's xcc compiler support for Xtensa
projects in Cmake. This requires the below environment variables
to be defined aptly. The appropriate xcc license information also
need to be supplied.

ZEPHYR_GCC_VARIANT=xcc
TOOLCHAIN_VER=RF-2015.3-linux
XTENSA_CORE=cavs21_LX6HiFi3_RF3_WB16
XTENSA_SYSTEM=/opt/xtensa/XtDevTools/install/tools/
		RF-2015.3-linux/XtensaTools/config/
XTENSA_BUILD_PATHS=/opt/xtensa/XtDevTools/install/builds/

Change-Id: Ib3c10e8095439b0e32276ff37c00eca8420773ec
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00
Leandro Pereira 05169a02ce toolchain: common: Allow multiple uses of BUILD_ASSERT() in same scope
BUILD_ASSERT() was always defining a type with the name
__build_assert_failure, causing issues if more than one assertion were
used in the same scope.

Also, use an enum instead of a typedef to avoid (possibly spurious)
warnings such as these:

  variably modified ‘__build_assert_failure1’ at file scope [-Werror]

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-24 04:04:36 +05:30
Leandro Pereira 666274fa60 toolchain: gcc: Only use _Static_assert if building with C11
Zephyr currently builds as C99, whereas _Static_assert is a C11
feature.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-24 04:04:36 +05:30
Leandro Pereira 81f4b11126 include: toolchain: common: Remove deprecated __stack macro
This macro has been deprecated in favor of K_DECLARE_STACK; should have
been removed by 1.11.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-04-23 10:11:08 -07:00
Michael Hope 5f67a6119d include: improve compatibility with C++ apps.
This patch lets a C++ application use more of Zephyr by adding guards
and changeing some constructs to the C++11 equivalent.

Changes include:

- Adding guards
- Switching to static_assert
- Switching to a template for ARRAY_SIZE as g++ doesn't have the
  builtin.
- Re-ordering designated initialisers to match the struct field order
  as G++ only supports simple designated initialisers.

Signed-off-by: Michael Hope <mlhx@google.com>
2018-04-09 23:21:52 -04:00
Anas Nashif ce74393267 toolchain: gcc/common: add header guard
Added guards to the toolchain/gcc.h and toolchain/common.h

Those files should never be included directly, but a guard is useful
regardless.

Fixes #5130

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-02-10 11:14:32 -05:00
Alberto Escolar Piedras 76f7644118 arch: native: Run Zephyr natively in a POSIX OS
A new arch (posix) which relies on pthreads to emulate the context
switching
A new soc for it (inf_clock) which emulates a CPU running at an
infinely high clock (so when the CPU is awaken it runs till completion
in 0 time)
A new board, which provides a trivial system tick timer and
irq generation.

Origin: Original

Fixes #1891

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-27 14:16:08 -05:00
Inaky Perez-Gonzalez 7bc28cf388 syscalls: REVERTME: clean up warnings when building unit tests
This is a temporary hack until #5006 is resolved (possibly using

https://github.com/zephyrproject-rtos/zephyr/issues/5006

Unit testing (BOARD == unit_testing) doesn't need the system call
definitions. Because we foward declare with __syscall them as "static
inline" (from common.h), the compilers will complain that the
definition is missing.

Change to only define __syscall as "static inline" if we are not
builing a unit test to avoid said warnings.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-11-15 19:09:12 -05:00
Andrew Boie 990bf16206 kernel: abolish __syscall_inline
This used to exist because in earlier versions of the system call
interfaces, an "extern" declaration of the system call implementation
function would precede the real inline version of the implementation.
The compiler would not like this and would throw "static declaration
of ‘foo’ follows non-static declaration". So alternate macros were
needed which declare the implementation function as 'static inline'
instead of extern.

However, currently the inline version of these system call
implementations appear first, the K_SYSCALL_DECLARE() macros appear in
the header generated by gen_syscalls.py, which is always included at the
end of the header file. The compiler does not complain if a
static inline function is succeeded by an extern prototype of the
same function. This lets us simplify the generated system call
macros and just use __syscall everywhere.

The disassembly of this was checked on x86 to ensure that for
kernel-only or CONFIG_USERSPACE=n scenarios, everything is still being
inlined as expected.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-03 16:16:03 -04:00
Andrew Boie 9928023421 kernel: make 'static inline' implicit to __syscall
The fact that these are all static inline functions internally is an
implementation detail.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-29 15:09:44 -07:00
Andrew Boie fa94ee7460 syscalls: greatly simplify system call declaration
To define a system call, it's now sufficient to simply tag the inline
prototype with "__syscall" or "__syscall_inline" and include a special
generated header at the end of the header file.

The system call dispatch table and enumeration of system call IDs is now
automatically generated.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-09-29 13:02:20 -07:00
Andrew Boie 8b141dd83e xcc: fix __in_section_unique() and __COUNTER__
XCC assembler freaks out if a section name has __FILE__ in it,
forward slashes and quotation marks confuse it and result in
build errors.

This is not a perfect fix, its possible for two sections to collide,
but at worst this will result is some unnecessary space in noinit,
fooling gc-sections.

XCC also doesn't support __COUNTER__, use __LINE__ as a substitute.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-08-16 10:59:10 -07:00
Andrew Boie 7ce3a79d80 toolchain.h: intoduce __kernel macros
In CONFIG_APPLICATION_MEMORY scenarios, these force
objects to be in kernel memory space.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-15 12:17:54 -07:00
Andrew Boie 2cb03c5cd6 toolchain.h: fix __in_section_unique()
_FILE_PATH_HASH appears to be a legacy Diab-ism that doesn't
expand to anything in GCC.

As a result, when linking the combined binary, it's quite
possible that objects in separate C files would be merged
instead of truly being in their own section. This can confound
--gc-sections and result in unused objects still being in
the final binary if one of the other objects with the same
generated section name was actually used.

We instead just use __FILE__. This results in sometimes absurdly-
long section names in the intermediate .o files, but there is no
actual limit to how long section names in ELF binaries can be;
they are not stored directly in headers but instead referenced
as an offset in the .shstrtab section, which has all the section
names stored in it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-15 12:17:54 -07:00
Andrew Boie 680ca8c944 toolchain/common.h: deprecate __stack
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie e0185d4c76 toolchain: gcc: add __DEPRECATED_MACRO
Add a macro which signals to the compiler that use of the macro is
deprecated.

Example:

  #define FOO __DEPRECATED_MACRO bar

Defines FOO to 'bar' but emits a warning if used in code.

Cannot filter out with -Wno-deprecated, so be careful with -Werror.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Andrew Boie a2b324035c xtensa: move byte-order macros out of arch.h
These are macros that are expected to be defined at all times by
the compiler. We need them at the very beginning of kernel.h for
the k_thread definition, before it's possible to include arch.h.

Make a special toolchain header for XCC compiler and place these
defines in there. Otherwise inherit all the other GCC defines.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 12:47:23 -04:00
Max Filippov 5c6276da72 toolchain: don't define __stack outside C code
__stack is defined as a C language attribute for on-stack arrays. Don't
define it outside C source code.
This definition conflicts with __stack symbol defined in xtensa linker.ld
files.

Change-Id: I59fe34603bc2bb5732ed45c7974de5f8b25d77ed
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2017-04-20 16:01:17 +00:00
Marti Bolivar 2a9bb7af3d toolchain: override static assertions for GCC
Provide a BUILD_ASSERT and BUILD_ASSERT_MSG that are based on
_Static_assert when that's available, as its output is easier to read.

Change-Id: Ifa96d5073b1341cab2a90e4dcd04752ee80c69bb
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:45 +00:00
Marti Bolivar 7e61e70b15 toolchain: add BUILD_ASSERT_MSG()
Like BUILD_ASSERT(), but with a message to emit on failure.

The base implementation swallows the message; compiler headers can
override it when they can do better.

Change-Id: Ib724e48554da77a51afa01468b1d5b7806f9de6b
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:45 +00:00
Marti Bolivar f8c9c5444a toolchain: allow compiler to provide BUILD_ASSERT
Change-Id: Id71d5499d0bd8141062f854a814bd882db470323
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-04-01 20:35:44 +00:00
Benjamin Walsh c73980654c gcc: add compiler_barrier() macro
Prevent compiler from reordering memory access instructions across
critical points.

Change-Id: Id776fe59f51315c8bd2353ea3149cf4aad52e6ba
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
2017-02-16 04:56:20 +00:00
Andrew Boie 42562b9367 xtensa: fix numerous checkpatch issues
Change-Id: I903f5f0692849fb9e7bf5d978b63b12bf1bd6e33
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-13 11:39:03 -08:00
Mazen NEIFER dc391f566c Xtensa port: Added support for Xtensa architecture in zephyr include files.
Change-Id: I1ac677cd6da5222707fe31ead71dc354f7c94443
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Mazen NEIFER c024e429c9 Xtensa port: Added support for Xtensa cores in toolchain/gcc.h.
Change-Id: Ic76934411e79c288e1440e21ee38e9a95a0399b9
Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
2017-02-13 08:04:27 -08:00
Andrew Boie d8027a29f3 toolchain: gcc.h: add indirection to _GENERIC_SECTION() macro
Change-Id: Ic30874cafb4a79213feb93666903816d297084f6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-08 19:10:55 +00:00
Andrew Boie 3c6f572361 section_tags.h: cleanup
Some stuff that was platform-specific is made common, and some repeated
code was made a macro. __in_section() is used elsewhere in the codebase
and its 2nd and 3rd arguments are not necessarily filename/counter.

GCC-specific stuff moved to the toolchain header.

Change-Id: Ibfae919b6dd8a77210801c14e9a1128b43bd63f6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-02-08 19:10:43 +00: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
Jean-Paul Etienne cd83e85edc arch: added support for the riscv32 architecture
RISC-V is an open-source instruction set architecture.
Added support for the 32bit version of RISC-V to Zephyr.

1) exceptions/interrupts/faults are handled at the architecture
   level via the __irq_wrapper handler. Context saving/restoring
   of registers can be handled at both architecture and SOC levels.
   If SOC-specific registers need to be saved, SOC level needs to
   provide __soc_save_context and __soc_restore_context functions
   that shall be accounted by the architecture level, when
   corresponding config variable RISCV_SOC_CONTEXT_SAVE is set.

2) As RISC-V architecture does not provide a clear ISA specification
   about interrupt handling, each RISC-V SOC handles it in its own
   way. Hence, at the architecture level, the __irq_wrapper handler
   expects the following functions to be provided by the SOC level:
   __soc_is_irq: to check if the exception is the result of an
                 interrupt or not.
   __soc_handle_irq: handle pending IRQ at SOC level (ex: clear
                     pending IRQ in SOC-specific IRQ register)

3) Thread/task scheduling, as well as IRQ offloading are handled via
   the RISC-V system call ("ecall"), which is also handled via the
   __irq_wrapper handler. The _Swap asm function just calls "ecall"
   to generate an exception.

4) As there is no conventional way of handling CPU power save in
   RISC-V, the default nano_cpu_idle and nano_cpu_atomic_idle
   functions just unlock interrupts and return to the caller, without
   issuing any CPU power saving instruction. Nonetheless, to allow
   SOC-level to implement proper CPU power save, nano_cpu_idle and
   nano_cpu_atomic_idle functions are defined as __weak
   at the architecture level.

Change-Id: I980a161d0009f3f404ad22b226a6229fbb492389
Signed-off-by: Jean-Paul Etienne <fractalclone@gmail.com>
2017-01-13 19:52:23 +00:00
Carles Cufi 680270f809 toolchain: Add a popcount macro for GCC
Hamming Weight or "popcount" consists in counting the number of bits set
to 1 in a particular word. This commit adds a macro to be able to use
the existing builtin for this purpose with the GCC compiler.

Change-Id: Iec64c19e897de2bc02e981071465bbe230ee9add
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-12 20:07:53 +00:00
Peter Mitsis 6704ff462e kernel: Add __unused tag
The '__unused' tag can be used to inform the compiler that a variable
might be deliberately unused. It can be used instead of ARG_UNUSED().

Change-Id: I0ec4ee92dcec29b5f9cbda362d0d6b051055628a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-03 20:22:05 +00:00
Carles Cufi bb9f432dc1 toolchain: Add BUILD_ASSERT macro for compile-time checks
This new macro will trigger a build failure if the compile-time
check fails. Useful for checking static conditions such as
structure sizes or offsets.

Change-Id: I417ea816003b97beb1b5f15bc583c38691f0b8a9
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-03 19:41:08 +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
Peter Mitsis df6c72028f unified: Conditionally define __printf_like() macro
Only define the __printf_like() toolchain macro if it is not already
defined. This permits projects to override this macro if desired.

Change-Id: Ic4a7b3eb48360f8e258493d6f447d3df793f572e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-09-20 11:43:40 -04:00
Andrew Boie d6053db355 kernel: abolish FUNC_NO_FP
These impede debugging and we have CONFIG_OMIT_FRAME_POINTER
now which does this globally for the entire kernel.

Change-Id: I46939223e27dd298ca3ed162ff5790cb2e9ed2a2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-09 21:13:30 +00:00
Andy Ross 9f628943a8 toolchain: Remove vestigial COFF assembler symbol mangling support
The toolchain headers included an abstraction for defining symbol
names in assembly context in the situation where we're using a
DOS-style assembler that automatically prepends an underscore to
symbol names.

We aren't.  Zephyr is an ELF platform.  None of our toolchains do
this.  Nothing sets the "TOOL_PREPENDS_UNDERSCORE" macro from within
the project, and it surely isn't an industry standard.  Yank it out.
Now we can write assembler labels in natural syntax, and a few other
things fall out to simplify too.

(NOTE: these headers contain assembly code and will fail checkpatch.
That is an expected false positive.)

Change-Id: Ic89e74422b52fe50b3b7306a0347d7a560259581
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-08-30 19:01:11 +00:00
Andrew Boie 6539fbd453 toolchain/common.h: remove comment
4 is the correct value for this arch, the CPU will freak out
if functions aren't 4-byte aligned.

Change-Id: I3d6742516cb323680ab1f9fe7b1a88de1fbf1fae
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-29 05:23:55 +00:00
Andrew Boie 738dec483e nios2: add static interrupt handling code
Supports Internal Interrupt Controller only for now; EIC
supoort tracked in ZEP-258.

Change-Id: I2d9c5180e61c06b377fce4bda8a59042b68d58f2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:21 +00:00
Andrew Boie ced164e14f toolchain: common.h: define PERFOPT_ALIGN for Nios2
This is just a temporary value for now, need to research the best
value to use.

Change-Id: Icaadf75fa3ae98b087f3d51813f85003f398f378
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-03 23:18:47 +00:00
Andrew Boie 9433895954 nios2: basic build, non-functional
Basic build framework for Nios2. Everything is stubbed out,
we just want to have a build going so that we can start to
parallelize implementation tasks.

This patch is not intended to be functional, but should be
able to produce a binary for all the nanokernel-based
sanity checks.

Change-Id: I12dd8ca4a2273f7662bee46175822c9bbd99202a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-03 23:18:45 +00:00
Benjamin Walsh 2fa37a0bec gcc: add __weak for shorter __attribute__((__weak__))
Change-Id: Idd878c19201247492bbc42228f2a225ed625f4b8
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-04-16 05:29:20 +00:00
Andrew Boie facd6e51c6 gcc: add __deprecated for shortened __attribute__((deprecated))
Change-Id: If4e589f8eaeb7439e5e17474ad63bbdbaabde072
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-15 22:07:57 +00:00
Johan Hedberg 62fc555c88 include: Remove UNALIGNED_READ & UNALIGNED_WRITE
These were not actually used anywhere and weren't correct (at least
not the READ variant which assumed the architecture can always deal
with unaligned access).

Change-Id: If2bee24dc729683c839bb631d411eab73498adad
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:11:57 +00:00
Johan Hedberg 1d5f1cd6c9 include: Add UNALIGNED_PUT helper
Provide a helper to perform safe unaligned writes to data.

Change-Id: I00edde580d2ef93daaf7825d333d38fc10f854ac
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-04 20:11:56 +00:00
Anas Nashif df3bd11e3c toolchain: check if both __aligned and __packed are defined
Avoid build conflict when those are defined by someone else.

Change-Id: I1bdf4064ec2180fff311c2b7a34363c53f438602
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:31 -05:00
Peter Mitsis 36a2ae3184 c++: Add TASK_ENTRY_CPP to C++ task entry points
The TASK_ENTRY_CPP macro is to be used to tag task entry points when
they are defined in a C++ file.

Change-Id: I213965cf55648f54972e1e95bf5b4269f03fd44d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Peter Mitsis babea6d2dd c++: Add EXTERN_C macro
The EXTERN_C macro is to be used to ensure compatibility between C and C++;
It prevents name mangling in C++ environments.

Change-Id: I33be727150687901f7770306c8a07c16a7e46ffa
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:22 -05:00
Anas Nashif 0a272bc420 fixed check for clang compiler
Use defined(__clang__) otherwise it might fail in some cases.

Change-Id: Ifb2e1cd971325e2a7f87e530e5ee921a5fcee6b9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Anas Nashif 275ca60b08 Fixed file description and applied doxygen style
Removed old style file description and documnetation and apply
doxygen synatx.

Change-Id: I3ac9f06d4f574bf3c79c6f6044cec3a7e2f6e4c8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:58 -05:00
Juan Manuel Cruz a894799c94 arc: static IRQ handling
Adds support for static IRQ handler initialization.

Currently, IRQ_CONNECT and IRQ_CONFIG macros are emulating static
behavior through dynamic initialization.
This commit updates the macros to get real static initialization.
IRQ handlers must be assigned at build time.

Change-Id: Ia07fb25a5e4dae489f84ffcedb28007ee18a3b82
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Juan Manuel Cruz b798c0adad devices: _PASTE macro relocated from init.h to common.h
The _PASTE and _PASTE2 macros are relocated from init.h (device handling) to
toolchain/common.h for better reuse.
_PASTE and PASTE_2 macro are renamed to _CONCAT and _DO_CONCAT.
These names are more descriptive.

Change-Id: Ie2f5b0cba1f1179eb3fb5ec00236a75a73267f98
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:24:56 -05:00
Dmitriy Korovkin e6e9237d41 toolchain: added macro for converting argument to a string
Change-Id: I71f824d1a309b836122a7dd2a74530a4c6d613b2
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.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
Anas Nashif db26a98c93 Fixed various clang build issues
Fix a few spots where building with with clang fails.

Change-Id: I621c7cb8daf119bf89ad512168d70e1c9b67e53f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:47 -05:00
Andrew Boie 6bf328b6ea x86: use GCC inline assembly for atomic operations
This doesn't make any assumptions on calling conventions or
the structure of the stack, and should thus be portable to
compilers that implement different C calling conventions.

In order for the rewritten functions to take up the same code
size as the pure-asm counterparts, -fomit-frame-pointer has
been specified for each of them, otherwise an extra 4 bytes
is used for every function.

The generated assembly code by these new functions has been
verified in GDB to be the same as the old ones, except a few
trivial things like particular registers used.

Change-Id: I9a896cbfc3e7f4c2497d749140729d28b32f1c9d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:42 -05:00
Andrew Boie 8a2104e16a x86: remove CONFIG_UNALIGNED_WRITE_UNSUPPORTED
This had bit-rotted to the point where it was breaking the build
and was only needed on legacy platforms that are no longer
supported.

Change-Id: I4fcfc38bacac58761fba475701e0c27d7b8b7a27
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:42 -05:00
Dan Kalowsky 2a63743192 cleanup: removing NOMANUAL
The \NOMANUAL tag is a remnant from days of yore and is no longer
needed or useful.  Cleaning up the code references to this.

Change-Id: I1b8cc9c9560d1dbb711f05fa63fd23386789875c
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:35 -05:00
Dan Kalowsky da67b29569 checkpatch: warning - block_comment_style
Change-Id: I6da43e41f9c6efee577b70513ec368ae3cce0144
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:33 -05:00
Dan Kalowsky 39063598db checkpatch: error - spacing
Change-Id: Ie6e1c43581dd4b0734625b3a4e59a4ca79619e99
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:31 -05:00
Anas Nashif 9104031a96 toolchain: change aligned/used macros to support external c libraries
use __aligned__ and __used__ instead of aligned/used to avoid conflicts
with macros of the same name.

Change-Id: Ic36067dfc9df7ebcea486a075f759825d0dbde70
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -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
Benjamin Walsh 4c13d8273e toolchain: rename FUNC_ALIAS parameters
Make them less confusing:

- new_alias: alias to be created
- real_func: the real function to create an alias of
- return_type: return type of the function

Change-Id: I1007b6b4c93c5ea9c817f72d0e68c0fb40e92190
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:15:27 -05:00
Andrew Boie a13fddb7da toolchain.h: add __used macro
Change-Id: I252390fb125a569a975a093903eba42c8971629d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:19 -05:00
Andrew Boie be324badba toolchain: add __printf_like macro
Used to direct the compiler to examine the number and correctness
of arguments based on codes in the format string.

Change-Id: I8e408b3fcd6897a14d30363425f14f81628b3d3f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:15:19 -05:00
Peter Mitsis b99194ee98 Remove obsolete SYS_PREKERNEL_INIT() macro
The SYS_PREKERNEL_INIT() macro was a temporary item until the new driver
initialization model was implemented.

Change-Id: I052db0c9f41f54bfd0b54b50aa0b18f018be640c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:37 -05:00
Anas Nashif ea0d0b220c doxygen: change comment style to match javadoc
The change replaces multiple asterisks to ** at
the beginning of comments and adds a space before
the asterisks at the beginning of lines.

Change-Id: I7656bde3bf4d9a31e38941e43b580520432dabc1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:32 -05:00
Peter Mitsis 580dcb6d8e Remove deprecated macros ALIGN_STRUCT and PACK_STRUCT
As the macros ALIGN_STRUCT(x) and PACK_STRUCT are no longer used, it is safe
to remove them.  (Their replacement macros are __aligned(x) and __packed.)

Change-Id: If52302b6fba91ac707af828396592ecc3016934d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:22 -05:00
Anas Nashif f2520f87a2 Rename VXMICRO_ARCH_arc -> CONFIG_ARC
Change-Id: I4aca181523f50f43ee01e1be0c20a9ad844ef618
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Anas Nashif 274622ea69 Rename VXMICRO_ARCH_arm -> CONFIG_ARM
Change-Id: I32b2e39781825504e7936b3df0c864988650c35c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Anas Nashif 191fc279ce Rename VXMICRO_ARCH_x86 -> CONFIG_X86_32
Change-Id: Ie1bcfebce1db838ea994cb3626396ea032225830
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Jukka Rissanen 781b627f8c Add __may_alias macro to GCC toolchain
This is needed when one wants to avoid gcc
"dereferencing type-punned pointer" warnings.

Change-Id: I7bfd68fabb07deb64908cb0eaa833bdc5c8a4e08
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:16 -05:00
Peter Mitsis ad74658009 Add __stack tag for aligning task/fiber stacks
The "__stack" tag is to be used to align an array (to STACK_ALIGN) for stack
use by either a fiber or task.

Change-Id: I5828f3ee1b09b0b5ba894ea30689d179de347494
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis 4bb47b625c Add __aligned(x) and __packed macros to GCC toolchain
The names "__aligned(x)" and "__packed" are more generic than ALIGN_STRUCT(x)
and PACK_STRUCT respectively and are to be used in their stead.

NOTE: ALIGN_STRUCT(x) and PACK_STRUCT are now considered obsolete.

Change-Id: Ic5e859092643dde53bb8fa1117c6d877c2c4296f
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:13 -05:00
Allan Stephens e54a6c4b68 Eliminate separate include files for generating absolute symbols
The toolchain-specific macros used to generate absolute symbols
are now part of the main include file for that toolchain, since
there doesn't seem to be a good reason to have them in a separate
file.

Change-Id: Ic97800485b20d6c5b23d14f69f67ee845cf076f5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:13 -05:00
Peter Mitsis 18fa789ca0 Rework constructor macros
Routines are no longer flagged as constructors using the FUNC_CONSTRUCT(level)
macro.  This is because some compilers do not support constructor levels.

To indicate that a routine should be a constructor, the SYS_PREKERNEL_INIT()
macro should be used AFTER the definition of the routine.  For example ...

void my_library_init(void)
{
    ...
}

SYS_PREKERNEL_INIT(my_library_init, 500);

The first parameter to SYS_PREKERNEL_INIT() is the name of the routine.  The
second is the priority level (000...999).  The lower the number, the higher
the priority.  NOTE: It is important that all three digits are specified;
otherwise the linker may put the constructors in an undesired order.

Change-Id: Ic334875c60a453b39c10a2ffdee856b4851cb16c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:00 -05:00
Peter Mitsis 7db51e4eaa Standardize on using _STRINGIFY(x)
Replaces various stringify type macros with _STRINGIFY(x).

Change-Id: Ic029d1e6ae344e960464310067eb1a648869919a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:00 -05:00
Peter Mitsis 1c313b6f89 Remove references to ICC
Keys off variations of "ICC" to remove references to the Intel C Compiler as
it is not supported.

Change-Id: I09f67880b39839982ed1c450e564c274440628a5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:00 -05:00
Yonattan Louise d133f9661d Fix checkpatch issue - WARNING:SPACING
This commit fixes the issue marked as SPACING by the checkpatch script
deleting the whitespaces between the function name and the open parenthesis.

Change-Id: I972b1646904bf6e1131263f94ab5024a528ae07d
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:59 -05:00
Luiz Augusto von Dentz 9ef64a3112 toolchain/gcc: Add UNALIGNED_GET macro
Similar to PACK_STRUCT it provide safe access to possible unaligned data
but it is much more convenient to use with non-struct types since all
one need to do is add a cast e.g. UNALIGNED_GET((uint16_t *) data).

Change-Id: I46402bdf1dd13081fe340a7214a84750a6cf04d2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Yonattan Louise a8571c4b7f Fix checkpatch issue - WARNING:SPACING
Spaces between the function name and the open parenthesis are not allowed.
This commit fixes the case where only one open parenthesis with leading
whitespaces is present in the line.

	#!/bin/bash

	checkpatch_script="$VXMICRO_BASE/scripts/checkpatch.pl --mailback --no-tree -f --emacs --summary-file --show-types --ignore BRACES,PRINTK_WITHOUT_KERN_LEVEL,SPLIT_STRING --max-line-length=100 "

	for file in $(find ./ -name "*.[ch]" ! -path "./scripts/*" ! -path "./host/src/wrsconfig/*");
	do
		# fixing spaces between function name and open parenthesis
		for line in $(eval $checkpatch_script $file | grep "WARNING:SPACING: space prohibited between function name and open parenthesis '('" | cut -d":" -f2)
		do
			echo "$file : $line"
			sed -i ''$line' { /[ \t](.*[ \t](/ b skip_it s/[ \t]*(/(/ ; :skip_it }' $file;
		done;
	done;

Change-Id: I1e026eaee930e297374e5f2f725b78f29824dee3
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:13:54 -05:00
Dmitriy Korovkin e82a2a36c7 Compiler specific configuration
If a source code file depends on a configuration option,
that, in turn, depends on a compiler, this file has to
include toolchain.h.

toolchain.h includes a compiler specific header file that
sets the proper configuration option.

Change-Id: I7c9002522a8c6d6fd945e27a450ebe46ba9d4892
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:13:52 -05:00
Dmitriy Korovkin 58accba801 Make absolute symbol macros headers compiler dependent
In order for better compiler support make sure that
absolute symbol macros are specific for a supported compiler.

As the patch modifies gen_config_abssym sources, at least,
host/src/gen_config_abssym host tool needs rebuild.

Change-Id: Iece19611e2410a9753e538c725c5c81a447bf978
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:13:52 -05:00
Peter Mitsis c2929b4f38 toolchain/arch: Remove section garbage collection ifdef guards
Section garbage collection is to be always enabled.

Note that this does not have any impact on performance measurements of any
existing sample project as they all use the default section garbage collection
value (enabled).

Change-Id: I57baa55dd52d45b633d8ca319e799ef483a5246b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:13:48 -05:00
Yonattan Louise 29bd1c70ab Fix checkpatch issue - ERROR:POINTER_LOCATION
This commit changes the pointer's location in order to comply with
the defined coding style.

Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@linux.intel.com>
Change-Id: Ibcf1ef0e4fc53b0cb5286b36119e76d017f24cd9
2016-02-05 20:13:39 -05:00
Inaky Perez-Gonzalez 8ddf82cf70 First commit
Signed-off-by:  <inaky.perez-gonzalez@intel.com>
2015-04-10 16:44:37 -07:00