Skip to content

Commit bf42f03

Browse files
Makefile updates for Arm(R) CPU targets (#3064)
Removing redundant assignments for CMSIS_PATH and adding the possibility to override Device Family Pack (DFP) path with a new CORTEX_DFP_PATH make variable. This allows flexibility in where the CMSIS and DFP sources reside. BUG=More flexible build structure
1 parent b78bb7e commit bf42f03

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

tensorflow/lite/micro/kernels/cmsis_nn/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ CMSIS_PATH=<../path> and CMSIS_NN_PATH=<../path>. Note that both CMSIS_PATH and
1616
since CMSIS-NN has a dependency to CMSIS-Core. As a third option CMSIS-NN can be provided manually as an external library.
1717
The examples below will illustrate this.
1818

19+
# Specifying path to Cortex_DFP
20+
21+
The Cortex_DFP path used can be specified using an additional flag `CORTEX_DFP_PATH=<path/to>cmsis/Cortex_DFP`.
22+
Default is the Cortex_DFP contained in the downloaded CMSIS version.
23+
1924
## Example - FVP based on Arm Corstone-300 software.
2025
In this example, the kernel conv unit test is built. For more information about
2126
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).

tensorflow/lite/micro/tools/make/targets/cortex_m_corstone_300_makefile.inc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
1+
# Copyright 2025 The TensorFlow Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ endif
3737
# This target has dependencies to CMSIS-Device so just in case running without OPTIMIZED_KERNEL_DIR=cmsis_nn.
3838
CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
3939
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
40+
CORTEX_DFP_PATH := $(CMSIS_PATH)/Cortex_DFP
4041
ifeq ($(CMSIS_PATH), $(CMSIS_DEFAULT_DOWNLOAD_PATH))
4142
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ext_libs/cmsis_download.sh $(DOWNLOADS_DIR) $(TENSORFLOW_ROOT))
4243
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
@@ -194,13 +195,11 @@ ifeq ($(CO_PROCESSOR), ethos_u)
194195
ETHOSU_ARCH=u55
195196
endif
196197

197-
CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
198-
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
199198
THIRD_PARTY_CC_SRCS += \
200-
$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Source/system_$(ARM_CPU).c \
201-
$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Source/startup_$(ARM_CPU).c
199+
$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Source/system_$(ARM_CPU).c \
200+
$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Source/startup_$(ARM_CPU).c
202201
INCLUDES += \
203-
-I$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Include \
202+
-I$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Include \
204203
-I$(CMSIS_PATH)/CMSIS/Core/Include
205204

206205
# TODO(#274): Examine why some tests fail here.

tensorflow/lite/micro/tools/make/targets/cortex_m_generic_makefile.inc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024 The TensorFlow Authors. All Rights Reserved.
1+
# Copyright 2025 The TensorFlow Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
# Needed in case running without OPTIMIZED_KERNEL_DIR=cmsis_nn.
2020
CMSIS_DEFAULT_DOWNLOAD_PATH := $(DOWNLOADS_DIR)/cmsis
2121
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
22+
CORTEX_DFP_PATH := $(CMSIS_PATH)/Cortex_DFP
2223
ifeq ($(CMSIS_PATH), $(CMSIS_DEFAULT_DOWNLOAD_PATH))
2324
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ext_libs/cmsis_download.sh $(DOWNLOADS_DIR) $(TENSORFLOW_ROOT))
2425
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
@@ -108,10 +109,8 @@ endif
108109

109110
# Dependency to CMSIS-Device for DWT/PMU counters.
110111
ARM_CPU := "ARMC$(CORE)"
111-
CMSIS_DEFAULT_DOWNLOAD_PATH := $(MAKEFILE_DIR)/downloads/cmsis
112-
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
113112
INCLUDES += \
114-
-I$(CMSIS_PATH)/Cortex_DFP/Device/$(ARM_CPU)/Include \
113+
-I$(CORTEX_DFP_PATH)/Device/$(ARM_CPU)/Include \
115114
-I$(CMSIS_PATH)/CMSIS/Core/Include
116115

117116
ifneq ($(filter cortex-m55%,$(TARGET_ARCH)),)

0 commit comments

Comments
 (0)