Merge pull request #46830 from mansnils:corstone
PiperOrigin-RevId: 357746959 Change-Id: Ia606141bae18c227676634031e2d77dc25d33058
This commit is contained in:
commit
614fdcc5be
47
tensorflow/lite/micro/cortex_m_corstone_300/README.md
Normal file
47
tensorflow/lite/micro/cortex_m_corstone_300/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
<!-- mdformat off(b/169948621#comment2) -->
|
||||
|
||||
# Running a fixed virtual platform based on Corstone-300 software
|
||||
|
||||
This target makes use of a fixed virtual platform (FVP) based on Arm Cortex-300
|
||||
based software. More info about Arm Corstone-300 software:
|
||||
https://developer.arm.com/ip-products/subsystem/corstone/corstone-300. More info
|
||||
about FVPs:
|
||||
https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms.
|
||||
|
||||
To fullfill the needed requirements it is depending the following projects:
|
||||
|
||||
- Arm Ethos-U Core Platform:
|
||||
https://review.mlplatform.org/admin/repos/ml/ethos-u/ethos-u-core-platform.
|
||||
- Arm Ethos-U Core Platform provides the linker file as well as UART and
|
||||
retarget functions.
|
||||
- CMSIS: https://github.com/ARM-software/CMSIS_5.
|
||||
- CMSIS provides startup functionality, e.g. for setting up interrupt
|
||||
handlers and clock speed.
|
||||
|
||||
# General build info
|
||||
|
||||
This target is based on the cortex_m_generic target and except that for now the
|
||||
only supported toolchain is GCC, the same general build info applies:
|
||||
tensorflow/lite/micro/cortex_m_generic/README.md.
|
||||
|
||||
Required parameters:
|
||||
|
||||
- TARGET: cortex_m_corstone_300
|
||||
- TARGET_ARCH: cortex-mXX (For all options see:
|
||||
tensorflow/lite/micro/tools/make/targets/cortex_m_corstone_300_makefile.inc)
|
||||
|
||||
# How to run
|
||||
|
||||
Note that Corstone-300 is targetted for Cortex-M55 but it is backwards
|
||||
compatible. This means one could potentially run it for example with a
|
||||
Cortex-M7. Note that the clock speed would be that of an Cortex-M55. This may
|
||||
not matter when running unit tests or for debugging.
|
||||
|
||||
Some examples:
|
||||
|
||||
```
|
||||
make -j -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=cmsis_nn TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m55 test_kernel_fully_connected_test
|
||||
make -j -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m55 test_kernel_fully_connected_test
|
||||
make -j -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=cmsis_nn TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m7+fp test_kernel_fully_connected_test
|
||||
make -j -f tensorflow/lite/micro/tools/make/Makefile TARGET=cortex_m_corstone_300 TARGET_ARCH=cortex-m3 test_kernel_fully_connected_test
|
||||
```
|
26
tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc
Normal file
26
tensorflow/lite/micro/cortex_m_corstone_300/system_setup.cc
Normal file
@ -0,0 +1,26 @@
|
||||
/* Copyright 2021 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.
|
||||
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 "tensorflow/lite/micro/system_setup.h"
|
||||
|
||||
namespace tflite {
|
||||
|
||||
extern "C" {
|
||||
void uart_init(void);
|
||||
}
|
||||
|
||||
void InitializeTarget() { uart_init(); }
|
||||
|
||||
} // namespace tflite
|
48
tensorflow/lite/micro/testing/test_with_arm_corstone_300.sh
Executable file
48
tensorflow/lite/micro/testing/test_with_arm_corstone_300.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash -e
|
||||
# Copyright 2021 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.
|
||||
# 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.
|
||||
# ==============================================================================
|
||||
#
|
||||
#
|
||||
# Parameters:
|
||||
# ${1} - path to a binary to test or directory (all *_test will be run).
|
||||
# ${2} - String that is checked for pass/fail.
|
||||
# ${3} - target (e.g. cortex_m_generic.)
|
||||
|
||||
set -e
|
||||
|
||||
BINARY_TO_TEST=${1}
|
||||
PASS_STRING=${2}
|
||||
TARGET=${3}
|
||||
|
||||
RESULTS_DIRECTORY=/tmp/${TARGET}_logs
|
||||
MICRO_LOG_FILENAME=${RESULTS_DIRECTORY}/logs.txt
|
||||
mkdir -p ${RESULTS_DIRECTORY}
|
||||
|
||||
FVP="FVP_Corstone_SSE-300_Ethos-U55 "
|
||||
FVP+="--cpulimit 1 "
|
||||
FVP+="-C mps3_board.visualisation.disable-visualisation=1 "
|
||||
FVP+="-C mps3_board.telnetterminal0.start_telnet=0 "
|
||||
FVP+='-C mps3_board.uart0.out_file="-" '
|
||||
FVP+='-C mps3_board.uart0.unbuffered_output=1'
|
||||
${FVP} ${BINARY_TO_TEST} | tee ${MICRO_LOG_FILENAME}
|
||||
|
||||
if grep -q "$PASS_STRING" ${MICRO_LOG_FILENAME}
|
||||
then
|
||||
echo "$BINARY_TO_TEST: PASS"
|
||||
exit 0
|
||||
else
|
||||
echo "$BINARY_TO_TEST: FAIL - '$PASS_STRING' not found in logs."
|
||||
exit 1
|
||||
fi
|
37
tensorflow/lite/micro/tools/ci_build/test_cortex_m_corstone_300.sh
Executable file
37
tensorflow/lite/micro/tools/ci_build/test_cortex_m_corstone_300.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2020 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.
|
||||
# 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.
|
||||
# ==============================================================================
|
||||
#
|
||||
# Tests Arm Cortex-M55 microprocessor code with CMSIS-NN optimizied kernels using FVP based on Arm Corstone-300 software.
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR=${SCRIPT_DIR}/../../../../..
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
|
||||
|
||||
TARGET=cortex_m_corstone_300
|
||||
TARGET_ARCH=cortex-m55
|
||||
OPTIMIZED_KERNEL_DIR=cmsis_nn
|
||||
|
||||
# TODO(b/143715361): downloading first to allow for parallel builds.
|
||||
readable_run make -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} third_party_downloads
|
||||
|
||||
# Avoid running tests in parallel.
|
||||
readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
|
||||
readable_run make -j -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} build
|
||||
readable_run make -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} test
|
70
tensorflow/lite/micro/tools/make/corstone_300_download.sh
Executable file
70
tensorflow/lite/micro/tools/make/corstone_300_download.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2021 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.
|
||||
# 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.
|
||||
# ==============================================================================
|
||||
#
|
||||
# Called with following arguments:
|
||||
# 1 - Path to the downloads folder which is typically
|
||||
# tensorflow/lite/micro/tools/make/downloads
|
||||
#
|
||||
# This script is called from the Makefile and uses the following convention to
|
||||
# enable determination of sucess/failure:
|
||||
#
|
||||
# - If the script is successful, the only output on stdout should be SUCCESS.
|
||||
# The makefile checks for this particular string.
|
||||
#
|
||||
# - Any string on stdout that is not SUCCESS will be shown in the makefile as
|
||||
# the cause for the script to have failed.
|
||||
#
|
||||
# - Any other informational prints should be on stderr.
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR=${SCRIPT_DIR}/../../../../..
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
source tensorflow/lite/micro/tools/make/bash_helpers.sh
|
||||
|
||||
DOWNLOADS_DIR=${1}
|
||||
if [ ! -d ${DOWNLOADS_DIR} ]; then
|
||||
echo "The top-level downloads directory: ${DOWNLOADS_DIR} does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOWNLOADED_CORSTONE_PATH=${DOWNLOADS_DIR}/corstone300
|
||||
|
||||
if [ -d ${DOWNLOADED_CORSTONE_PATH} ]; then
|
||||
echo >&2 "${DOWNLOADED_CORSTONE_PATH} already exists, skipping the download."
|
||||
else
|
||||
UNAME_S=`uname -s`
|
||||
if [ ${UNAME_S} == Linux ]; then
|
||||
CORSTONE_URL=https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-300/FVP_Corstone_SSE-300_Ethos-U55_11.12_57.tgz
|
||||
EXPECTED_MD5=08cc89b02a41917c2224f390f3ac0b47
|
||||
else
|
||||
echo "OS type ${UNAME_S} not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMPFILE=$(mktemp -d)/temp_file
|
||||
wget ${CORSTONE_URL} -O ${TEMPFILE} >&2
|
||||
check_md5 ${TEMPFILE} ${EXPECTED_MD5}
|
||||
|
||||
TEMPDIR=$(mktemp -d)
|
||||
tar -C ${TEMPDIR} -xvzf ${TEMPFILE} >&2
|
||||
mkdir ${DOWNLOADED_CORSTONE_PATH}
|
||||
${TEMPDIR}/FVP_Corstone_SSE-300_Ethos-U55.sh --i-agree-to-the-contained-eula --no-interactive -d ${DOWNLOADED_CORSTONE_PATH} >&2
|
||||
fi
|
||||
|
||||
echo "SUCCESS"
|
80
tensorflow/lite/micro/tools/make/ethos_u_core_platform_download.sh
Executable file
80
tensorflow/lite/micro/tools/make/ethos_u_core_platform_download.sh
Executable file
@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2021 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.
|
||||
# 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.
|
||||
# ==============================================================================
|
||||
#
|
||||
# Called with following arguments:
|
||||
# 1 - Path to the downloads folder which is typically
|
||||
# tensorflow/lite/micro/tools/make/downloads
|
||||
#
|
||||
# This script is called from the Makefile and uses the following convention to
|
||||
# enable determination of sucess/failure:
|
||||
#
|
||||
# - If the script is successful, the only output on stdout should be SUCCESS.
|
||||
# The makefile checks for this particular string.
|
||||
#
|
||||
# - Any string on stdout that is not SUCCESS will be shown in the makefile as
|
||||
# the cause for the script to have failed.
|
||||
#
|
||||
# - Any other informational prints should be on stderr.
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR=${SCRIPT_DIR}/../../../../..
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
source tensorflow/lite/micro/tools/make/bash_helpers.sh
|
||||
|
||||
DOWNLOADS_DIR=${1}
|
||||
if [ ! -d ${DOWNLOADS_DIR} ]; then
|
||||
echo "The top-level downloads directory: ${DOWNLOADS_DIR} does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH=${DOWNLOADS_DIR}/ethos_u_core_platform
|
||||
|
||||
if [ -d ${DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH} ]; then
|
||||
echo >&2 "${DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH} already exists, skipping the download."
|
||||
else
|
||||
UNAME_S=`uname -s`
|
||||
if [ ${UNAME_S} == Linux ]; then
|
||||
ETHOS_U_CORE_PLATFORM_URL=https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git/snapshot/ethos-u-core-platform-6663630bb3feea222fd38278a962297c08d0b320.tar.gz
|
||||
EXPECTED_MD5=11683ce5cbf4e4d1003ca93a85ad0b08
|
||||
else
|
||||
echo "OS type ${UNAME_S} not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMPFILE=$(mktemp -d)/temp_file
|
||||
wget ${ETHOS_U_CORE_PLATFORM_URL} -O ${TEMPFILE} >&2
|
||||
check_md5 ${TEMPFILE} ${EXPECTED_MD5}
|
||||
|
||||
mkdir ${DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH}
|
||||
tar xzf ${TEMPFILE} --strip-components=1 -C ${DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH} >&2
|
||||
|
||||
# Run C preprocessor on linker file to get rid of ifdefs and make sure compiler is downloaded first.
|
||||
COMPILER=${DOWNLOADS_DIR}/gcc_embedded/bin/arm-none-eabi-gcc
|
||||
if [ ! -f ${COMPILER} ]; then
|
||||
RETURN_VALUE=`./tensorflow/lite/micro/tools/make/arm_gcc_download.sh ${DOWNLOADS_DIR}`
|
||||
if [ "SUCCESS" != "${RETURN_VALUE}" ]; then
|
||||
echo "The script ./tensorflow/lite/micro/tools/make/arm_gcc_download.sh failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
LINKER_PATH=${DOWNLOADED_ETHOS_U_CORE_PLATFORM_PATH}/targets/corstone-300
|
||||
${COMPILER} -E -x c -P -o ${LINKER_PATH}/platform_parsed.ld ${LINKER_PATH}/platform.ld
|
||||
fi
|
||||
|
||||
echo "SUCCESS"
|
@ -49,9 +49,9 @@ if [ -d ${DOWNLOADED_CMSIS_PATH} ]; then
|
||||
echo >&2 "${DOWNLOADED_CMSIS_PATH} already exists, skipping the download."
|
||||
else
|
||||
|
||||
ZIP_PREFIX="01f5b32badf7b78c85a24a7149b56400fa6a2999"
|
||||
ZIP_PREFIX="71627bc91534ed9eec2361c0ef6442cd057653e0"
|
||||
CMSIS_URL="http://github.com/ARM-software/CMSIS_5/archive/${ZIP_PREFIX}.zip"
|
||||
CMSIS_MD5="823916c6f1749c65fd0bfdeec20b30ed"
|
||||
CMSIS_MD5="207c49970758c663e2ce1cc0245972a9"
|
||||
|
||||
# wget is much faster than git clone of the entire repo. So we wget a specific
|
||||
# version and can then apply a patch, as needed.
|
||||
|
@ -13,7 +13,7 @@ endif
|
||||
# Unless an external path is provided we force a download during the first phase of make so
|
||||
# that the files exist prior to the call to recursive_find below. add_third_party_download
|
||||
# prevents the use of wildcards and recursive_find in selecting which files to add to THIRD_PARTY_SRCS.
|
||||
ETHOSU_DEFAULT_DOWNLOAD_DRIVER_PATH := $(MAKEFILE_DIR)/downloads/ethosu
|
||||
ETHOSU_DEFAULT_DOWNLOAD_DRIVER_PATH := $(MAKEFILE_DIR)/downloads/ethos_u_core_driver
|
||||
ETHOSU_DRIVER_PATH := $(ETHOSU_DEFAULT_DOWNLOAD_DRIVER_PATH)
|
||||
ifeq ($(ETHOSU_DRIVER_PATH), $(ETHOSU_DEFAULT_DOWNLOAD_DRIVER_PATH))
|
||||
$(call $(or $(shell $(DOWNLOAD_SCRIPT) $(ETHOSU_URL) $(ETHOSU_MD5) $(ETHOSU_DRIVER_PATH) >&2 && echo SUCCESS), $(error $(DOWNLOAD_SCRIPT) failed)))
|
||||
|
@ -0,0 +1,169 @@
|
||||
# ARM Cortex M makefile targeted for a FVP based on Arm Corstone-300 software.
|
||||
# For more info see: tensorflow/lite/micro/cortex_m_corstone_300/README.md
|
||||
|
||||
export PATH := $(MAKEFILE_DIR)/downloads/corstone300/models/Linux64_GCC-6.4:$(PATH)
|
||||
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/corstone_300_download.sh ${MAKEFILE_DIR}/downloads)
|
||||
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
|
||||
$(error Something went wrong with the Arm Corstone-300 software download: $(DOWNLOAD_RESULT))
|
||||
endif
|
||||
|
||||
ETHOS_U_CORE_PLATFORM := ${PWD}/$(MAKEFILE_DIR)/downloads/ethos_u_core_platform/targets/corstone-300
|
||||
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ethos_u_core_platform_download.sh ${MAKEFILE_DIR}/downloads)
|
||||
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
|
||||
$(error Something went wrong with the Ethos-U Core Platform software download: $(DOWNLOAD_RESULT))
|
||||
endif
|
||||
|
||||
# This target has dependencies to CMSIS-Device so just in case running without OPTIMIZED_KERNEL_DIR=cmsis_nn.
|
||||
CMSIS_DEFAULT_DOWNLOAD_PATH := $(MAKEFILE_DIR)/downloads/cmsis
|
||||
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
|
||||
ifeq ($(CMSIS_PATH), $(CMSIS_DEFAULT_DOWNLOAD_PATH))
|
||||
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/ext_libs/cmsis_download.sh ${MAKEFILE_DIR}/downloads)
|
||||
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
|
||||
$(error Something went wrong with the CMSIS download: $(DOWNLOAD_RESULT))
|
||||
endif
|
||||
endif
|
||||
|
||||
FLOAT := soft
|
||||
GCC_TARGET_ARCH := $(TARGET_ARCH)
|
||||
|
||||
ifeq ($(TARGET_ARCH), cortex-m0)
|
||||
CORE=M0
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m3)
|
||||
CORE=M3
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m33)
|
||||
CORE=M33
|
||||
FLOAT=hard
|
||||
CMSIS_ARM_FEATURES := _DSP_DP
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m33+nodsp)
|
||||
CORE=M33
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m4)
|
||||
CORE=M4
|
||||
GCC_TARGET_ARCH := cortex-m4+nofp
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m4+fp)
|
||||
CORE=M4
|
||||
FLOAT=hard
|
||||
GCC_TARGET_ARCH := cortex-m4
|
||||
CMSIS_ARM_FEATURES := _FP
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m55)
|
||||
CORE=M55
|
||||
FLOAT=hard
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m55+nodsp+nofp)
|
||||
CORE=M55
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m55+nofp)
|
||||
CORE=M55
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m7)
|
||||
CORE=M7
|
||||
GCC_TARGET_ARCH := cortex-m7+nofp
|
||||
|
||||
else ifeq ($(TARGET_ARCH), cortex-m7+fp)
|
||||
CORE=M7
|
||||
FLOAT=hard
|
||||
GCC_TARGET_ARCH := cortex-m7
|
||||
CMSIS_ARM_FEATURES := _DP
|
||||
|
||||
else
|
||||
$(error "TARGET_ARCH=$(TARGET_ARCH) is not supported")
|
||||
endif
|
||||
|
||||
ifneq ($(filter cortex-m55%,$(TARGET_ARCH)),)
|
||||
# soft-abi=soft disables MVE - use softfp instead for M55.
|
||||
ifeq ($(FLOAT),soft)
|
||||
FLOAT=softfp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN), gcc)
|
||||
export PATH := $(MAKEFILE_DIR)/downloads/gcc_embedded/bin/:$(PATH)
|
||||
DOWNLOAD_RESULT := $(shell $(MAKEFILE_DIR)/arm_gcc_download.sh ${MAKEFILE_DIR}/downloads)
|
||||
ifneq ($(DOWNLOAD_RESULT), SUCCESS)
|
||||
$(error Something went wrong with the GCC download: $(DOWNLOAD_RESULT))
|
||||
endif
|
||||
TARGET_TOOLCHAIN_PREFIX := arm-none-eabi-
|
||||
|
||||
FLAGS_GCC = -mcpu=$(GCC_TARGET_ARCH) -mfpu=auto
|
||||
CXXFLAGS += $(FLAGS_GCC)
|
||||
CCFLAGS += $(FLAGS_GCC)
|
||||
|
||||
LDFLAGS += \
|
||||
--specs=nosys.specs \
|
||||
-T $(ETHOS_U_CORE_PLATFORM)/platform_parsed.ld \
|
||||
-Wl,-Map=${TENSORFLOW_ROOT}$(MAKEFILE_DIR)/gen/$(TARGET).map,--cref \
|
||||
-Wl,--gc-sections \
|
||||
--entry Reset_Handler
|
||||
|
||||
else
|
||||
$(error "TOOLCHAIN=$(TOOLCHAIN) is not supported.")
|
||||
endif
|
||||
|
||||
# TODO: fix warnings.
|
||||
OMIT_ERRORS = \
|
||||
-Wno-implicit-fallthrough \
|
||||
-Wno-strict-aliasing
|
||||
|
||||
PLATFORM_FLAGS = \
|
||||
-DTF_LITE_MCU_DEBUG_LOG \
|
||||
-mthumb \
|
||||
-mfloat-abi=$(FLOAT) \
|
||||
-funsigned-char \
|
||||
-mlittle-endian \
|
||||
${OMIT_ERRORS} \
|
||||
-fomit-frame-pointer \
|
||||
-MD \
|
||||
-DCPU_$(CORE)=1
|
||||
|
||||
# Common + C/C++ flags
|
||||
CXXFLAGS += $(PLATFORM_FLAGS)
|
||||
CCFLAGS += $(PLATFORM_FLAGS)
|
||||
|
||||
ARM_CPU := $(subst cortex-m,ARMCM,$(GCC_TARGET_ARCH))
|
||||
ARM_CPU := $(subst +nofp,,$(ARM_CPU))
|
||||
CXXFLAGS += -D$(ARM_CPU)$(CMSIS_ARM_FEATURES)
|
||||
CCFLAGS += -D$(ARM_CPU)$(CMSIS_ARM_FEATURES)
|
||||
|
||||
THIRD_PARTY_CC_SRCS += \
|
||||
$(ETHOS_U_CORE_PLATFORM)/retarget.c \
|
||||
$(ETHOS_U_CORE_PLATFORM)/uart.c
|
||||
|
||||
CMSIS_DEFAULT_DOWNLOAD_PATH := $(MAKEFILE_DIR)/downloads/cmsis
|
||||
CMSIS_PATH := $(CMSIS_DEFAULT_DOWNLOAD_PATH)
|
||||
THIRD_PARTY_CC_SRCS += \
|
||||
$(CMSIS_PATH)/Device/ARM/$(ARM_CPU)/Source/system_$(ARM_CPU).c \
|
||||
$(CMSIS_PATH)/Device/ARM/$(ARM_CPU)/Source/startup_$(ARM_CPU).c
|
||||
INCLUDES += \
|
||||
-I$(CMSIS_PATH)/Device/ARM/$(ARM_CPU)/Include \
|
||||
-I$(CMSIS_PATH)/CMSIS/Core/Include
|
||||
|
||||
# TODO(#47071): Examine why Micro benchmarks fails.
|
||||
MICRO_LITE_BENCHMARKS := $(filter-out tensorflow/lite/micro/benchmarks/Makefile.inc, $(MICRO_LITE_BENCHMARKS))
|
||||
|
||||
# TODO(#47070): Examine why some tests fail here.
|
||||
EXCLUDED_TESTS := \
|
||||
tensorflow/lite/micro/micro_interpreter_test.cc \
|
||||
tensorflow/lite/micro/micro_allocator_test.cc \
|
||||
tensorflow/lite/micro/memory_helpers_test.cc \
|
||||
tensorflow/lite/micro/micro_error_reporter_test.cc \
|
||||
tensorflow/lite/micro/output_handler_test.cc \
|
||||
tensorflow/lite/micro/memory_arena_threshold_test.cc \
|
||||
tensorflow/lite/micro/recording_micro_allocator_test.cc \
|
||||
tensorflow/lite/micro/kernels/circular_buffer_test.cc \
|
||||
tensorflow/lite/micro/kernels/pooling_test.cc
|
||||
MICROLITE_TEST_SRCS := $(filter-out $(EXCLUDED_TESTS), $(MICROLITE_TEST_SRCS))
|
||||
EXCLUDED_EXAMPLE_TESTS := \
|
||||
tensorflow/lite/micro/examples/magic_wand/Makefile.inc \
|
||||
tensorflow/lite/micro/examples/micro_speech/Makefile.inc \
|
||||
tensorflow/lite/micro/examples/person_detection/Makefile.inc \
|
||||
tensorflow/lite/micro/examples/hello_world/Makefile.inc \
|
||||
tensorflow/lite/micro/examples/network_tester/Makefile.inc \
|
||||
tensorflow/lite/micro/examples/image_recognition_experimental/Makefile.inc
|
||||
MICRO_LITE_EXAMPLE_TESTS := $(filter-out $(EXCLUDED_EXAMPLE_TESTS), $(MICRO_LITE_EXAMPLE_TESTS))
|
||||
|
||||
TEST_SCRIPT := tensorflow/lite/micro/testing/test_with_arm_corstone_300.sh
|
Loading…
Reference in New Issue
Block a user