diff options
author | Girish Pathak <girish.pathak@arm.com> | 2021-01-12 11:59:46 +0000 |
---|---|---|
committer | nicola-mazzucato-arm <42373140+nicola-mazzucato-arm@users.noreply.github.com> | 2021-03-30 11:36:49 +0100 |
commit | d35bad053306f858767ceadb3e497f04a894070a (patch) | |
tree | c4ed539fb1835b850d4697c17f0a8a452bacc2dd /arch | |
parent | e9a82fd1df1a36b65053ba646c9d1e58a16f34c7 (diff) |
cmake: Add arch/arm/armv8-a target
This change adds CMake build support for armv8-a target
Change-Id: Id63f87d4fea75137e4e631f3d5a2580a5b703098
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/CMakeLists.txt | 1 | ||||
-rw-r--r-- | arch/arm/armv8-a/Architecture.cmake | 9 | ||||
-rw-r--r-- | arch/arm/armv8-a/CMakeLists.txt | 56 | ||||
-rw-r--r-- | arch/arm/armv8-a/include/arch_system.h | 2 | ||||
-rw-r--r-- | arch/arm/armv8-a/src/arch_main.c | 10 | ||||
-rw-r--r-- | arch/arm/armv8-a/src/arch_mm.c | 2 |
6 files changed, 76 insertions, 4 deletions
diff --git a/arch/CMakeLists.txt b/arch/CMakeLists.txt index 14905f675863..88450ac2f824 100644 --- a/arch/CMakeLists.txt +++ b/arch/CMakeLists.txt @@ -6,6 +6,7 @@ # list(APPEND SCP_ARCHITECTURE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/arm/armv7-m") +list(APPEND SCP_ARCHITECTURE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/arm/armv8-a") list(APPEND SCP_ARCHITECTURE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/none/host") set(SCP_ARCHITECTURE_ "${SCP_ARCHITECTURE}") diff --git a/arch/arm/armv8-a/Architecture.cmake b/arch/arm/armv8-a/Architecture.cmake new file mode 100644 index 000000000000..dea2843de939 --- /dev/null +++ b/arch/arm/armv8-a/Architecture.cmake @@ -0,0 +1,9 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +set(SCP_ARCHITECTURE "armv8-a") +set(SCP_ARCHITECTURE_TARGET "arch-armv8a") diff --git a/arch/arm/armv8-a/CMakeLists.txt b/arch/arm/armv8-a/CMakeLists.txt new file mode 100644 index 000000000000..50d858cde6c6 --- /dev/null +++ b/arch/arm/armv8-a/CMakeLists.txt @@ -0,0 +1,56 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +add_library(arch-armv8a) + +target_include_directories( + arch-armv8a + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/lib") + +# cmake-lint: disable=E1122 + +target_sources( + arch-armv8a + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_cache_helpers.S" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_crt0.S" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_exceptions.S" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_gic.c" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_main.c" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_misc_helpers.S" + "${CMAKE_CURRENT_SOURCE_DIR}/src/arch_mm.c") + +# Force the linker to include any object files containing our implementations of +# functions that the standard library relies on. +# + +if(SCP_HAVE_NEWLIB) + target_compile_definitions(arch-armv8a PUBLIC -DUSE_NEWLIB) + target_link_options(arch-armv8a PUBLIC "LINKER:--undefined=_sbrk") +endif() + +# +# Preprocess the linker script. +# +# CMake provides the `CMAKE_C_CREATE_PREPROCESSED_SOURCE` variable, which +# describes the command line required to preprocess a C source file. This +# variable is in a format similar to this (verbatim): +# +# <CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > +# <PREPROCESSED_SOURCE> +# +# We do some processing on this variable to convert these bracket-surrounded +# names to variables we set. For example, `<DEFINES>` is replaced with +# `${CPP_DEFINES}`. We then need to do some magic to expand that string out to +# the value of the actual variable. +# + +include(SCPTargetLinkerScript) + +set(scp_lds "${CMAKE_CURRENT_SOURCE_DIR}/src/arch.ld.S") + +scp_target_linker_script(arch-armv8a "${scp_lds}") diff --git a/arch/arm/armv8-a/include/arch_system.h b/arch/arm/armv8-a/include/arch_system.h index bc13f6df77b0..d49f76af8b16 100644 --- a/arch/arm/armv8-a/include/arch_system.h +++ b/arch/arm/armv8-a/include/arch_system.h @@ -15,7 +15,7 @@ #define R_OFF (0xAAAA5555) #define R_CLEAR (0) -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__ .extern _boot_flag.extern _shutdown_request #else extern volatile uint32_t _boot_flag; diff --git a/arch/arm/armv8-a/src/arch_main.c b/arch/arm/armv8-a/src/arch_main.c index a50bf066d8e4..98a2a5a38195 100644 --- a/arch/arm/armv8-a/src/arch_main.c +++ b/arch/arm/armv8-a/src/arch_main.c @@ -6,9 +6,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include <mod_rcar_system.h> - #include <fwk_arch.h> +#include <fwk_attributes.h> #include <fwk_noreturn.h> #include <fwk_status.h> @@ -17,6 +16,11 @@ #include <stdbool.h> +FWK_WEAK int _platform_init(void *params) +{ + return FWK_SUCCESS; +} + /* * Error handler for failures that occur during early initialization. */ @@ -34,7 +38,7 @@ void arm_main(void) { int status; - rcar_system_code_copy_to_system_ram(); + _platform_init(NULL); #ifdef BUILD_MODE_DEBUG uint32_t cntv_ctl = 0; diff --git a/arch/arm/armv8-a/src/arch_mm.c b/arch/arm/armv8-a/src/arch_mm.c index e0f3aeb78616..6bab9e525ee0 100644 --- a/arch/arm/armv8-a/src/arch_mm.c +++ b/arch/arm/armv8-a/src/arch_mm.c @@ -50,6 +50,7 @@ void *_sbrk(intptr_t increment) } } +#ifndef USE_NEWLIB void *malloc(size_t size) { void *mem = _sbrk(size); @@ -69,3 +70,4 @@ void *calloc(size_t nmemb, size_t size) return mem; } +#endif
\ No newline at end of file |