Skip to content

Makefile updates for Arm(R) CPU targets #3064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025
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
5 changes: 5 additions & 0 deletions tensorflow/lite/micro/kernels/cmsis_nn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ CMSIS_PATH=<../path> and CMSIS_NN_PATH=<../path>. Note that both CMSIS_PATH and
since CMSIS-NN has a dependency to CMSIS-Core. As a third option CMSIS-NN can be provided manually as an external library.
The examples below will illustrate this.

# Specifying path to Cortex_DFP

The Cortex_DFP path used can be specified using an additional flag `CORTEX_DFP_PATH=<path/to>cmsis/Cortex_DFP`.
Default is the Cortex_DFP contained in the downloaded CMSIS version.

## Example - FVP based on Arm Corstone-300 software.
In this example, the kernel conv unit test is built. For more information about
this specific target, check out the [Corstone-300 readme](https://github.com/tensorflow/tflite-micro/tree/main/tensorflow/lite/micro/cortex_m_corstone_300/README.md).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
# Copyright 2025 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,6 +37,7 @@ endif
# This target has dependencies to CMSIS-Device so just in case running without OPTIMIZED_KERNEL_DIR=cmsis_nn.
CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
CORTEX_DFP_PATH := $(CMSIS_PATH)/Cortex_DFP
ifeq ($(CMSIS_PATH), $(CMSIS_DEFAULT_DOWNLOAD_PATH))
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ext_libs/cmsis_download.sh $(DOWNLOADS_DIR) $(TENSORFLOW_ROOT))
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
Expand Down Expand Up @@ -194,13 +195,11 @@ ifeq ($(CO_PROCESSOR), ethos_u)
ETHOSU_ARCH=u55
endif

CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
THIRD_PARTY_CC_SRCS += \
$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Source/system_$(ARM_CPU).c \
$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Source/startup_$(ARM_CPU).c
$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Source/system_$(ARM_CPU).c \
$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Source/startup_$(ARM_CPU).c
INCLUDES += \
-I$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Include \
-I$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Include \
-I$(CMSIS_PATH)/CMSIS/Core/Include

# TODO(#274): Examine why some tests fail here.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
# Copyright 2025 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
# Needed in case running without OPTIMIZED_KERNEL_DIR=cmsis_nn.
CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
CORTEX_DFP_PATH := $(CMSIS_PATH)/Cortex_DFP
ifeq ($(CMSIS_PATH), $(CMSIS_DEFAULT_DOWNLOAD_PATH))
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ext_libs/cmsis_download.sh $(DOWNLOADS_DIR) $(TENSORFLOW_ROOT))
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
Expand Down Expand Up @@ -108,10 +109,8 @@ endif

# Dependency to CMSIS-Device for DWT/PMU counters.
ARM_CPU := "ARMC$(CORE)"
CMSIS_DEFAULT_DOWNLOAD_PATH := $(MAKEFILE_DIR)/downloads/cmsis
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
INCLUDES += \
-I$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Include \
-I$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Include \
-I$(CMSIS_PATH)/CMSIS/Core/Include

ifneq ($(filter cortex-m55%,$(TARGET_ARCH)),)
Expand Down