Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,7 +18,7 @@
# Set the minimum required version of CMake for the project
cmake_minimum_required(VERSION 3.21)

project(bsa-acs LANGUAGES)
project(sysarch-acs LANGUAGES)

# cmake_policy
cmake_policy(SET CMP0001 NEW)
Expand All @@ -29,7 +29,6 @@ get_filename_component(ROOT_DIR . ABSOLUTE)

# Set internal build directory variable
set(BUILD ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "Setting build directory to ${BUILD}" FORCE)
file(MAKE_DIRECTORY ${BUILD}/output/)

# Set global compile list variable
set(COMPILE_LIST "")
Expand Down Expand Up @@ -133,9 +132,9 @@ option(TARGET_SIMULATION "Enable simulation/emulation optimizations (defines TAR
if(TARGET_SIMULATION)
message(STATUS "[ACS] : TARGET_SIMULATION is enabled (defining TARGET_SIMULATION)")
add_compile_definitions(TARGET_SIMULATION)
else()
else()
message(STATUS "[ACS] : TARGET_SIMULATION is disabled")
endif()
endif()

# Include the files for make clean
foreach(clean_item ${CLEAN_LIST})
Expand Down Expand Up @@ -165,20 +164,11 @@ add_custom_target(acs_all
DEPENDS ${ACS_LIST}
)

message(STATUS "[ACS] : ACS is set to ${ACS}, and TAREGT to ${TARGET} based on configuration")
message(STATUS "[ACS] : ACS is set to ${ACS}, and TARGET to ${TARGET} based on configuration")
message(STATUS "[ACS] : You can change overide target using -DTARGET=<value>")
message(STATUS "[ACS] : Supported values for TARGET: ${TARGET_LIST}")
message(STATUS "[ACS] : Example - cmake --preset bsa -DTARGET=RDV3")
message(STATUS "[ACS] : Check available presets by - `cmake --list-presets`")
message(STATUS "[ACS] : To build using cmake - `cmake --build --preset bsa`")
message(STATUS "[ACS] : To build using make - `cmake --preset acs_all; cd build; make bsa` (to build all baremetal acs - `make acs_all`)")
add_subdirectory(${ROOT_DIR}/tools/cmake/infra)


### Throw waring for the files which is not compiled ###

# list(REMOVE_DUPLICATES COMPILE_LIST)
# execute_process(COMMAND python ${ROOT_DIR}/tools/scripts/compile_check.py "${COMPILE_LIST}" "${ROOT_DIR}" "${TARGET}" OUTPUT_VARIABLE NOT_COMPILED_FILES)
# if(NOT ${NOT_COMPILED_FILES} MATCHES NULL)
# message(WARNING "Following files are not compiled ${NOT_COMPILED_FILES}")
# endif()
5 changes: 2 additions & 3 deletions pal/baremetal/pal.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,8 +22,7 @@
)

#Create compile list files
list(APPEND COMPILE_LIST ${PAL_SRC})
set(COMPILE_LIST ${COMPILE_LIST} PARENT_SCOPE)
acs_append_compile_list(${PAL_SRC})

# Create PAL library
add_library(${PAL_LIB} STATIC ${PAL_SRC})
Expand Down
5 changes: 2 additions & 3 deletions test_pool/test.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -92,8 +92,7 @@ endforeach()
add_library(${TEST_LIB} STATIC ${TEST_SRC})

#Create compile list files
list(APPEND COMPILE_LIST ${TEST_SRC})
set(COMPILE_LIST ${COMPILE_LIST} PARENT_SCOPE)
acs_append_compile_list(${TEST_SRC})

target_include_directories(${TEST_LIB} PRIVATE ${TEST_INCLUDE}
)
Expand Down
7 changes: 4 additions & 3 deletions tools/cmake/infra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,11 +15,12 @@
# limitations under the License.
##

project(bsa LANGUAGES C ASM)
project(sysarch LANGUAGES C ASM)

set(VAL_LIB ${ACS}_val_lib)
set(PAL_LIB ${ACS}_pal_lib)
include(${ROOT_DIR}/val/val_${ACS}.cmake)
include(${ROOT_DIR}/val/val.cmake)
acs_add_val_library_for_acs(${ACS})

