Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
2ab2e57a
Commit
2ab2e57a
authored
May 24, 2017
by
danh-arm
Committed by
GitHub
May 24, 2017
Browse files
Merge pull request #941 from dp-arm/dp/clang
Allow TF to be built using clang or ARM Compiler 6
parents
e715e676
82377083
Changes
10
Show whitespace changes
Inline
Side-by-side
Makefile
View file @
2ab2e57a
...
@@ -113,6 +113,9 @@ endif
...
@@ -113,6 +113,9 @@ endif
# Toolchain
# Toolchain
################################################################################
################################################################################
HOSTCC
:=
gcc
export
HOSTCC
CC
:=
${CROSS_COMPILE}
gcc
CC
:=
${CROSS_COMPILE}
gcc
CPP
:=
${CROSS_COMPILE}
cpp
CPP
:=
${CROSS_COMPILE}
cpp
AS
:=
${CROSS_COMPILE}
gcc
AS
:=
${CROSS_COMPILE}
gcc
...
@@ -123,11 +126,21 @@ OD := ${CROSS_COMPILE}objdump
...
@@ -123,11 +126,21 @@ OD := ${CROSS_COMPILE}objdump
NM
:=
${CROSS_COMPILE}
nm
NM
:=
${CROSS_COMPILE}
nm
PP
:=
${CROSS_COMPILE}
gcc
-E
PP
:=
${CROSS_COMPILE}
gcc
-E
ASFLAGS_aarch64
=
-mgeneral-regs-only
ifeq
($(notdir $(CC)),armclang)
TF_CFLAGS_aarch64
=
-mgeneral-regs-only
-mstrict-align
TF_CFLAGS_aarch32
=
-target
arm-arm-none-eabi
-march
=
armv8-a
TF_CFLAGS_aarch64
=
-target
aarch64-arm-none-eabi
-march
=
armv8-a
else
ifneq
($(findstring clang,$(notdir $(CC))),)
TF_CFLAGS_aarch32
=
-target
armv8a-none-eabi
TF_CFLAGS_aarch64
=
-target
aarch64-elf
else
TF_CFLAGS_aarch32
=
-march
=
armv8-a
TF_CFLAGS_aarch64
=
-march
=
armv8-a
endif
TF_CFLAGS_aarch64
+=
-mgeneral-regs-only
-mstrict-align
ASFLAGS_aarch32
=
-march
=
armv8-a
ASFLAGS_aarch32
=
-march
=
armv8-a
TF_C
FLAGS_aarch
32
=
-march
=
armv8-a
AS
FLAGS_aarch
64
=
-march
=
armv8-a
CPPFLAGS
=
${DEFINES}
${INCLUDES}
-nostdinc
\
CPPFLAGS
=
${DEFINES}
${INCLUDES}
-nostdinc
\
-Wmissing-include-dirs
-Werror
-Wmissing-include-dirs
-Werror
...
@@ -135,8 +148,8 @@ ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \
...
@@ -135,8 +148,8 @@ ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \
-D__ASSEMBLY__
-ffreestanding
\
-D__ASSEMBLY__
-ffreestanding
\
-Wa
,--fatal-warnings
-Wa
,--fatal-warnings
TF_CFLAGS
+=
$(CPPFLAGS)
$
(
TF_CFLAGS_
$(ARCH)
)
\
TF_CFLAGS
+=
$(CPPFLAGS)
$
(
TF_CFLAGS_
$(ARCH)
)
\
-ffreestanding
-fno-builtin
-Wall
-std
=
c99
-Os
\
-ffreestanding
-fno-builtin
-Wall
-std
=
gnu99
\
-ffunction-sections
-fdata-sections
-Os
-ffunction-sections
-fdata-sections
LDFLAGS
+=
--fatal-warnings
-O1
LDFLAGS
+=
--fatal-warnings
-O1
LDFLAGS
+=
--gc-sections
LDFLAGS
+=
--gc-sections
...
...
docs/user-guide.md
View file @
2ab2e57a
...
@@ -74,6 +74,9 @@ The [Linaro Release Notes][Linaro Release Notes] documents which version of the
...
@@ -74,6 +74,9 @@ The [Linaro Release Notes][Linaro Release Notes] documents which version of the
compiler to use for a given Linaro Release. Also, these
compiler to use for a given Linaro Release. Also, these
[
Linaro instructions
][
Linaro SW Instructions
]
provide further guidance.
[
Linaro instructions
][
Linaro SW Instructions
]
provide further guidance.
Optionally, Trusted Firmware can be built using clang or ARM Compiler 6.
See instructions below on how to switch the default compiler.
In addition, the following optional packages and tools may be needed:
In addition, the following optional packages and tools may be needed:
*
`device-tree-compiler`
package if you need to rebuild the Flattened Device
*
`device-tree-compiler`
package if you need to rebuild the Flattened Device
...
@@ -104,6 +107,28 @@ Download the Trusted Firmware source code from Github:
...
@@ -104,6 +107,28 @@ Download the Trusted Firmware source code from Github:
export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf-
export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf-
It is possible to build Trusted Firmware using clang or ARM Compiler 6.
To do so `CC` needs to point to the clang or armclang binary. Only the
compiler is switched; the assembler and linker need to be provided by
the GNU toolchain, thus `CROSS_COMPILE` should be set as described above.
ARM Compiler 6 will be selected when the base name of the path assigned
to `CC` matches the string 'armclang'.
For AArch64 using ARM Compiler 6:
export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu-
make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all
Clang will be selected when the base name of the path assigned to `CC`
contains the string 'clang'. This is to allow both clang and clang-X.Y
to work.
For AArch64 using clang:
export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu-
make CC=<path-to-clang>/bin/clang PLAT=<platform> all
*
Change to the root directory of the Trusted Firmware source tree and build.
*
Change to the root directory of the Trusted Firmware source tree and build.
For AArch64:
For AArch64:
...
...
include/lib/aarch32/arch_helpers.h
View file @
2ab2e57a
...
@@ -36,8 +36,8 @@ static inline u_register_t read_ ## _name(void) \
...
@@ -36,8 +36,8 @@ static inline u_register_t read_ ## _name(void) \
* systems for GCC versions < 4.6. Above GCC 4.6, both Little Endian and
* systems for GCC versions < 4.6. Above GCC 4.6, both Little Endian and
* Big Endian systems generate the right instruction encoding.
* Big Endian systems generate the right instruction encoding.
*/
*/
#if !(__GNUC__ > (4) || __GNUC__ == (4) && __GNUC_MINOR__ >= (6))
#if !(
__clang__ ||
__GNUC__ > (4) || __GNUC__ == (4) && __GNUC_MINOR__ >= (6))
#error "GCC 4.6 or above is required to build AArch32 Trusted Firmware"
#error "
clang or
GCC 4.6 or above is required to build AArch32 Trusted Firmware"
#endif
#endif
#define _DEFINE_COPROCR_WRITE_FUNC_64(_name, coproc, opc1, CRm) \
#define _DEFINE_COPROCR_WRITE_FUNC_64(_name, coproc, opc1, CRm) \
...
...
lib/cpus/aarch64/cpu_helpers.S
View file @
2ab2e57a
...
@@ -259,8 +259,8 @@ func print_errata_status
...
@@ -259,8 +259,8 @@ func print_errata_status
/
*
/
*
*
Printing
errata
status
requires
atomically
testing
the
printed
flag
.
*
Printing
errata
status
requires
atomically
testing
the
printed
flag
.
*/
*/
stp
x
8
,
x30
,
[
sp
,
#-
16
]!
stp
x
19
,
x30
,
[
sp
,
#-
16
]!
mov
x
8
,
x0
mov
x
19
,
x0
/
*
/
*
*
Load
pointers
to
errata
lock
and
printed
flag
.
Call
*
Load
pointers
to
errata
lock
and
printed
flag
.
Call
...
@@ -270,8 +270,8 @@ func print_errata_status
...
@@ -270,8 +270,8 @@ func print_errata_status
ldr
x0
,
[
x1
,
#
CPU_ERRATA_LOCK
]
ldr
x0
,
[
x1
,
#
CPU_ERRATA_LOCK
]
ldr
x1
,
[
x1
,
#
CPU_ERRATA_PRINTED
]
ldr
x1
,
[
x1
,
#
CPU_ERRATA_PRINTED
]
bl
errata_needs_reporting
bl
errata_needs_reporting
mov
x1
,
x
8
mov
x1
,
x
19
ldp
x
8
,
x30
,
[
sp
],
#
16
ldp
x
19
,
x30
,
[
sp
],
#
16
cbnz
x0
,
.
Lprint
cbnz
x0
,
.
Lprint
#endif
#endif
.
Lnoprint
:
.
Lnoprint
:
...
...
plat/arm/board/common/board_arm_trusted_boot.c
View file @
2ab2e57a
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#include <tbbr_oid.h>
#include <tbbr_oid.h>
/* Weak definition may be overridden in specific platform */
/* Weak definition may be overridden in specific platform */
#pragma weak plat_match_rotpk
#pragma weak plat_get_nv_ctr
#pragma weak plat_get_nv_ctr
#pragma weak plat_set_nv_ctr
#pragma weak plat_set_nv_ctr
...
...
plat/arm/board/fvp/fvp_pm.c
View file @
2ab2e57a
...
@@ -296,8 +296,6 @@ static int fvp_node_hw_state(u_register_t target_cpu,
...
@@ -296,8 +296,6 @@ static int fvp_node_hw_state(u_register_t target_cpu,
case
ARM_PWR_LVL1
:
case
ARM_PWR_LVL1
:
ret
=
(
psysr
&
PSYSR_AFF_L1
)
?
HW_ON
:
HW_OFF
;
ret
=
(
psysr
&
PSYSR_AFF_L1
)
?
HW_ON
:
HW_OFF
;
break
;
break
;
default:
assert
(
0
);
}
}
return
ret
;
return
ret
;
...
...
plat/arm/common/arm_bl2_setup.c
View file @
2ab2e57a
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include <desc_image_load.h>
#include <desc_image_load.h>
#include <plat_arm.h>
#include <plat_arm.h>
#include <platform_def.h>
#include <platform_def.h>
#include <platform.h>
#include <string.h>
#include <string.h>
#include <utils.h>
#include <utils.h>
...
...
plat/arm/common/arm_pm.c
View file @
2ab2e57a
...
@@ -122,9 +122,11 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
...
@@ -122,9 +122,11 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
if
((
entrypoint
>=
ARM_NS_DRAM1_BASE
)
&&
(
entrypoint
<
if
((
entrypoint
>=
ARM_NS_DRAM1_BASE
)
&&
(
entrypoint
<
(
ARM_NS_DRAM1_BASE
+
ARM_NS_DRAM1_SIZE
)))
(
ARM_NS_DRAM1_BASE
+
ARM_NS_DRAM1_SIZE
)))
return
PSCI_E_SUCCESS
;
return
PSCI_E_SUCCESS
;
#ifndef AARCH32
if
((
entrypoint
>=
ARM_DRAM2_BASE
)
&&
(
entrypoint
<
if
((
entrypoint
>=
ARM_DRAM2_BASE
)
&&
(
entrypoint
<
(
ARM_DRAM2_BASE
+
ARM_DRAM2_SIZE
)))
(
ARM_DRAM2_BASE
+
ARM_DRAM2_SIZE
)))
return
PSCI_E_SUCCESS
;
return
PSCI_E_SUCCESS
;
#endif
return
PSCI_E_INVALID_ADDRESS
;
return
PSCI_E_INVALID_ADDRESS
;
}
}
...
...
tools/cert_create/Makefile
View file @
2ab2e57a
...
@@ -64,7 +64,7 @@ INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
...
@@ -64,7 +64,7 @@ INC_DIR := -I ./include -I ${PLAT_INCLUDE} -I ${OPENSSL_DIR}/include
LIB_DIR
:=
-L
${OPENSSL_DIR}
/lib
LIB_DIR
:=
-L
${OPENSSL_DIR}
/lib
LIB
:=
-lssl
-lcrypto
LIB
:=
-lssl
-lcrypto
CC
:
=
gcc
HOST
CC
?
=
gcc
.PHONY
:
all clean realclean
.PHONY
:
all clean realclean
...
@@ -75,11 +75,11 @@ ${BINARY}: ${OBJECTS} Makefile
...
@@ -75,11 +75,11 @@ ${BINARY}: ${OBJECTS} Makefile
@
echo
'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
@
echo
'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
const char platform_msg[] = "
${PLAT_MSG}
";'
|
\
const char platform_msg[] = "
${PLAT_MSG}
";'
|
\
${CC}
-c
${CFLAGS}
-xc
-
-o
src/build_msg.o
${CC}
-c
${CFLAGS}
-xc
-
-o
src/build_msg.o
${Q}${CC}
src/build_msg.o
${OBJECTS}
${LIB_DIR}
${LIB}
-o
$@
${Q}${
HOST
CC}
src/build_msg.o
${OBJECTS}
${LIB_DIR}
${LIB}
-o
$@
%.o
:
%.c
%.o
:
%.c
@
echo
" CC
$<
"
@
echo
" CC
$<
"
${Q}${CC}
-c
${CFLAGS}
${INC_DIR}
$<
-o
$@
${Q}${
HOST
CC}
-c
${CFLAGS}
${INC_DIR}
$<
-o
$@
clean
:
clean
:
$(
call
SHELL_DELETE_ALL, src/build_msg.o
${OBJECTS}
)
$(
call
SHELL_DELETE_ALL, src/build_msg.o
${OBJECTS}
)
...
...
tools/fiptool/Makefile
View file @
2ab2e57a
...
@@ -29,7 +29,7 @@ endif
...
@@ -29,7 +29,7 @@ endif
INCLUDE_PATHS
:=
-I
.
-I
../../include/tools_share
INCLUDE_PATHS
:=
-I
.
-I
../../include/tools_share
CC
:
=
gcc
HOST
CC
?
=
gcc
.PHONY
:
all clean distclean
.PHONY
:
all clean distclean
...
@@ -37,7 +37,7 @@ all: ${PROJECT} fip_create
...
@@ -37,7 +37,7 @@ all: ${PROJECT} fip_create
${PROJECT}
:
${OBJECTS} Makefile
${PROJECT}
:
${OBJECTS} Makefile
@
echo
" LD
$@
"
@
echo
" LD
$@
"
${Q}${CC}
${OBJECTS}
-o
$@
${LDLIBS}
${Q}${
HOST
CC}
${OBJECTS}
-o
$@
${LDLIBS}
@
${ECHO_BLANK_LINE}
@
${ECHO_BLANK_LINE}
@
echo
"Built
$@
successfully"
@
echo
"Built
$@
successfully"
@
${ECHO_BLANK_LINE}
@
${ECHO_BLANK_LINE}
...
@@ -48,7 +48,7 @@ fip_create: fip_create.sh
...
@@ -48,7 +48,7 @@ fip_create: fip_create.sh
%.o
:
%.c %.h Makefile
%.o
:
%.c %.h Makefile
@
echo
" CC
$<
"
@
echo
" CC
$<
"
${Q}${CC}
-c
${CPPFLAGS}
${CFLAGS}
${INCLUDE_PATHS}
$<
-o
$@
${Q}${
HOST
CC}
-c
${CPPFLAGS}
${CFLAGS}
${INCLUDE_PATHS}
$<
-o
$@
clean
:
clean
:
$(
call
SHELL_DELETE_ALL,
${PROJECT}
${OBJECTS}
fip_create
)
$(
call
SHELL_DELETE_ALL,
${PROJECT}
${OBJECTS}
fip_create
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment