aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmbroise Vincent <ambroise.vincent@arm.com>2019-02-11 14:34:26 +0000
committerSandrine Bailleux <sandrine.bailleux@arm.com>2019-03-04 12:20:48 +0000
commitd6e806d35599bf003c575d7d113367b8de910448 (patch)
treecd4ccb353ae8b91e6504057c20eaf641cd13ab63
parent602b7f58dd7668411c8a4032652b4552bd7fe934 (diff)
downloadtf-a-tests-d6e806d35599bf003c575d7d113367b8de910448.tar.gz
libc: Update makefiles
Added includes and sources of libc to the makefiles. Change-Id: I8e84db9634e0df7d51caa5c5858311672dd3a8d1 Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
-rw-r--r--Makefile27
-rw-r--r--docs/design.rst2
-rw-r--r--fwu/ns_bl1u/ns_bl1u.mk3
-rw-r--r--fwu/ns_bl2u/ns_bl2u.mk3
-rw-r--r--readme.rst8
-rw-r--r--spm/cactus/cactus.mk13
-rw-r--r--spm/ivy/ivy.mk13
-rw-r--r--tftf/framework/framework.mk18
8 files changed, 23 insertions, 64 deletions
diff --git a/Makefile b/Makefile
index 745685827..0179bbfc1 100644
--- a/Makefile
+++ b/Makefile
@@ -26,11 +26,11 @@ ENABLE_ASSERTIONS := ${DEBUG}
CHECKCODE_ARGS := --no-patch
# Do not check the coding style on imported library files or documentation files
INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \
- include/lib/stdlib, \
+ include/lib/libc, \
$(wildcard include/lib/*)))
LIB_DIRS_TO_CHECK := $(sort $(filter-out \
lib/compiler-rt \
- lib/stdlib, \
+ lib/libc, \
$(wildcard lib/*)))
ROOT_DIRS_TO_CHECK := $(sort $(filter-out \
lib \
@@ -117,12 +117,16 @@ include fwu/ns_bl2u/ns_bl2u.mk
include spm/cactus/cactus.mk
include spm/ivy/ivy.mk
+################################################################################
+# Include libc
+################################################################################
+include lib/libc/libc.mk
+
# Include platform specific makefile last because:
# - the platform makefile may use all previous definitions in this file.
# - the platform makefile may wish overwriting some of them.
include ${PLAT_MAKEFILE_FULL}
-
.SUFFIXES:
################################################################################
@@ -175,7 +179,8 @@ COMMON_CFLAGS_aarch32 := -march=armv8-a
COMMON_ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \
-Werror -Wmissing-include-dirs \
- -D__ASSEMBLY__ $(COMMON_ASFLAGS_$(ARCH))
+ -D__ASSEMBLY__ $(COMMON_ASFLAGS_$(ARCH)) \
+ ${INCLUDES}
COMMON_CFLAGS += -nostdinc -ffreestanding -Wall -Werror \
-Wmissing-include-dirs $(COMMON_CFLAGS_$(ARCH)) \
-std=gnu99 -Os
@@ -183,7 +188,7 @@ COMMON_CFLAGS += -ffunction-sections -fdata-sections
# Get the content of CFLAGS user defined value last so they are appended after
# the options defined in the Makefile
-COMMON_CFLAGS += ${CFLAGS}
+COMMON_CFLAGS += ${CFLAGS} ${INCLUDES}
COMMON_LDFLAGS += --fatal-warnings -O1 --gc-sections --build-id=none
@@ -199,29 +204,31 @@ PP := ${CROSS_COMPILE}gcc
################################################################################
-TFTF_SOURCES := ${FRAMEWORK_SOURCES} ${TESTS_SOURCES} ${PLAT_SOURCES}
+TFTF_SOURCES := ${FRAMEWORK_SOURCES} ${TESTS_SOURCES} ${PLAT_SOURCES} ${LIBC_SRCS}
TFTF_INCLUDES += ${PLAT_INCLUDES}
TFTF_CFLAGS += ${COMMON_CFLAGS}
TFTF_ASFLAGS += ${COMMON_ASFLAGS}
TFTF_LDFLAGS += ${COMMON_LDFLAGS}
-NS_BL1U_SOURCES += ${PLAT_SOURCES}
+NS_BL1U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS}
NS_BL1U_INCLUDES += ${PLAT_INCLUDES}
NS_BL1U_CFLAGS += ${COMMON_CFLAGS}
NS_BL1U_ASFLAGS += ${COMMON_ASFLAGS}
NS_BL1U_LDFLAGS += ${COMMON_LDFLAGS}
-NS_BL2U_SOURCES += ${PLAT_SOURCES}
+NS_BL2U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS}
NS_BL2U_INCLUDES += ${PLAT_INCLUDES}
NS_BL2U_CFLAGS += ${COMMON_CFLAGS}
NS_BL2U_ASFLAGS += ${COMMON_ASFLAGS}
NS_BL2U_LDFLAGS += ${COMMON_LDFLAGS}
+CACTUS_SOURCES += ${LIBC_SRCS}
CACTUS_INCLUDES += ${PLAT_INCLUDES}
CACTUS_CFLAGS += ${COMMON_CFLAGS}
CACTUS_ASFLAGS += ${COMMON_ASFLAGS}
CACTUS_LDFLAGS += ${COMMON_LDFLAGS}
+IVY_SOURCES += ${LIBC_SRCS}
IVY_INCLUDES += ${PLAT_INCLUDES}
IVY_CFLAGS += ${COMMON_CFLAGS}
IVY_ASFLAGS += ${COMMON_ASFLAGS}
@@ -254,14 +261,14 @@ realclean distclean:
checkcodebase: locate-checkpatch
@echo " CHECKING STYLE"
@if test -d .git ; then \
- git ls-files | grep -E -v 'stdlib|docs|\.md|\.rst' | \
+ git ls-files | grep -E -v 'libc|docs|\.md|\.rst' | \
while read GIT_FILE ; \
do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \
done ; \
else \
find . -type f -not -iwholename "*.git*" \
-not -iwholename "*build*" \
- -not -iwholename "*stdlib*" \
+ -not -iwholename "*libc*" \
-not -iwholename "*docs*" \
-not -iwholename "*.md" \
-not -iwholename "*.rst" \
diff --git a/docs/design.rst b/docs/design.rst
index edb3c95ff..5a13d79f9 100644
--- a/docs/design.rst
+++ b/docs/design.rst
@@ -66,7 +66,7 @@ the top level or under the ``tftf/`` directory):
- **Library code.**
- Firstly, there is ``include/stdlib/`` which provides standard C library
+ Firstly, there is ``include/libc/`` which provides standard C library
functions like ``memcpy()``, ``printf()`` and so on.
Additionally, various other APIs are provided under ``include/lib/``. The
below list gives some examples but might not be exhaustive.
diff --git a/fwu/ns_bl1u/ns_bl1u.mk b/fwu/ns_bl1u/ns_bl1u.mk
index edc77bef5..7a6b65b77 100644
--- a/fwu/ns_bl1u/ns_bl1u.mk
+++ b/fwu/ns_bl1u/ns_bl1u.mk
@@ -15,8 +15,6 @@ NS_BL1U_INCLUDES := \
-Iinclude/common/${ARCH} \
-Iinclude/lib \
-Iinclude/lib/${ARCH} \
- -Iinclude/lib/stdlib \
- -Iinclude/lib/stdlib/sys \
-Iinclude/lib/utils \
-Iinclude/lib/xlat_tables \
-Iinclude/plat/common \
@@ -39,7 +37,6 @@ NS_BL1U_SOURCES += drivers/io/io_fip.c \
lib/locks/${ARCH}/spinlock.S \
lib/smc/${ARCH}/asm_smc.S \
lib/smc/${ARCH}/smc.c \
- ${STD_LIB_SOURCES} \
lib/utils/mp_printf.c \
lib/utils/uuid.c \
${XLAT_TABLES_LIB_SRCS} \
diff --git a/fwu/ns_bl2u/ns_bl2u.mk b/fwu/ns_bl2u/ns_bl2u.mk
index 8c3924d30..0351e55bd 100644
--- a/fwu/ns_bl2u/ns_bl2u.mk
+++ b/fwu/ns_bl2u/ns_bl2u.mk
@@ -15,8 +15,6 @@ NS_BL2U_INCLUDES := \
-Iinclude/common/${ARCH} \
-Iinclude/lib \
-Iinclude/lib/${ARCH} \
- -Iinclude/lib/stdlib \
- -Iinclude/lib/stdlib/sys \
-Iinclude/lib/utils \
-Iinclude/lib/xlat_tables \
-Iinclude/plat/common \
@@ -37,7 +35,6 @@ NS_BL2U_SOURCES += fwu/ns_bl2u/${ARCH}/ns_bl2u_entrypoint.S \
lib/locks/${ARCH}/spinlock.S \
lib/smc/${ARCH}/asm_smc.S \
lib/smc/${ARCH}/smc.c \
- ${STD_LIB_SOURCES} \
lib/utils/mp_printf.c \
lib/utils/uuid.c \
${XLAT_TABLES_LIB_SRCS} \
diff --git a/readme.rst b/readme.rst
index 15125451f..8a788ac94 100644
--- a/readme.rst
+++ b/readme.rst
@@ -41,8 +41,9 @@ described in the `Contributing Guidelines`_.
This project contains code from other projects as listed below. The original
license text is included in those source files.
-- The libc source code is derived from `FreeBSD`_ code, which uses various BSD
- licenses, including BSD-3-Clause and BSD-2-Clause.
+- The libc source code is derived from `FreeBSD`_ and `SCC`_. FreeBSD uses
+ various BSD licenses, including BSD-3-Clause and BSD-2-Clause. The SCC code
+ is used under the BSD-3-Clause license with the author's permission.
- The `LLVM compiler-rt`_ source code is disjunctively dual licensed
(NCSA OR MIT). It is used by this project under the terms of the NCSA
@@ -138,7 +139,7 @@ tracker <TODO: insert link>.
--------------
-*Copyright (c) 2018, Arm Limited. All rights reserved.*
+*Copyright (c) 2018-2019, Arm Limited. All rights reserved.*
.. _Contributing Guidelines: contributing.rst
.. _license: license.rst
@@ -151,6 +152,7 @@ tracker <TODO: insert link>.
.. _Juno Arm Development Platform: https://developer.arm.com/products/system-design/development-boards/juno-development-board
.. _FreeBSD: http://www.freebsd.org
+.. _SCC: http://www.simple-cc.org/
.. _LLVM compiler-rt: https://compiler-rt.llvm.org/
.. _Power State Coordination Interface (PSCI): PSCI_
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 056b4a7af..d964ab13a 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -14,8 +14,6 @@ CACTUS_INCLUDES := \
-Iinclude/common/${ARCH} \
-Iinclude/lib \
-Iinclude/lib/${ARCH} \
- -Iinclude/lib/stdlib \
- -Iinclude/lib/stdlib/sys \
-Iinclude/lib/sprt \
-Iinclude/lib/utils \
-Iinclude/lib/xlat_tables \
@@ -38,16 +36,6 @@ CACTUS_SOURCES := \
sp_helpers.c \
) \
-STDLIB_SOURCES := $(addprefix lib/stdlib/, \
- assert.c \
- mem.c \
- putchar.c \
- printf.c \
- rand.c \
- strlen.c \
- subr_prf.c \
-)
-
# TODO: Remove dependency on TFTF files.
CACTUS_SOURCES += \
tftf/framework/debug.c \
@@ -58,7 +46,6 @@ CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
lib/${ARCH}/misc_helpers.S \
lib/locks/${ARCH}/spinlock.S \
lib/utils/mp_printf.c \
- ${STDLIB_SOURCES} \
${SPRT_LIB_SOURCES}
CACTUS_LINKERFILE := spm/cactus/cactus.ld.S
diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk
index 244d20969..5a6ccf004 100644
--- a/spm/ivy/ivy.mk
+++ b/spm/ivy/ivy.mk
@@ -14,8 +14,6 @@ IVY_INCLUDES := \
-Iinclude/common/${ARCH} \
-Iinclude/lib \
-Iinclude/lib/${ARCH} \
- -Iinclude/lib/stdlib \
- -Iinclude/lib/stdlib/sys \
-Iinclude/lib/sprt \
-Iinclude/lib/utils \
-Iinclude/lib/xlat_tables \
@@ -35,16 +33,6 @@ IVY_SOURCES := \
sp_helpers.c \
) \
-STDLIB_SOURCES := $(addprefix lib/stdlib/, \
- assert.c \
- mem.c \
- putchar.c \
- printf.c \
- rand.c \
- strlen.c \
- subr_prf.c \
-)
-
# TODO: Remove dependency on TFTF files.
IVY_SOURCES += \
tftf/framework/debug.c \
@@ -55,7 +43,6 @@ IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
lib/${ARCH}/misc_helpers.S \
lib/locks/${ARCH}/spinlock.S \
lib/utils/mp_printf.c \
- ${STDLIB_SOURCES} \
${SPRT_LIB_SOURCES}
IVY_LINKERFILE := spm/ivy/ivy.ld.S
diff --git a/tftf/framework/framework.mk b/tftf/framework/framework.mk
index 36b29b23e..d51a246d0 100644
--- a/tftf/framework/framework.mk
+++ b/tftf/framework/framework.mk
@@ -18,8 +18,6 @@ TFTF_INCLUDES := \
-Iinclude/lib \
-Iinclude/lib/${ARCH} \
-Iinclude/lib/extensions \
- -Iinclude/lib/stdlib \
- -Iinclude/lib/stdlib/sys \
-Iinclude/lib/utils \
-Iinclude/lib/xlat_tables \
-Iinclude/plat/common \
@@ -29,21 +27,6 @@ TFTF_INCLUDES := \
-Ispm/cactus \
-Ispm/ivy
-# Standard C library source files
-STD_LIB_SOURCES := lib/stdlib/abort.c \
- lib/stdlib/assert.c \
- lib/stdlib/mem.c \
- lib/stdlib/printf.c \
- lib/stdlib/putchar.c \
- lib/stdlib/puts.c \
- lib/stdlib/rand.c \
- lib/stdlib/strchr.c \
- lib/stdlib/strcmp.c \
- lib/stdlib/strlen.c \
- lib/stdlib/strncmp.c \
- lib/stdlib/strncpy.c \
- lib/stdlib/subr_prf.c
-
FRAMEWORK_SOURCES := ${AUTOGEN_DIR}/tests_list.c
FRAMEWORK_SOURCES += $(addprefix tftf/, \
@@ -76,7 +59,6 @@ FRAMEWORK_SOURCES += \
lib/sdei/sdei.c \
lib/smc/${ARCH}/asm_smc.S \
lib/smc/${ARCH}/smc.c \
- ${STD_LIB_SOURCES} \
lib/trusted_os/trusted_os.c \
lib/utils/mp_printf.c \
lib/utils/uuid.c \