include(${ROOT_DIR}/pal/baremetal/pal.cmake)
include(${ROOT_DIR}/test_pool/test.cmake)
19 changes: 6 additions & 13 deletions tools/cmake/toolchain/linker.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023-2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -39,18 +39,11 @@ function (create_executable EXE_NAME OUTPUT_DIR TEST)
set(SCATTER_INPUT_FILE "${ROOT_DIR}/tools/cmake/infra/${EXE_NAME}_image.ld.S")
set(SCATTER_OUTPUT_FILE "${OUTPUT_DIR}/${EXE_NAME}_image.ld")

if(ACS MATCHES "sbsa")
# Preprocess the scatter file for image layout symbols
add_custom_command(OUTPUT CPP-LD--${EXE_NAME}${TEST}
COMMAND ${CROSS_COMPILE}gcc -E -P -I${ROOT_DIR}/apps/baremetal/ -I${ROOT_DIR}/pal/baremetal/target/${TARGET}/include -I${ROOT_DIR} ${SCATTER_INPUT_FILE} -o ${SCATTER_OUTPUT_FILE} -DCMAKE_BUILD={CMAKE_BUILD}
DEPENDS ${VAL_LIB} ${PAL_LIB} ${TEST_LIB})
add_custom_target(CPP-LD-${EXE_NAME}${TEST} ALL DEPENDS CPP-LD--${EXE_NAME}${TEST})
elseif(ACS MATCHES "bsa")
add_custom_command(OUTPUT CPP-LD--${EXE_NAME}${TEST}
COMMAND ${CROSS_COMPILE}gcc -E -P -I${ROOT_DIR}/apps/baremetal/ -I${ROOT_DIR}/pal/baremetal/target/${TARGET}/include -I${ROOT_DIR} ${SCATTER_INPUT_FILE} -o ${SCATTER_OUTPUT_FILE} -DCMAKE_BUILD={CMAKE_BUILD}
DEPENDS ${VAL_LIB} ${PAL_LIB} ${TEST_LIB})
add_custom_target(CPP-LD-${EXE_NAME}${TEST} ALL DEPENDS CPP-LD--${EXE_NAME}${TEST})
endif()
add_custom_command(OUTPUT CPP-LD--${EXE_NAME}${TEST}
COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT_DIR}
COMMAND ${CROSS_COMPILE}gcc -E -P -I${ROOT_DIR}/apps/baremetal/ -I${ROOT_DIR}/pal/baremetal/target/${TARGET}/include -I${ROOT_DIR} ${SCATTER_INPUT_FILE} -o ${SCATTER_OUTPUT_FILE} -DCMAKE_BUILD={CMAKE_BUILD}
DEPENDS ${VAL_LIB} ${PAL_LIB} ${TEST_LIB})
add_custom_target(CPP-LD-${EXE_NAME}${TEST} ALL DEPENDS CPP-LD--${EXE_NAME}${TEST})

