Commit graph

11 commits

Author SHA1 Message Date
Daniel Leung
e73231f7f0 toolchain: xcc: use Clang if exists
The XCC toolchain may come with Clang front-end depending on
how it's built. Currently, the only SoC/board using XCC is
the intel_s1000_crb and its XCC toolchain comes with Clang
3.9.0 which has a lot better support for C99 and C++11 than
the portion based on GCC 4.2 (which does not even support
C++11). So this change attempts to use the Clang portion
instead of GCC if the Clang executable exists.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-07 17:09:38 +01:00
Daniel Leung
d390bb2d66 xtensa: define UINT32_C macro for XCC
Newer XCC versions wrap unsigned int with UINT32_C(x)
in their own macros. However, the #include chain
usually does not contain UINT32_C(x). To make matters
worse, including stdint.h (where UINT32_C is defined)
in toolchain/xcc.h would cause the linker script to
contain a bunch of typedef which are invalid for
linker scripts. So define UINT32_C(x) manually.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-01-07 17:09:38 +01:00
Daniel Leung
a058219245 toolchain: fix __BYTE_ORDER__ not defined for XCC
Commit 571741a0c5 introduced a block to determine __BYTE_ORDER__
within toolchain/gcc.h. However, toolchain/xcc.h defined
__BYTE_ORDER__ there but the early inclusion of gcc.h causes
errors since __BYTE_ORDER__ cannot be determined within gcc.h.
So wrap around the gcc.h include with a fake __BYTE_ORDER__ to
bypass the check in gcc.h.

Also set the __BYTE_ORDER__ to the correct __ORDER_*_ENDIAN__
macro.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-12-02 09:58:00 -05:00
Jakob Olesen
c8708d9bf3 misc: Replace uses of __builtin_*_overflow() with <misc/math_extras.h>.
Use the new math_extras functions instead of calling builtins directly.

Change a few local variables to size_t after checking that all uses of
the variable actually expects a size_t.

Signed-off-by: Jakob Olesen <jolesen@fb.com>
2019-05-14 19:53:30 -05:00
Flavio Ceolin
b45a287b02 toolchain: xcc: Builtin overflow functions return boolean
The builtin_*_overflow functions when available return a
boolean. Change internal definitions to return same type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-30 08:05:11 -08:00
Anas Nashif
d7fe69a6bc toolchain: xcc: __builtin_unreachable needs to be a loop
Functions are declared as noreturn but they do in fact return (when
control reaches the end of the body, since it doesn't enter an infinite
loop, it doesn't call other "noreturn" functions, etc.)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-11-02 08:37:27 -04:00
Daniel Leung
51e47180f0 toolchain: xcc: fake __builtin_umul[ll]_overflow
XCC doesn't provide these builtins so we have to define them
with minimal functionality for testing.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2018-10-19 17:52:45 -04:00
Flavio Ceolin
67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -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
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
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