summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/cmsis-pack-gen/use-case-api.yml20
-rw-r--r--scripts/cmake/common_user_options.cmake169
-rw-r--r--scripts/cmake/configuration_options/cmsis_opts.cmake41
-rw-r--r--scripts/cmake/configuration_options/common_opts.cmake65
-rw-r--r--scripts/cmake/configuration_options/fvp_test_opts.cmake36
-rw-r--r--scripts/cmake/configuration_options/npu_opts.cmake91
-rw-r--r--scripts/cmake/configuration_options/options-preset.json (renamed from scripts/cmake/options-preset.json)0
-rw-r--r--scripts/cmake/platforms/mps3/build_configuration.cmake34
-rw-r--r--scripts/cmake/platforms/mps3/sse-310/mps3-sse-310.ld4
-rw-r--r--scripts/cmake/platforms/mps4/build_configuration.cmake126
-rw-r--r--scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.ld222
-rw-r--r--scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.sct154
-rw-r--r--scripts/cmake/platforms/native/build_configuration.cmake6
-rw-r--r--scripts/cmake/platforms/platforms-preset.json19
-rw-r--r--scripts/cmake/platforms/simple_platform/build_configuration.cmake18
-rw-r--r--scripts/cmake/source_gen_utils.cmake23
-rw-r--r--scripts/cmake/tensorflow_lite_micro.cmake (renamed from scripts/cmake/tensorflow.cmake)9
-rw-r--r--scripts/cmake/util_functions.cmake14
-rw-r--r--scripts/mps4/sse-315/images.txt19
-rw-r--r--scripts/py/requirements.txt2
20 files changed, 849 insertions, 223 deletions
diff --git a/scripts/cmake/cmsis-pack-gen/use-case-api.yml b/scripts/cmake/cmsis-pack-gen/use-case-api.yml
index c526566..4aa6095 100644
--- a/scripts/cmake/cmsis-pack-gen/use-case-api.yml
+++ b/scripts/cmake/cmsis-pack-gen/use-case-api.yml
@@ -1,7 +1,7 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/packgen/schema/manifest.schema.json
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,7 @@
# packgen and packchk must be installed. See https://github.com/Open-CMSIS-Pack/devtools
# on how to build these tools.
#
-# yaml-language-server: $schema=https://github.com/Open-CMSIS-Pack/devtools/blob/tools/toolbox/1.0.0/tools/packgen/schema/manifest.schema.json
+# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/tools/projmgr/2.4.0/tools/packgen/schema/manifest.schema.json
#
build:
- name: "build-dir"
@@ -44,22 +44,20 @@ packs:
description: "ML sample use case APIs derived from ml-embedded-eval-kit"
vendor: "ARM"
license: "LICENSE_APACHE_2.0.txt"
- url: "https://git.mlplatform.org/ml/ethos-u/ml-embedded-evaluation-kit.git/plain/source/application/api/use_case/readme.md"
+ url: "https://git.mlplatform.org/ml/ethos-u/ml-embedded-evaluation-kit.git/plain/resources/cmsis-packs/"
requirements:
packages:
- - attributes: {vendor: "tensorflow", name: "tensorflow-lite-micro", version: "1.22.8"}
+ - attributes: {vendor: "tensorflow", name: "tensorflow-lite-micro", version: "1.23.2"}
- attributes: {vendor: "ARM", name: "CMSIS", version: "5.9.0"}
- - attributes: {vendor: "ARM", name: "CMSIS-DSP", version: "1.14.4"}
+ - attributes: {vendor: "ARM", name: "CMSIS-DSP", version: "1.15.0"}
- attributes: {vendor: "ARM", name: "CMSIS-NN", version: "4.0.0"}
releases:
- version: "23.2.0"
- date: "2023-03-23"
+ date: "2024-05-21"
description: "23.02.0 release package"
- - version: "22.11.0"
- date: "2022-11-09"
- description: "22.11.0 release package"
+ url: "https://git.mlplatform.org/ml/ethos-u/ml-embedded-evaluation-kit.git/plain/resources/cmsis-packs/ARM.ml-embedded-eval-kit-uc-api.23.2.0.pack?h=refs/heads/main"
- version: "22.8.0-Beta"
date: "2022-09-29"
description: "Beta release package"
@@ -75,8 +73,8 @@ packs:
attributes: { Cclass: "ML Eval Kit", Cgroup: "Common", Csub: "Log", Cversion: "1.0.0" }
description: "Logging header-only utility"
files:
- - name: "source/log/include/"
- attributes: {category: include}
+ - name: "source/log/include/log_macros.h"
+ attributes: {category: header}
- name: arm_math
target: arm_math
diff --git a/scripts/cmake/common_user_options.cmake b/scripts/cmake/common_user_options.cmake
deleted file mode 100644
index 97e9b40..0000000
--- a/scripts/cmake/common_user_options.cmake
+++ /dev/null
@@ -1,169 +0,0 @@
-#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
-# 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.
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# This file should contain all the common user options for the application
-# For use case specific options, see individual usecase.cmake files under
-# each example use case.
-#----------------------------------------------------------------------------
-
-if (NOT DEFINED USER_OPTIONS_INCLUDED)
- set(USER_OPTIONS_INCLUDED ON)
-else()
- return()
-endif()
-
-message(STATUS "Assessing common user options...")
-
-include(${CMAKE_CURRENT_LIST_DIR}/util_functions.cmake)
-
-USER_OPTION(LOG_LEVEL "Log level for the application"
- LOG_LEVEL_INFO
- STRING)
-
-USER_OPTION(TENSORFLOW_SRC_PATH "Path to the root of the tensor flow directory"
- "${DEPENDENCY_ROOT_DIR}/tensorflow"
- PATH)
-
-USER_OPTION(TARGET_PLATFORM "Target platform to execute evaluation application: mps3, simple_platform, native"
- mps3
- STRING)
-
-USER_OPTION(TARGET_SUBSYSTEM "Specify platform target subsystem: sse-300, sse-310 or none"
- sse-300
- STRING)
-
-if (TARGET_PLATFORM STREQUAL native)
- set(NPU_AVAILABLE OFF)
-else()
- set(NPU_AVAILABLE ON)
-endif()
-
-USER_OPTION(ETHOS_U_NPU_ENABLED "If Arm Ethos-U NPU is enabled in the target system."
- ${NPU_AVAILABLE}
- BOOL)
-
-USER_OPTION(USE_CASE_BUILD "Optional. Defines the use-case to build from the available sources. By default, all use-cases are built."
- all
- STRING)
-
-USER_OPTION(CPU_PROFILE_ENABLED "Output CPU performance profiling information. Should be used only for MPS3 board."
- OFF
- BOOL)
-
-USER_OPTION(TENSORFLOW_LITE_MICRO_BUILD_TYPE "TensorFlow Lite Mirco build type (release/debug etc.)"
- $<IF:$<CONFIG:RELEASE>,release_with_logs,debug>
- STRING)
-
-USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS "Select if TPIP downloads should be cleaned before each build."
- OFF
- BOOL)
-
-USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_BUILD "Select if clean target should be added to a list of targets"
- ON
- BOOL)
-
-USER_OPTION(USE_SINGLE_INPUT "Select if a use case should execute using a default known input file"
- OFF
- BOOL)
-
-if (NOT TARGET_PLATFORM STREQUAL native)
-
- USER_OPTION(CMSIS_SRC_PATH
- "Path to CMSIS-5 sources"
- "${DEPENDENCY_ROOT_DIR}/cmsis"
- PATH)
- USER_OPTION(CMSIS_DSP_SRC_PATH
- "Path to CMSIS-5 DSP sources"
- "${DEPENDENCY_ROOT_DIR}/cmsis-dsp"
- PATH)
- USER_OPTION(CMSIS_NN_SRC_PATH
- "Path to CMSIS-5 NN sources"
- "${DEPENDENCY_ROOT_DIR}/cmsis-nn"
- PATH)
-
- # If we need NPU libraries:
- if (ETHOS_U_NPU_ENABLED)
- USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH
- "Path to Ethos-U NPU timing adapter sources"
- "${DEPENDENCY_ROOT_DIR}/core-platform/drivers/timing_adapter"
- PATH
- )
-
- USER_OPTION(ETHOS_U_NPU_DRIVER_SRC_PATH
- "Path to Ethos-U NPU core driver sources"
- "${DEPENDENCY_ROOT_DIR}/core-driver"
- PATH
- )
-
- USER_OPTION(ETHOS_U_NPU_ID "Arm Ethos-U NPU IP (U55 or U65)"
- "U55"
- STRING)
-
- if ((ETHOS_U_NPU_ID STREQUAL U55) OR (ETHOS_U_NPU_ID STREQUAL U65))
- if (ETHOS_U_NPU_ID STREQUAL U55)
- set(DEFAULT_NPU_MEM_MODE "Shared_Sram")
- set(DEFAULT_NPU_CONFIG_ID "H128")
- elseif(ETHOS_U_NPU_ID STREQUAL U65)
- set(DEFAULT_NPU_MEM_MODE "Dedicated_Sram")
- set(DEFAULT_NPU_CONFIG_ID "Y256")
- set(DEFAULT_NPU_CACHE_SIZE "393216")
-
- USER_OPTION(ETHOS_U_NPU_CACHE_SIZE "Arm Ethos-U65 NPU Cache Size"
- "${DEFAULT_NPU_CACHE_SIZE}"
- STRING)
- endif()
- else ()
- message(FATAL_ERROR "Non compatible Ethos-U NPU processor ${ETHOS_U_NPU_ID}")
- endif ()
-
- USER_OPTION(ETHOS_U_NPU_MEMORY_MODE "Specifies the memory mode used in the Vela command."
- "${DEFAULT_NPU_MEM_MODE}"
- STRING)
-
- USER_OPTION(ETHOS_U_NPU_CONFIG_ID "Specifies the configuration ID for the NPU."
- "${DEFAULT_NPU_CONFIG_ID}"
- STRING)
-
- if (ETHOS_U_NPU_ID STREQUAL U55)
- set(DEFAULT_TA_CONFIG_FILE_PATH "${CMAKE_CURRENT_LIST_DIR}/timing_adapter/ta_config_u55_high_end.cmake")
- else ()
- set(DEFAULT_TA_CONFIG_FILE_PATH "${CMAKE_CURRENT_LIST_DIR}/timing_adapter/ta_config_u65_high_end.cmake")
- endif ()
-
- USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_ENABLED "Specifies if the Ethos-U timing adapter is enabled"
- ON
- BOOL)
-
- if (ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
- USER_OPTION(TA_CONFIG_FILE "Path to the timing adapter configuration file"
- ${DEFAULT_TA_CONFIG_FILE_PATH}
- FILEPATH)
- endif()
-
- USER_OPTION(BUILD_FVP_TESTS "Build tests for CTest driven FVP runs for built applications"
- OFF
- BOOL)
-
- if (BUILD_FVP_TESTS)
- USER_OPTION(FVP_PATH "Path to FVP for verifying execution"
- ""
- FILEPATH)
- endif()
-
- endif()
-endif()
diff --git a/scripts/cmake/configuration_options/cmsis_opts.cmake b/scripts/cmake/configuration_options/cmsis_opts.cmake
new file mode 100644
index 0000000..8da8c05
--- /dev/null
+++ b/scripts/cmake/configuration_options/cmsis_opts.cmake
@@ -0,0 +1,41 @@
+#----------------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
+# 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.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# CMSIS configuration options
+#----------------------------------------------------------------------------
+include_guard()
+
+include(util_functions)
+
+message(STATUS "Assessing CMSIS configuration options...")
+
+USER_OPTION(CMSIS_SRC_PATH
+ "Path to CMSIS-5 sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/cmsis"
+ PATH)
+
+USER_OPTION(CMSIS_DSP_SRC_PATH
+ "Path to CMSIS-5 DSP sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/cmsis-dsp"
+ PATH)
+
+USER_OPTION(CMSIS_NN_SRC_PATH
+ "Path to CMSIS-5 NN sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/cmsis-nn"
+ PATH)
diff --git a/scripts/cmake/configuration_options/common_opts.cmake b/scripts/cmake/configuration_options/common_opts.cmake
new file mode 100644
index 0000000..2c620c2
--- /dev/null
+++ b/scripts/cmake/configuration_options/common_opts.cmake
@@ -0,0 +1,65 @@
+#----------------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
+# 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.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# This file should contain all the common user options for the application
+# For use case specific options, see individual usecase.cmake files under
+# each example use case.
+#----------------------------------------------------------------------------
+include_guard()
+
+message(STATUS "Assessing common user options...")
+
+include(util_functions)
+
+USER_OPTION(LOG_LEVEL "Log level for the application"
+ LOG_LEVEL_INFO
+ STRING)
+
+## TensorFlow options
+USER_OPTION(TENSORFLOW_SRC_PATH "Path to the root of the TensorFlow Lite Micro sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/tensorflow"
+ PATH)
+
+USER_OPTION(TENSORFLOW_LITE_MICRO_BUILD_TYPE "TensorFlow Lite Mirco build type (release/debug etc.)"
+ $<IF:$<CONFIG:RELEASE>,release_with_logs,debug>
+ STRING)
+
+USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_DOWNLOADS "Select if TPIP downloads should be cleaned before each build."
+ OFF
+ BOOL)
+
+USER_OPTION(TENSORFLOW_LITE_MICRO_CLEAN_BUILD "Select if clean target should be added to a list of targets"
+ ON
+ BOOL)
+
+USER_OPTION(TARGET_PLATFORM "Target platform to build for: mps3, mps4, simple_platform and native"
+ mps3
+ STRING)
+
+USER_OPTION(USE_CASE_BUILD "Optional. Defines the use-case to build from the available sources. By default, all use-cases are built."
+ all
+ STRING)
+
+USER_OPTION(CPU_PROFILE_ENABLED "Output CPU performance profiling information. Should be used only for MPS3 board."
+ OFF
+ BOOL)
+
+USER_OPTION(USE_SINGLE_INPUT "Select if a use case should execute using a default known input file"
+ OFF
+ BOOL)
diff --git a/scripts/cmake/configuration_options/fvp_test_opts.cmake b/scripts/cmake/configuration_options/fvp_test_opts.cmake
new file mode 100644
index 0000000..91e8588
--- /dev/null
+++ b/scripts/cmake/configuration_options/fvp_test_opts.cmake
@@ -0,0 +1,36 @@
+#----------------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
+# 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.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# FVP test configuration options
+#----------------------------------------------------------------------------
+include_guard()
+
+include(util_functions)
+
+message(STATUS "Assessing FVP test configuration options...")
+
+USER_OPTION(BUILD_FVP_TESTS "Build tests for CTest driven FVP runs for built applications"
+ OFF
+ BOOL)
+
+if (BUILD_FVP_TESTS)
+ USER_OPTION(FVP_PATH "Path to FVP for verifying execution"
+ ""
+ FILEPATH)
+endif() \ No newline at end of file
diff --git a/scripts/cmake/configuration_options/npu_opts.cmake b/scripts/cmake/configuration_options/npu_opts.cmake
new file mode 100644
index 0000000..c947ac9
--- /dev/null
+++ b/scripts/cmake/configuration_options/npu_opts.cmake
@@ -0,0 +1,91 @@
+#----------------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
+# 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.
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# NPU configuration user options
+#----------------------------------------------------------------------------
+include_guard()
+
+include(util_functions)
+
+USER_OPTION(ETHOS_U_NPU_ENABLED "If Arm Ethos-U NPU is enabled in the target system."
+ ON
+ BOOL)
+
+if (NOT ETHOS_U_NPU_ENABLED)
+ return()
+endif()
+
+message(STATUS "Assessing NPU configuration options...")
+
+USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_SRC_PATH
+ "Path to Ethos-U NPU timing adapter sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/core-platform/drivers/timing_adapter"
+ PATH
+)
+
+USER_OPTION(ETHOS_U_NPU_DRIVER_SRC_PATH
+ "Path to Ethos-U NPU core driver sources"
+ "${MLEK_DEPENDENCY_ROOT_DIR}/core-driver"
+ PATH
+)
+
+USER_OPTION(ETHOS_U_NPU_ID "Arm Ethos-U NPU IP (U55 or U65)"
+ "U55"
+ STRING)
+
+if ((ETHOS_U_NPU_ID STREQUAL U55) OR (ETHOS_U_NPU_ID STREQUAL U65))
+ if (ETHOS_U_NPU_ID STREQUAL U55)
+ set(DEFAULT_NPU_MEM_MODE "Shared_Sram")
+ set(DEFAULT_NPU_CONFIG_ID "H128")
+ elseif(ETHOS_U_NPU_ID STREQUAL U65)
+ set(DEFAULT_NPU_MEM_MODE "Dedicated_Sram")
+ set(DEFAULT_NPU_CONFIG_ID "Y256")
+ set(DEFAULT_NPU_CACHE_SIZE "393216")
+
+ USER_OPTION(ETHOS_U_NPU_CACHE_SIZE "Arm Ethos-U65 NPU Cache Size"
+ "${DEFAULT_NPU_CACHE_SIZE}"
+ STRING)
+ endif()
+else ()
+ message(FATAL_ERROR "Non compatible Ethos-U NPU processor ${ETHOS_U_NPU_ID}")
+endif ()
+
+USER_OPTION(ETHOS_U_NPU_MEMORY_MODE "Specifies the memory mode used in the Vela command."
+ "${DEFAULT_NPU_MEM_MODE}"
+ STRING)
+
+USER_OPTION(ETHOS_U_NPU_CONFIG_ID "Specifies the configuration ID for the NPU."
+ "${DEFAULT_NPU_CONFIG_ID}"
+ STRING)
+
+if (ETHOS_U_NPU_ID STREQUAL U55)
+ set(DEFAULT_TA_CONFIG_FILE "ta_config_u55_high_end")
+else ()
+ set(DEFAULT_TA_CONFIG_FILE "ta_config_u65_high_end")
+endif ()
+
+USER_OPTION(ETHOS_U_NPU_TIMING_ADAPTER_ENABLED "Specifies if the Ethos-U timing adapter is enabled"
+ ON
+ BOOL)
+
+if (ETHOS_U_NPU_TIMING_ADAPTER_ENABLED)
+ USER_OPTION(TA_CONFIG_FILE "Path to the timing adapter configuration file"
+ ${DEFAULT_TA_CONFIG_FILE}
+ STRING)
+endif()
diff --git a/scripts/cmake/options-preset.json b/scripts/cmake/configuration_options/options-preset.json
index 57b7a7d..57b7a7d 100644
--- a/scripts/cmake/options-preset.json
+++ b/scripts/cmake/configuration_options/options-preset.json
diff --git a/scripts/cmake/platforms/mps3/build_configuration.cmake b/scripts/cmake/platforms/mps3/build_configuration.cmake
index 1743253..c29531f 100644
--- a/scripts/cmake/platforms/mps3/build_configuration.cmake
+++ b/scripts/cmake/platforms/mps3/build_configuration.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,7 +17,22 @@
#----------------------------------------------------------------------------
function(set_platform_global_defaults)
- message(STATUS "Platform: MPS3 FPGA Prototyping Board or FVP")
+ message(STATUS "Platform: Arm MPS3 FPGA Prototyping Board or FVP")
+
+ # Set default subsystem for MPS3:
+ USER_OPTION(TARGET_SUBSYSTEM "Specify platform target subsystem: sse-300 or sse-310"
+ sse-300
+ STRING)
+
+ # Default NPU for SSE-300 target:
+ USER_OPTION(ETHOS_U_NPU_ID "Arm Ethos-U NPU IP (U55 or U65)"
+ "U55"
+ STRING)
+
+ # Include NPU, FVP tests and CMSIS configuration options
+ include(npu_opts)
+ include(fvp_test_opts)
+ include(cmsis_opts)
if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
if (TARGET_SUBSYSTEM STREQUAL sse-300)
@@ -27,7 +43,7 @@ function(set_platform_global_defaults)
endif()
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
+ set(CMAKE_TOOLCHAIN_FILE ${MLEK_CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
CACHE FILEPATH "Toolchain file")
endif()
@@ -40,7 +56,7 @@ function(set_platform_global_defaults)
endif()
set(LINKER_SCRIPT_NAME "mps3-${TARGET_SUBSYSTEM}" PARENT_SCOPE)
- set(PLATFORM_DRIVERS_DIR "${HAL_PLATFORM_DIR}/mps3" PARENT_SCOPE)
+ set(PLATFORM_DRIVERS_DIR "${MLEK_HAL_PLATFORM_DIR}/mps3" PARENT_SCOPE)
endfunction()
@@ -61,13 +77,13 @@ function(platform_custom_post_build)
# Add link options for the linker script to be used:
add_linker_script(
- ${PARSED_TARGET_NAME} # Target
- ${CMAKE_SCRIPTS_DIR}/platforms/mps3/${TARGET_SUBSYSTEM} # Directory path
- ${LINKER_SCRIPT_NAME}) # Name of the file without suffix
+ ${PARSED_TARGET_NAME} # Target
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${TARGET_SUBSYSTEM} # Directory path
+ ${LINKER_SCRIPT_NAME}) # Name of the file without suffix
add_target_map_file(
- ${PARSED_TARGET_NAME}
- ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.map)
+ ${PARSED_TARGET_NAME}
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.map)
set(SECTORS_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sectors)
set(SECTORS_BIN_DIR ${SECTORS_DIR}/${use_case})
diff --git a/scripts/cmake/platforms/mps3/sse-310/mps3-sse-310.ld b/scripts/cmake/platforms/mps3/sse-310/mps3-sse-310.ld
index 085be99..0b6ad79 100644
--- a/scripts/cmake/platforms/mps3/sse-310/mps3-sse-310.ld
+++ b/scripts/cmake/platforms/mps3/sse-310/mps3-sse-310.ld
@@ -1,5 +1,5 @@
/*
- * SPDX-FileCopyrightText: Copyright 2021, 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-FileCopyrightText: Copyright 2021, 2023-2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,8 +22,8 @@ __HEAP_SIZE = 0x000C0000;
MEMORY
{
ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00008000
- DTCM (rwx) : ORIGIN = 0x30000000, LENGTH = 0x00008000
BRAM (rwx) : ORIGIN = 0x11000000, LENGTH = 0x00200000
+ DTCM (rwx) : ORIGIN = 0x30000000, LENGTH = 0x00008000
SRAM (rwx) : ORIGIN = 0x31000000, LENGTH = 0x00400000
DDR (rwx) : ORIGIN = 0x70000000, LENGTH = 0x02000000
diff --git a/scripts/cmake/platforms/mps4/build_configuration.cmake b/scripts/cmake/platforms/mps4/build_configuration.cmake
new file mode 100644
index 0000000..6ea34ef
--- /dev/null
+++ b/scripts/cmake/platforms/mps4/build_configuration.cmake
@@ -0,0 +1,126 @@
+#----------------------------------------------------------------------------
+# SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
+# 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.
+#----------------------------------------------------------------------------
+
+function(set_platform_global_defaults)
+ message(STATUS "Platform: Arm MPS4 FPGA Prototyping Board or FVP")
+
+ # Default sub-system for MPS4
+ USER_OPTION(TARGET_SUBSYSTEM "Specify platform target subsystem: sse-315"
+ sse-315
+ STRING)
+
+ # Default NPU for SSE-315 target:
+ USER_OPTION(ETHOS_U_NPU_ID "Arm Ethos-U NPU IP (U55 or U65)"
+ "U65"
+ STRING)
+
+ # Include NPU, FVP tests and CMSIS configuration options
+ include(npu_opts)
+ include(fvp_test_opts)
+ include(cmsis_opts)
+
+ if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
+ if(TARGET_SUBSYSTEM STREQUAL sse-315)
+ set(CMAKE_SYSTEM_PROCESSOR cortex-m85 CACHE STRING "Cortex-M CPU to use")
+ else()
+ message(FATAL_ERROR "${TARGET_SUBSYSTEM} unsupported by ${TARGET_PLATFORM}")
+ endif()
+ endif()
+
+ if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
+ set(CMAKE_TOOLCHAIN_FILE ${MLEK_CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
+ CACHE FILEPATH "Toolchain file")
+ endif()
+
+ # Arm Corstone-315's timing adapter behaviour is very different to Arm Corstone-300 and cannot
+ # be used for bandwidth/latency related performance sweeps for the Arm Ethos-U NPU. Read
+ # docs/sections/timing_adapters.md for more details.
+ if ((TARGET_SUBSYSTEM STREQUAL "sse-315") AND (DEFINED ETHOS_U_NPU_TIMING_ADAPTER_ENABLED))
+ message(STATUS "Timing adapter will NOT be used for target subsystem ${TARGET_SUBSYSTEM}")
+ set(ETHOS_U_NPU_TIMING_ADAPTER_ENABLED OFF CACHE BOOL "Use of TA" FORCE)
+ endif()
+
+ set(LINKER_SCRIPT_NAME "mps4-${TARGET_SUBSYSTEM}" PARENT_SCOPE)
+ set(PLATFORM_DRIVERS_DIR "${MLEK_HAL_PLATFORM_DIR}/mps4" PARENT_SCOPE)
+
+endfunction()
+
+function(platform_custom_post_build)
+ set(oneValueArgs TARGET_NAME)
+ cmake_parse_arguments(PARSED "" "${oneValueArgs}" "" ${ARGN} )
+
+ set_target_properties(${PARSED_TARGET_NAME} PROPERTIES SUFFIX ".axf")
+
+ # Add link options for the linker script to be used:
+ add_linker_script(
+ ${PARSED_TARGET_NAME} # Target
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${TARGET_SUBSYSTEM} # Directory path
+ ${LINKER_SCRIPT_NAME}) # Name of the file without suffix
+
+ add_target_map_file(
+ ${PARSED_TARGET_NAME}
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.map)
+
+ set(SECTORS_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sectors)
+ set(SECTORS_BIN_DIR ${SECTORS_DIR}/${use_case})
+
+ file(REMOVE_RECURSE ${SECTORS_BIN_DIR})
+ file(MAKE_DIRECTORY ${SECTORS_BIN_DIR})
+
+ if (TARGET_SUBSYSTEM STREQUAL sse-315)
+ set(LINKER_SECTION_TAGS "*.at_boot" "*.at_bram" "*.at_ddr")
+ set(LINKER_OUTPUT_BIN_TAGS "boot.bin" "bram.bin" "ddr.bin")
+ endif()
+
+ add_bin_generation_command(
+ TARGET_NAME ${PARSED_TARGET_NAME}
+ OUTPUT_DIR ${SECTORS_BIN_DIR}
+ AXF_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.axf
+ SECTION_PATTERNS "${LINKER_SECTION_TAGS}"
+ OUTPUT_BIN_NAMES "${LINKER_OUTPUT_BIN_TAGS}")
+
+ set(MPS4_FPGA_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/scripts/mps4/${TARGET_SUBSYSTEM}/images.txt")
+
+ add_custom_command(TARGET ${PARSED_TARGET_NAME}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${MPS4_FPGA_CONFIG} ${SECTORS_DIR})
+
+ # Add tests for application on FVP if FVP path specified
+ if (BUILD_FVP_TESTS)
+
+ # Build for all use cases if USE_SINGLE_INPUT as no telnet interaction required
+ # otherwise only build for inference runner
+ if ((USE_SINGLE_INPUT) OR (${use_case} STREQUAL "inference_runner"))
+ set(AXF_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.axf")
+ set(TEST_TARGET_NAME "${use_case}_fvp_test")
+
+ message(STATUS "Adding FVP test for ${use_case}")
+
+ add_test(
+ NAME "${TEST_TARGET_NAME}"
+ COMMAND ${FVP_PATH} -a ${AXF_PATH}
+ -C mps4_board.telnetterminal0.start_telnet=0
+ -C mps4_board.uart0.out_file='-'
+ -C mps4_board.uart0.shutdown_on_eot=1
+ -C mps4_board.visualisation.disable-visualisation=1
+ -C vis_hdlcd.disable_visualisation=1
+ --stat)
+ endif()
+ endif ()
+
+endfunction()
diff --git a/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.ld b/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.ld
new file mode 100644
index 0000000..a5647f9
--- /dev/null
+++ b/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.ld
@@ -0,0 +1,222 @@
+/*
+ * SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * 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.
+ */
+
+__STACK_SIZE = 0x00008000;
+__HEAP_SIZE = 0x000C0000;
+
+/* System memory brief */
+MEMORY
+{
+ ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00008000
+ BOOT (rx) : ORIGIN = 0x11000000, LENGTH = 0x00010000
+ BRAM (rwx) : ORIGIN = 0x12000000, LENGTH = 0x00200000
+ DTCM (rwx) : ORIGIN = 0x30000000, LENGTH = 0x00008000
+ SRAM (rwx) : ORIGIN = 0x31000000, LENGTH = 0x00400000
+ DDR (rwx) : ORIGIN = 0x70000000, LENGTH = 0x02000000
+
+ /* Dynamic load regions declared for use by FVP only
+ * These regions are mentioned in the CMake subsystem profile.
+ * Do not change the addresses here in isolation. */
+ DDR_dynamic_model (rx) : ORIGIN = 0x90000000, LENGTH = 0x02000000
+ DDR_dynamic_ifm (rx) : ORIGIN = 0x92000000, LENGTH = 0x01000000
+ DDR_dynamic_ofm (rx) : ORIGIN = 0x93000000, LENGTH = 0x01000000
+}
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions ITCM and RAM.
+ * It references following symbols, which must be defined in code:
+ * Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ * __exidx_start
+ * __exidx_end
+ * __copy_table_start__
+ * __copy_table_end__
+ * __zero_table_start__
+ * __zero_table_end__
+ * __etext
+ * __data_start__
+ * __preinit_array_start
+ * __preinit_array_end
+ * __init_array_start
+ * __init_array_end
+ * __fini_array_start
+ * __fini_array_end
+ * __data_end__
+ * __bss_start__
+ * __bss_end__
+ * __end__
+ * end
+ * __HeapLimit
+ * __StackLimit
+ * __StackTop
+ * __stack
+ */
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+ .text.at_boot :
+ {
+ KEEP(*(.vectors))
+ } > BOOT AT > BOOT
+
+ .text.at_bram :
+ {
+ *(.text*)
+
+ KEEP(*(.init))
+ KEEP(*(.fini))
+
+ /* .ctors */
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT(.ctors.*))
+ *(.ctors)
+
+ /* .dtors */
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT(.dtors.*))
+ *(.dtors)
+
+ KEEP(*(.eh_frame*))
+
+ *(vtable)
+ *(.data)
+ *(.data.*)
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP(*(.preinit_array))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP(*(SORT(.fini_array.*)))
+ KEEP(*(.fini_array))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ KEEP(*(.jcr*))
+ . = ALIGN(4);
+
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ . = ALIGN(4);
+
+ *(.rodata*)
+ . = ALIGN(4);
+ * (npu_driver_version)
+ . = ALIGN(4);
+ * (npu_driver_arch_version)
+ . = ALIGN(4);
+
+ __copy_table_start__ = .;
+ . = ALIGN(4);
+ __copy_table_end__ = .;
+ } > BRAM
+
+ __exidx_start = .;
+ .ARM.exidx.at_bram :
+ {
+ *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+ } > BRAM
+ __exidx_end = .;
+
+ .sram :
+ {
+ . = ALIGN(16);
+ /* Cache area (if used) */
+ *(.bss.NoInit.ethos_u_cache)
+ . = ALIGN (16);
+ /* activation buffers a.k.a tensor arena when memory mode sram only or shared sram */
+ *(.bss.NoInit.activation_buf_sram)
+ . = ALIGN(16);
+ } > SRAM AT > SRAM
+
+ .bss :
+ {
+ . = ALIGN(4);
+ __bss_start__ = .;
+ *(.bss)
+ *(.bss.*)
+ *(COMMON)
+ . = ALIGN(4);
+ __bss_end__ = .;
+ } > BRAM
+
+ .zero.table.at_bram :
+ {
+ . = ALIGN(4);
+ __zero_table_start__ = .;
+
+ LONG (__bss_start__)
+ LONG ((__bss_end__ - __bss_start__)/4) /* Size is in 32-bit words */
+
+ __zero_table_end__ = .;
+ } > BRAM
+
+ .heap (COPY) :
+ {
+ . = ALIGN(8);
+ __end__ = .;
+ PROVIDE(end = .);
+ . = . + __HEAP_SIZE;
+ . = ALIGN(8);
+ __HeapLimit = .;
+ } > BRAM
+
+ __bram_total = ALIGN(4);
+
+ ASSERT( __bram_total < (ORIGIN(BRAM) + LENGTH(BRAM)), "BRAM overflow")
+
+ .stack (ORIGIN(DTCM) + LENGTH(DTCM) - __STACK_SIZE) (COPY) :
+ {
+ . = ALIGN(8);
+ __StackLimit = .;
+ . = . + __STACK_SIZE;
+ . = ALIGN(8);
+ __StackTop = .;
+ } > DTCM
+ PROVIDE(__stack = __StackTop);
+ ASSERT(__STACK_SIZE <= LENGTH(DTCM), "DTCM overflow")
+
+ .ddr.at_ddr :
+ {
+ /* __attribute__((aligned(16))) is not handled by the CMSIS startup code.
+ * Force the alignment here as a workaround */
+ . = ALIGN(16);
+ /* nn model's baked in input matrices */
+ *(ifm)
+ . = ALIGN(16);
+ /* nn model's default space */
+ *(nn_model)
+ . = ALIGN (16);
+ /* labels */
+ *(labels)
+ . = ALIGN (16);
+ *Labels*.obj (*.rodata*)
+ . = ALIGN (16);
+ /* activation buffers a.k.a tensor arena when memory mode dedicated sram */
+ *(activation_buf_dram)
+ . = ALIGN (16);
+ } > DDR AT > DDR
+
+}
diff --git a/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.sct b/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.sct
new file mode 100644
index 0000000..35b5904
--- /dev/null
+++ b/scripts/cmake/platforms/mps4/sse-315/mps4-sse-315.sct
@@ -0,0 +1,154 @@
+; SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
+; 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.
+
+; *************************************************************
+; *** Scatter-Loading Description File ***
+; *************************************************************
+; Please see docs/sections/appendix.md for memory mapping
+; information.
+;
+; Note: Ethos-U NPU can access BRAM, internal SRAM and the DDR
+; sections => activation buffers and the model should
+; only be placed in those regions.
+;
+
+;---------------------------------------------------------
+; First load region (SRAM) 64KiB boot region
+;---------------------------------------------------------
+LOAD_REGION_0 0x11000000 0x00010000
+{
+ ;-----------------------------------------------------
+ ; 64K boot ROM. Our vector table also
+ ; resides here as the default INITSVTOR is 0x11000000.
+ ; We currently do not use the ITCM for any code, but
+ ; could potentially put some critical code in there
+ ; if we need to.
+ ;-----------------------------------------------------
+ boot.bin 0x11000000 0x00010000
+ {
+ *.o (RESET, +First)
+ *(InRoot$$Sections)
+ }
+}
+
+;---------------------------------------------------------
+; Second load region (FPGA SRAM) 2MiB region
+;---------------------------------------------------------
+LOAD_REGION_1 0X12000000 0x00200000
+{
+ ;-----------------------------------------------------
+ ; First 640K of SRAM/BRAM region for RO code,
+ ; 8 byte aligned.
+ ;-----------------------------------------------------
+ bram.bin 0x12000000 ALIGN 8 0x000A0000
+ {
+ ; Essentially only RO (code)
+ .ANY (+RO)
+ }
+
+ ;-----------------------------------------------------
+ ; Next 384K of SRAM/BRAM region for RW and ZI
+ ; data, 8 byte aligned.
+ ;-----------------------------------------------------
+ data.bin 0x120A0000 ALIGN 8 0x00060000
+ {
+ ; Any RO-DATA
+ .ANY (+RO-DATA)
+
+ ; Any R/W and/or zero initialised data
+ .ANY(+RW +ZI)
+ }
+
+ ;-----------------------------------------------------
+ ; 768 KiB of remaining part of the 1MiB BRAM used as
+ ; heap space.
+ ;-----------------------------------------------------
+ ARM_LIB_HEAP 0x12100000 EMPTY ALIGN 8 0x000C0000
+ {}
+
+ ;-----------------------------------------------------
+ ; 32 kiB of stack space occupying the DTCM region.
+ ;-----------------------------------------------------
+ ARM_LIB_STACK 0x30000000 EMPTY ALIGN 8 0x00008000
+ {}
+
+ ;-----------------------------------------------------
+ ; FPGA internal SRAM of 2MiB - reserved for activation
+ ; buffers. The total memory is 4 MiB (we are choosing
+ ; to not use the other bank). This region should have
+ ; 3 cycle read latency from both CPU and Ethos-U NPU.
+ ;-----------------------------------------------------
+ isram.bin 0x31000000 UNINIT ALIGN 16 0x00200000
+ {
+ ; Cache area (if used)
+ *.o (.bss.NoInit.ethos_u_cache)
+
+ ; activation buffers a.k.a tensor arena when
+ ; memory mode sram only or shared sram
+ *.o (.bss.NoInit.activation_buf_sram)
+ }
+}
+
+;---------------------------------------------------------
+; Third load region (DDR)
+;---------------------------------------------------------
+LOAD_REGION_2 0x70000000 0x02000000
+{
+ ;-----------------------------------------------------
+ ; 32 MiB of DDR space for neural network model,
+ ; input vectors and labels. If the activation buffer
+ ; size required by the network is bigger than the
+ ; SRAM size available, it is accommodated here.
+ ;-----------------------------------------------------
+ ddr.bin 0x70000000 ALIGN 16 0x02000000
+ {
+ ; nn model's baked in input matrices
+ *.o (ifm)
+
+ ; nn model's default space
+ *.o (nn_model)
+
+ ; labels
+ *.o (labels)
+ Labels.o (+RO-DATA)
+
+ ; activation buffers a.k.a tensor arena when memory mode dedicated sram
+ *.o (activation_buf_dram)
+ }
+
+ ;-----------------------------------------------------
+ ; The following regions are for use by the FVP to
+ ; allow loading or dumping of dynamic data into or
+ ; from the memory. These regions are mentioned in
+ ; the CMake subsystem profile. Do not change the
+ ; addresses and sizes below in isolation.
+ ;-----------------------------------------------------
+ ; 32 MiB of model space for run-time load of model
+ ;-----------------------------------------------------
+ runtime_model 0x90000000 EMPTY ALIGN 16 0x02000000
+ {}
+
+ ;-----------------------------------------------------
+ ; 16 MiB of IFM space for run-time loading (FVP only)
+ ;-----------------------------------------------------
+ runtime_ifm 0x92000000 EMPTY ALIGN 16 0x01000000
+ {}
+
+ ;-----------------------------------------------------
+ ; 16 MiB of OFM space for run-time loading (FVP only)
+ ;-----------------------------------------------------
+ runtime_ofm 0x93000000 EMPTY ALIGN 16 0x01000000
+ {}
+}
diff --git a/scripts/cmake/platforms/native/build_configuration.cmake b/scripts/cmake/platforms/native/build_configuration.cmake
index 0519ec1..81e572e 100644
--- a/scripts/cmake/platforms/native/build_configuration.cmake
+++ b/scripts/cmake/platforms/native/build_configuration.cmake
@@ -18,11 +18,11 @@
function(set_platform_global_defaults)
message(STATUS "Platform: Native (Linux based x86_64/aarch64 system)")
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_DIR}/native-gcc.cmake
+ set(CMAKE_TOOLCHAIN_FILE ${MLEK_CMAKE_TOOLCHAIN_DIR}/native-gcc.cmake
CACHE FILEPATH "Toolchain file")
endif()
- set(PLATFORM_DRIVERS_DIR "${HAL_PLATFORM_DIR}/native" PARENT_SCOPE)
- set(TEST_TPIP ${DOWNLOAD_DEP_DIR}/test)
+ set(PLATFORM_DRIVERS_DIR "${MLEK_HAL_PLATFORM_DIR}/native" PARENT_SCOPE)
+ set(TEST_TPIP ${MLEK_DOWNLOAD_DEP_DIR}/test)
file(MAKE_DIRECTORY ${TEST_TPIP})
set(TEST_TPIP_INCLUDE ${TEST_TPIP}/include)
diff --git a/scripts/cmake/platforms/platforms-preset.json b/scripts/cmake/platforms/platforms-preset.json
index 7a96d7a..b38739c 100644
--- a/scripts/cmake/platforms/platforms-preset.json
+++ b/scripts/cmake/platforms/platforms-preset.json
@@ -8,7 +8,7 @@
"configurePresets": [
{
"name": "mps3-300-platform",
- "description": "Target mps3 board, SSE-300 subsystem.",
+ "description": "Target MPS3 board, SSE-300 subsystem.",
"hidden": true,
"cacheVariables": {
"TARGET_PLATFORM": {
@@ -23,7 +23,7 @@
},
{
"name": "mps3-310-platform",
- "description": "Target mps3 board, SSE-310 subsystem.",
+ "description": "Target MPS3 board, SSE-310 subsystem.",
"hidden": true,
"cacheVariables": {
"TARGET_PLATFORM": {
@@ -37,6 +37,21 @@
}
},
{
+ "name": "mps4-315-platform",
+ "description": "Target MPS4 board, SSE-315 subsystem.",
+ "hidden": true,
+ "cacheVariables": {
+ "TARGET_PLATFORM": {
+ "type": "STRING",
+ "value": "mps4"
+ },
+ "TARGET_SUBSYSTEM": {
+ "type": "STRING",
+ "value": "sse-315"
+ }
+ }
+ },
+ {
"name": "simple-platform",
"description": "Target simple platform.",
"hidden": true,
diff --git a/scripts/cmake/platforms/simple_platform/build_configuration.cmake b/scripts/cmake/platforms/simple_platform/build_configuration.cmake
index 3536c5b..72e1260 100644
--- a/scripts/cmake/platforms/simple_platform/build_configuration.cmake
+++ b/scripts/cmake/platforms/simple_platform/build_configuration.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2022-2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,13 +18,18 @@
function(set_platform_global_defaults)
message(STATUS "Platform: Simple platform with minimal peripherals")
+
+ # Include NPU and CMSIS configuration options
+ include(npu_opts)
+ include(cmsis_opts)
+
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
+ set(CMAKE_TOOLCHAIN_FILE ${MLEK_CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
CACHE FILEPATH "Toolchain file")
endif()
set(LINKER_SCRIPT_NAME "simple_platform" PARENT_SCOPE)
- set(PLATFORM_DRIVERS_DIR "${HAL_PLATFORM_DIR}/simple" PARENT_SCOPE)
+ set(PLATFORM_DRIVERS_DIR "${MLEK_HAL_PLATFORM_DIR}/simple" PARENT_SCOPE)
endfunction()
function(platform_custom_post_build)
@@ -41,9 +47,9 @@ function(platform_custom_post_build)
# Add link options for the linker script to be used:
add_linker_script(
- ${PARSED_TARGET_NAME} # Target
- ${CMAKE_SCRIPTS_DIR}/platforms/simple_platform # Directory path
- ${LINKER_SCRIPT_NAME}) # Name of the file without suffix
+ ${PARSED_TARGET_NAME} # Target
+ ${CMAKE_CURRENT_FUNCTION_LIST_DIR} # Directory path
+ ${LINKER_SCRIPT_NAME}) # Name of the file without suffix
add_target_map_file(
${PARSED_TARGET_NAME}
diff --git a/scripts/cmake/source_gen_utils.cmake b/scripts/cmake/source_gen_utils.cmake
index 6287cb6..b60c85e 100644
--- a/scripts/cmake/source_gen_utils.cmake
+++ b/scripts/cmake/source_gen_utils.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2021 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2021, 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#----------------------------------------------------------------------------
+include_guard()
+
set(SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
##############################################################################
@@ -29,7 +32,7 @@ function(generate_images_code input_dir src_out hdr_out img_size)
message(STATUS "Generating image files from ${input_dir_abs}")
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_rgb_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_rgb_cpp.py
--image_path ${input_dir_abs}
--source_folder_path ${src_out_abs}
--header_folder_path ${hdr_out_abs}
@@ -57,7 +60,7 @@ function(generate_audio_code input_dir src_out hdr_out s_rate_opt mono_opt off_o
message(STATUS "Generating audio files from ${input_dir_abs}")
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_audio_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_audio_cpp.py
--audio_path ${input_dir_abs}
--source_folder_path ${src_out_abs}
--header_folder_path ${hdr_out_abs}
@@ -86,7 +89,7 @@ function(generate_default_input_code hdr_out)
message(STATUS "Generating default input files")
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_default_input_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_default_input_cpp.py
--header_folder_path ${hdr_out_abs}
RESULT_VARIABLE return_code
)
@@ -130,7 +133,7 @@ function(generate_tflite_code)
endforeach()
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_model_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_model_cpp.py
--tflite_path ${ABS_MODEL_PATH}
--output_dir ${ABS_DESTINATION} ${py_arg_exp}
RESULT_VARIABLE return_code
@@ -173,7 +176,7 @@ function(generate_labels_code)
message(STATUS "writing to ${hdr_out_abs}/${PARSED_OUTPUT_FILENAME}.hpp and ${src_out_abs}/${PARSED_OUTPUT_FILENAME}.cc")
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_labels_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_labels_cpp.py
--labels_file ${input_abs}
--source_folder_path ${src_out_abs}
--header_folder_path ${hdr_out_abs}
@@ -238,7 +241,7 @@ function(generate_test_data_code)
message(STATUS "Generating test ifm and ofm files from ${input_dir_abs}")
execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_test_data_cpp.py
+ COMMAND ${PYTHON} ${MLEK_SCRIPTS_DIR}/py/gen_test_data_cpp.py
--data_folder_path ${input_dir_abs}
--source_folder_path ${src_out_abs}
--header_folder_path ${hdr_out_abs}
@@ -262,8 +265,8 @@ function(setup_source_generator)
# If a virtual env has been created in the resources_downloaded directory,
# use it for source generator. Else, fall back to creating a virtual env
# in the current build directory.
- if (EXISTS ${RESOURCES_DIR}/env)
- set(DEFAULT_VENV_DIR ${RESOURCES_DIR}/env)
+ if (EXISTS ${MLEK_RESOURCES_DIR}/env)
+ set(DEFAULT_VENV_DIR ${MLEK_RESOURCES_DIR}/env)
else()
set(DEFAULT_VENV_DIR ${CMAKE_BINARY_DIR}/venv)
endif()
@@ -323,7 +326,7 @@ function(setup_source_generator)
endif ()
execute_process(
- COMMAND ${PYTHON} -m pip install -r ${SCRIPTS_DIR}/py/requirements.txt
+ COMMAND ${PYTHON} -m pip install -r ${MLEK_SCRIPTS_DIR}/py/requirements.txt
RESULT_VARIABLE return_code
)
if (NOT return_code EQUAL "0")
diff --git a/scripts/cmake/tensorflow.cmake b/scripts/cmake/tensorflow_lite_micro.cmake
index 0fa0f8c..cb45274 100644
--- a/scripts/cmake/tensorflow.cmake
+++ b/scripts/cmake/tensorflow_lite_micro.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2021-2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -69,8 +70,8 @@ else()
if(ETHOS_U_NPU_ENABLED)
# Arm Ethos-U55 NPU is the co-processor for ML workload:
- set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR "ethos_u")
- set(ETHOS_U_NPU_ID "u55") # Currently only u55 is supported by TFLite Micro.
+ set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR "ethos_u")
+ set(TENSORFLOW_LITE_MICRO_CO_PROCESSOR_ARCH "u55") # Currently only u55 is supported by TFLite Micro.
endif()
set(TENSORFLOW_LITE_MICRO_OPTIMIZED_KERNEL "cmsis_nn")
@@ -114,7 +115,7 @@ add_custom_target(tensorflow_build ALL
CMSIS_PATH=${CMSIS_SRC_PATH}
CMSIS_NN_PATH=${CMSIS_NN_SRC_PATH}
# Conditional arguments
- $<$<BOOL:${ETHOS_U_NPU_ENABLED}>:ETHOSU_ARCH=${ETHOS_U_NPU_ID}>
+ $<$<BOOL:${ETHOS_U_NPU_ENABLED}>:ETHOSU_ARCH=${TENSORFLOW_LITE_MICRO_CO_PROCESSOR_ARCH}>
$<$<BOOL:${ETHOS_U_NPU_ENABLED}>:ETHOSU_DRIVER_PATH=${ETHOS_U_NPU_DRIVER_SRC_PATH}>
$<$<BOOL:${ETHOS_U_NPU_ENABLED}>:ETHOSU_DRIVER_LIBS=$<TARGET_FILE:ethosu_core_driver>>
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake
index 0567ee0..102c598 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -1,5 +1,6 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2021-2022, 2024 Arm Limited and/or its
+# affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +19,8 @@
##############################################################################
# Helper function to provide user option and corresponding default value
##############################################################################
+include_guard()
+
function(USER_OPTION name description default type)
if (${type} STREQUAL PATH_OR_FILE)
@@ -180,12 +183,11 @@ function(add_platform_build_configuration)
set(oneValueArgs TARGET_PLATFORM)
cmake_parse_arguments(PARSED "" "${oneValueArgs}" "" ${ARGN} )
message(STATUS "Searching for ${PARSED_TARGET_PLATFORM} build configuration")
- list(APPEND PLATFORM_BUILD_CONFIG_DIRS ${CMAKE_SCRIPTS_DIR}/platforms)
FIND_PATH(PLATFORM_BUILD_CONFIG
NAMES build_configuration.cmake
PATH_SUFFIXES ${PARSED_TARGET_PLATFORM}
- PATHS ${PLATFORM_BUILD_CONFIG_DIRS}
+ PATHS ${MLEK_PLATFORM_BUILD_CONFIG_DIRS}
)
message(STATUS "Found build configuration: ${PLATFORM_BUILD_CONFIG}")
@@ -196,9 +198,9 @@ function(check_update_public_resources resource_downloaded_dir)
string(JOIN "/" FILE_URL ${resource_downloaded_dir})
execute_process(
- COMMAND python3 ${SCRIPTS_DIR}/py/check_update_resources_downloaded.py
+ COMMAND python3 ${MLEK_SCRIPTS_DIR}/py/check_update_resources_downloaded.py
--resource_downloaded_dir ${resource_downloaded_dir}
- --setup_script_path ${SCRIPTS_DIR}/../set_up_default_resources.py
+ --setup_script_path ${MLEK_SCRIPTS_DIR}/../set_up_default_resources.py
RESULT_VARIABLE return_code
)
if (NOT return_code EQUAL "0")
@@ -225,4 +227,4 @@ function(set_input_file_path_user_option file_extension use_case)
${FIRST_INPUT_FILE}
PATH_OR_FILE)
endif()
-endfunction() \ No newline at end of file
+endfunction()
diff --git a/scripts/mps4/sse-315/images.txt b/scripts/mps4/sse-315/images.txt
new file mode 100644
index 0000000..ba5c45e
--- /dev/null
+++ b/scripts/mps4/sse-315/images.txt
@@ -0,0 +1,19 @@
+TITLE: Arm MPS4 FPGA prototyping board Images Configuration File
+
+[IMAGES]
+TOTALIMAGES: 3 ;Number of Images (Max: 32)
+
+IMAGE0PORT: 1
+IMAGE0ADDRESS: 0x00_1100_0000 ; Address to load into
+IMAGE0UPDATE: RAM ; Image Update:NONE/AUTO/FORCE
+IMAGE0FILE: \SOFTWARE\boot.bin ; Image/data to be loaded
+
+IMAGE1PORT: 1
+IMAGE1ADDRESS: 0x00_1200_0000 ; Address to load into
+IMAGE1UPDATE: RAM ; Image Update:NONE/AUTO/FORCE
+IMAGE1FILE: \SOFTWARE\bram.bin ; Image/data to be loaded
+
+IMAGE2PORT: 1
+IMAGE2ADDRESS: 0x00_7000_0000 ; Address to load into
+IMAGE2UPDATE: RAM ; Image Update:NONE/AUTO/FORCE
+IMAGE2FILE: \SOFTWARE\ddr.bin ; Image/data to be loaded
diff --git a/scripts/py/requirements.txt b/scripts/py/requirements.txt
index a64bcf8..1bd9d0e 100644
--- a/scripts/py/requirements.txt
+++ b/scripts/py/requirements.txt
@@ -8,7 +8,7 @@ lxml==4.9.2
MarkupSafe==2.0.1
numba==0.56.4
numpy==1.23.5
-Pillow==9.2.0
+Pillow==10.3.0
pycparser==2.20
resampy==0.4.2
scipy==1.10.1