ARC: LIB: add ARC MWDT libc support

ARC MWDT toolchain doesn't provide newlib, let's add support
of ARC MWDT libc to Zephyr

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
Evgeniy Paltsev 2021-06-03 19:55:08 +03:00 committed by Kumar Gala
commit e479d9aea0
4 changed files with 31 additions and 0 deletions

View file

@ -2,6 +2,8 @@
if(CONFIG_NEWLIB_LIBC)
add_subdirectory(newlib)
elseif(CONFIG_ARCMWDT_LIBC)
add_subdirectory(arcmwdt)
else()
add_subdirectory(minimal)
endif()

View file

@ -31,6 +31,13 @@ config NEWLIB_LIBC
Build with newlib library. The newlib library is expected to be
part of the SDK in this case.
config ARCMWDT_LIBC
bool "ARC MWDT C library"
depends on !NATIVE_APPLICATION
depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "arcmwdt"
help
C library provided by ARC MWDT toolchain.
config EXTERNAL_LIBC
bool "External C library"
help

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(
arcmwdt-string.c
)

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2021 Synopsys.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
size_t strnlen(const char *s, size_t maxlen)
{
return strnlen_s(s, maxlen);
}