ONE icon indicating copy to clipboard operation
ONE copied to clipboard

[infra] Add cortex-m7 platform

Open SlavikMIPT opened this issue 3 years ago • 2 comments

This commit addds cortex-m7 to supported platforms.

ONE-DCO-1.0-Signed-off-by: Vyacheslav Bazhenov [email protected]

SlavikMIPT avatar Aug 17 '22 11:08 SlavikMIPT

We decided that this is armv7em target: #9477 do not merge this

this argument is not supported by gcc:

	
valid arguments are: arm8 arm810 strongarm strongarm110 fa526 fa626 arm7tdmi arm7tdmi-s arm710t arm720t arm740t arm9 arm9tdmi arm92
0t arm920 arm922t arm940t ep9312 arm10tdmi arm1020t arm9e arm946e-s arm966e-s arm968e-s arm10e arm1020e arm1022e xscale iwmmxt iwmmxt2 fa606te fa626te fmp62
6 fa726te arm926ej-s arm1026ej-s arm1136j-s arm1136jf-s arm1176jz-s arm1176jzf-s mpcorenovfp mpcore arm1156t2-s arm1156t2f-s cortex-m1 cortex-m0 cortex-m0pl
us cortex-m1.small-multiply cortex-m0.small-multiply cortex-m0plus.small-multiply generic-armv7-a cortex-a5 cortex-a7 cortex-a8 cortex-a9 cortex-a12 cortex-
a15 cortex-a17 cortex-r4 cortex-r4f cortex-r5 cortex-r7 cortex-r8 cortex-m7 cortex-m4 cortex-m3 marvell-pj4 cortex-a15.cortex-a7 cortex-a17.cortex-a7 cortex
-a32 cortex-a35 cortex-a53 cortex-a57 cortex-a72 cortex-a73 exynos-m1 xgene1 cortex-a57.cortex-a53 cortex-a72.cortex-a53 cortex-a73.cortex-a35 cortex-a73.co
rtex-a53 cortex-a55 cortex-a75 cortex-a76 neoverse-n1 cortex-a75.cortex-a55 cortex-a76.cortex-a55 cortex-m23 cortex-m33 cortex-r52;

SlavikMIPT avatar Aug 17 '22 13:08 SlavikMIPT

How can we meet above message?

hseok-oh avatar Aug 18 '22 01:08 hseok-oh

How can we meet above message?

in compiler/luci-micro/CMakeLists.txt edit -DTARGET_CPU=armv7em, then make luci_interpreter_micro_arm

SlavikMIPT avatar Aug 18 '22 09:08 SlavikMIPT

Q) planning to remove previous change? (maybe in another PR)

elseif("${TARGET_ARCH}" STREQUAL "armv7em")
   set(TARGET_ARCH_BASE "arm")

I think armv7em is not going to be used

seanshpark avatar Aug 18 '22 09:08 seanshpark

Q) planning to remove previous change? (maybe in another PR)

elseif("${TARGET_ARCH}" STREQUAL "armv7em")
   set(TARGET_ARCH_BASE "arm")

I think armv7em is not going to be used

Yes

SlavikMIPT avatar Aug 18 '22 10:08 SlavikMIPT

How can we meet above message?

in compiler/luci-micro/CMakeLists.txt edit -DTARGET_CPU=armv7em, then make luci_interpreter_micro_arm

I checked and found out TARGET_CPU is used on cmake toolchain file infra/nncc/cmake/buildtool/config/arm-none-eabi-gcc.cmake to set compiler option -mcpu. -mcpu is CPU name (not platform name), so we need different way to get target CPU name. (ex. use cmake configure option LUCI_MICRO_TARGET_CPU?)

hseok-oh avatar Aug 19 '22 00:08 hseok-oh

Can't we use below solution?

  1. Patch
--- a/compiler/luci-micro/CMakeLists.txt
+++ b/compiler/luci-micro/CMakeLists.txt
@@ -10,11 +10,13 @@ if(NOT ARM_C_COMPILER_PATH)
   return()
 endif()
 
+set(LUCI_MICRO_TARGET_CPU "cortex-m7" CACHE STRING "Luci micro target CPU")
+
 set(CMAKE_ARM_OPTIONS
   -DLUCI_INTERPRETER_STATIC=ON
   -DLUCI_STATIC=ON
   -DBUILD_CMSIS_NN_FUNCTIONS=ON
-  -DTARGET_CPU=cortex-m7
+  -DTARGET_CPU=${LUCI_MICRO_TARGET_CPU}
   "-DCMAKE_TOOLCHAIN_FILE=${NNAS_PROJECT_SOURCE_DIR}/infra/nncc/cmake/buildtool/config/arm-none-eabi-gcc.cmake"
   "-DLUCI_INTERPRETER_PAL_DIR=${CMAKE_CURRENT_SOURCE_DIR}/../luci-interpreter/pal/mcu"
   "-DNNAS_PROJECT_SOURCE_DIR=${NNAS_PROJECT_SOURCE_DIR}"
  1. CMake build command
$ cd <path to ONE>
$ mkdir build
# cd build
$ cmake ../infra/nncc -DLUCI_MICRO_TARGET_CPU="cortex-m7"
$ make -j$(nproc) luci_interpreter_micro_arm

hseok-oh avatar Aug 19 '22 01:08 hseok-oh

Can't we use below solution?

But how then we can set TARGET_ARCH? The main problem is error caused by infra/cmake/modules/IdentifyPlatform.cmake

SlavikMIPT avatar Aug 19 '22 10:08 SlavikMIPT

Can't we use below solution?

But how then we can set TARGET_ARCH? The main problem is error caused by infra/cmake/modules/IdentifyPlatform.cmake

I thought TARGET_ARCH is not important for luci-micro build because current luci-micro build setting don't have setting for TARGET_ARCH.

https://github.com/Samsung/ONE/blob/fae66969d9f4b7acb5c35f0c5eb536ea76f367ab/compiler/luci-micro/CMakeLists.txt#L13-L31

I can't understand does this PR help setting correct TARGET_ARCH on compiler build. Do you have plan to support building other compiler modules? Otherwise, modify compiler/luci-micro/CMakeLists.txt to set correct TARGET_ARCH for luci-micro, . Or you can update toolchain file infra/nncc/cmake/buildtool/config/arm-none-eabi-gcc.cmake like infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake.

https://github.com/Samsung/ONE/blob/fae66969d9f4b7acb5c35f0c5eb536ea76f367ab/infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake#L37-L38

Sorry for long feedback, but don't forget implementations under infra/cmake are shared by compiler and runtime build system.

hseok-oh avatar Aug 22 '22 00:08 hseok-oh

@SlavikMIPT, what do you think about adding line -DTARGET_ARCH=armv7em to https://github.com/Samsung/ONE/blob/fae66969d9f4b7acb5c35f0c5eb536ea76f367ab/compiler/luci-micro/CMakeLists.txt#L13-L31

BalyshevArtem avatar Aug 29 '22 11:08 BalyshevArtem