# Link the objects
add_custom_command(OUTPUT ${EXE_NAME}${TEST}.elf
Expand Down
7 changes: 6 additions & 1 deletion tools/cmake/toolchain/utils.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2023, 2025, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2023, 2025-2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -26,3 +26,8 @@ function(_get_sub_dir_list result parent_dir)
endforeach()
set(${result} ${dir_list} PARENT_SCOPE)
endfunction(_get_sub_dir_list)

function(acs_append_compile_list)
list(APPEND COMPILE_LIST ${ARGN})
set(COMPILE_LIST ${COMPILE_LIST} PARENT_SCOPE)
endfunction(acs_append_compile_list)
73 changes: 0 additions & 73 deletions tools/scripts/compile_check.py

This file was deleted.

126 changes: 126 additions & 0 deletions val/val.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
## @file
# Copyright (c) 2026, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

include_guard()

function(acs_add_val_library)
set(options)
set(oneValueArgs)
set(multiValueArgs REMOVE_SOURCES EXTRA_DEFS)
cmake_parse_arguments(VAL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

file(GLOB VAL_SRC
"${ROOT_DIR}/val/src/AArch64/*.S"
"${ROOT_DIR}/val/src/AArch64/*.h"
"${ROOT_DIR}/val/include/*.h"
"${ROOT_DIR}/val/src/*.c"
"${ROOT_DIR}/val/driver/pcie/*.h"
"${ROOT_DIR}/val/driver/pcie/*.c"
"${ROOT_DIR}/val/driver/smmu_v3/*.h"
"${ROOT_DIR}/val/driver/smmu_v3/*.c"
"${ROOT_DIR}/val/driver/gic/*.h"
"${ROOT_DIR}/val/driver/gic/*.c"
"${ROOT_DIR}/val/driver/gic/AArch64/*.S"
"${ROOT_DIR}/val/driver/gic/its/*.h"
"${ROOT_DIR}/val/driver/gic/its/*.c"
"${ROOT_DIR}/val/driver/gic/v2/*.h"
"${ROOT_DIR}/val/driver/gic/v2/*.c"
"${ROOT_DIR}/val/driver/gic/v3/*.h"
"${ROOT_DIR}/val/driver/gic/v3/*.c"
"${ROOT_DIR}/val/driver/gic/v3/AArch64/*.S"
"${ROOT_DIR}/apps/baremetal/*.h"
"${ROOT_DIR}/apps/baremetal/*.c"
)

if(VAL_REMOVE_SOURCES)
list(REMOVE_ITEM VAL_SRC ${VAL_REMOVE_SOURCES})
endif()
list(REMOVE_DUPLICATES VAL_SRC)

acs_append_compile_list(${VAL_SRC})

add_library(${VAL_LIB} STATIC ${VAL_SRC})

# Define COMPILE_RB_EXE for gating few compilations in val for rule based
# execution infra.
target_compile_definitions(${VAL_LIB} PRIVATE COMPILE_RB_EXE ${VAL_EXTRA_DEFS})

target_include_directories(${VAL_LIB} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
${ROOT_DIR}/
${ROOT_DIR}/val
${ROOT_DIR}/val/include/
${ROOT_DIR}/val/src/AArch64/
${ROOT_DIR}/val/driver/smmu_v3/
${ROOT_DIR}/val/driver/gic/
${ROOT_DIR}/val/driver/gic/its/
${ROOT_DIR}/val/driver/gic/v2/
${ROOT_DIR}/val/driver/gic/v3/
${ROOT_DIR}/apps/baremetal/
${ROOT_DIR}/pal/baremetal/target/${TARGET}/include/
)

unset(VAL_SRC)
endfunction()

## @brief Add VAL library sources/defs/includes for a specific ACS variant.
#
# @param ACS_NAME One of: bsa, sbsa, pc_bsa.
#
function(acs_add_val_library_for_acs ACS_NAME)
set(common_remove_sources
"${ROOT_DIR}/val/src/AArch64/Drtm.S"
"${ROOT_DIR}/val/src/acs_pfdi.c"
"${ROOT_DIR}/val/src/drtm_execute_test.c"
"${ROOT_DIR}/val/src/mpam_execute_test.c"
"${ROOT_DIR}/val/src/pfdi_execute_test.c"
)
if(ACS_NAME STREQUAL "bsa")
list(APPEND remove_sources
"${ROOT_DIR}/apps/baremetal/sbsa_main.c"
"${ROOT_DIR}/apps/baremetal/pc_bsa_main.c"
"${ROOT_DIR}/val/src/sbsa_execute_test.c"
"${ROOT_DIR}/val/src/pc_bsa_execute_test.c"
)
list(APPEND remove_sources ${common_remove_sources})
list(APPEND extra_defs BAREMETAL_BSA_BUILD)
elseif(ACS_NAME STREQUAL "sbsa")
list(APPEND remove_sources
"${ROOT_DIR}/apps/baremetal/bsa_main.c"
"${ROOT_DIR}/apps/baremetal/pc_bsa_main.c"
"${ROOT_DIR}/val/src/bsa_execute_test.c"
"${ROOT_DIR}/val/src/pc_bsa_execute_test.c"
)
list(APPEND remove_sources ${common_remove_sources})
elseif(ACS_NAME STREQUAL "pc_bsa")
list(APPEND remove_sources
"${ROOT_DIR}/apps/baremetal/bsa_main.c"
"${ROOT_DIR}/apps/baremetal/sbsa_main.c"
"${ROOT_DIR}/val/src/bsa_execute_test.c"
"${ROOT_DIR}/val/src/sbsa_execute_test.c"
)
list(APPEND remove_sources ${common_remove_sources})
list(APPEND extra_defs BAREMETAL_PCBSA_BUILD)
else()
message(FATAL_ERROR "Unsupported ACS value for val library: ${ACS_NAME}")
endif()

acs_add_val_library(
REMOVE_SOURCES ${remove_sources}
EXTRA_DEFS ${extra_defs}
)
endfunction()
Loading