If the embedded application has a main(),
Zephyr requires it to have a signature with
C linkage (no C++ name mangling).
Otherwise Zephyr's init will not call it,
but will call the default weak stub.
But, when building with clang/llvm, when we
build calling the compiler with --frestanding
(for ex if CONFIG_MINIMAL_LIBC is set), the
compiler will mangle the main() symbol name.
This is not incorrect behavior from the compiler,
as, in principle, in a freestanding environment
main() does not have a special meaning.
gcc is still not mangling it when called with
--frestanding.
To avoid this issue, we define explicitly
the main linkage as extern C,
in a header the application will always include.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
With the new <zephyr/> include prefix, the "types" header ended up being
located in <zephyr/zephyr/types.h>, ie weird. Code that hasn't migrated
to <zephyr/zephyr/types.h> (no occurences in tree) will be automatically
prepared for the removal of the legacy include path. Most applications
will not be impacted as both include and include/zephyr are now in the
include path, and they'll be already prepared for the future.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
example: <irq.h> -> <zephyr/irq.h>
Issue #41543
Signed-off-by: Yuval Peress <peress@google.com>
Its been 2 releases since we deprecated the old zephyr integer types.
We can now remove support for the Kconfig option, code, and, test to
allow the old int types to be supported.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
As the int types defined in include/zephyr/types.h are typdef's we
utilize a Kconfig option (LEGACY_ZEPHYR_INT_TYPES) to enable/disable
the support for them. By default to LEGACY_ZEPHYR_INT_TYPES not
being enabled and add an explicit test to ensure the types continue to
function until removed in the future.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There are two aspects to this: CPU registers are twice as big, and the
load and store instructions must use the 'd' suffix instead of the 'w'
one. To abstract register differences, we simply use a ulong_t instead
of u32_t given that RISC-V is either ILP32 or LP64. And the relevant
lw/sw instructions are replaced by LR/SR (load/store register) that get
defined as either lw/sw or ld/sd. Finally a few constants to deal with
register offsets are also provided.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
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>
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t. This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.
We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.
We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.
Jira: ZEP-2051
Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>