2 # NOTE this is provided as experimental Makefile to ARM32 cross building
3 # some modules of compiler.
9 CURRENT_DIR=$(shell pwd)
12 ROOTFS_ARM?=$(CURRENT_DIR)/tools/cross/rootfs/arm
13 NNCC_CFG_OPTION_EXTRA?=
15 TYPE_FOLDER=$(shell echo $(BUILD_TYPE) | tr A-Z a-z)
17 BUILD_ARM32_FOLDER=$(BUILDFOLDER)/$(ARM32_FOLDER).$(TYPE_FOLDER)
18 BUILD_ARM32_HOST=$(BUILDFOLDER)/$(ARM32_FOLDER).$(TYPE_FOLDER).host
20 ARM32_INSTALL_FOLDER=$(CURRENT_DIR)/$(BUILDFOLDER)/$(ARM32_FOLDER).$(TYPE_FOLDER).install
21 ARM32_INSTALL_HOST=$(CURRENT_DIR)/$(BUILDFOLDER)/$(ARM32_FOLDER).$(TYPE_FOLDER).host.install
24 ARM32_BUILD_ITEMS:=angkor;cwrap;pepper-str;pepper-strcast;pp
25 ARM32_BUILD_ITEMS+=;pepper-csv2vec;crew
26 ARM32_BUILD_ITEMS+=;oops;pepper-assert
27 ARM32_BUILD_ITEMS+=;hermes;hermes-std
28 ARM32_BUILD_ITEMS+=;loco;locop;logo-core;logo
29 ARM32_BUILD_ITEMS+=;safemain;mio-circle05;mio-tflite280;mio-circle06;mio-tflite2121
30 ARM32_BUILD_ITEMS+=;dio-hdf5
31 ARM32_BUILD_ITEMS+=;luci-compute
32 ARM32_BUILD_ITEMS+=;foder;circle-verify;souschef;arser;vconone
33 ARM32_BUILD_ITEMS+=;luci
34 ARM32_BUILD_ITEMS+=;luci-interpreter
35 ARM32_BUILD_ITEMS+=;tflite2circle
36 ARM32_BUILD_ITEMS+=;tflchef;circlechef
37 ARM32_BUILD_ITEMS+=;circle2circle;record-minmax;circle-quantizer
38 ARM32_BUILD_ITEMS+=;luci-eval-driver;luci-value-test
40 ARM32_TOOLCHAIN_FILE=cmake/buildtool/cross/toolchain_armv7l-linux.cmake
42 ARM32_HOST_ITEMS:=angkor;cwrap;pepper-str;pepper-strcast;pp
43 ARM32_HOST_ITEMS+=;pepper-csv2vec
44 ARM32_HOST_ITEMS+=;oops
45 ARM32_HOST_ITEMS+=;hermes;hermes-std
46 ARM32_HOST_ITEMS+=;loco;locop;logo-core;logo
47 ARM32_HOST_ITEMS+=;safemain;mio-circle05;mio-tflite280;mio-circle06;mio-tflite2121
48 ARM32_HOST_ITEMS+=;luci-compute
49 ARM32_HOST_ITEMS+=;foder;circle-verify;souschef;arser;vconone
50 ARM32_HOST_ITEMS+=;luci
51 ARM32_HOST_ITEMS+=;luci-interpreter
52 ARM32_HOST_ITEMS+=;tflite2circle
53 ARM32_HOST_ITEMS+=;tflchef;circlechef
54 ARM32_HOST_ITEMS+=;circle-tensordump
55 ARM32_HOST_ITEMS+=;circle2circle
56 ARM32_HOST_ITEMS+=;common-artifacts
57 ARM32_HOST_ITEMS+=;luci-eval-driver;luci-value-test
61 _SPACE_:=$(_EMPTY_) $(_EMPTY_)
62 ARM32_BUILD_WHITELIST=$(subst $(_SPACE_),,$(ARM32_BUILD_ITEMS))
63 ARM32_HOST_WHITELIST=$(subst $(_SPACE_),,$(ARM32_HOST_ITEMS))
65 NNCC_CFG_OPTION+= -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_COVERAGE=OFF -DEXTERNALS_BUILD_THREADS=$(BUILD_JOBS)
67 NNCC_CFG_STRICT= -DENABLE_STRICT_BUILD=ON
69 INT_TARGETS:=int_configure_arm32 int_configure_arm32_host \
70 int_build_arm32 int_build_arm32_host int_test_arm32_host int_test
72 NNCC_ARM32_DEBUG= -DBUILD_WHITELIST="$(ARM32_BUILD_WHITELIST)"
73 NNCC_ARM32_DEBUG_HOST= -DBUILD_WHITELIST="$(ARM32_HOST_WHITELIST)"
77 VAL_TARGETS:=cfg debug test_prep test
79 .PHONY: $(INT_TARGETS) $(DEF_TARGETS) $(VAL_TARGETS)
84 @echo "cfg : debug configure"
85 @echo "debug : debug build"
86 @echo "test_prep: debug test preparation"
87 @echo "test : debug test in target"
89 ###############################################################################
90 # do not call int_xxxx directly as the depend on environment variables
96 int_configure_arm32_host:
97 NNCC_WORKSPACE=$(BUILD_ARM32_HOST) ./nncc configure \
99 $(NNCC_ARM32_DEBUG_HOST) $(NNCC_CFG_STRICT) \
100 -DCMAKE_INSTALL_PREFIX="$(ARM32_INSTALL_HOST)" \
104 ROOTFS_DIR=$(ROOTFS_ARM) TARGET_ARCH=armv7l \
105 BUILD_HOST_EXEC=$(CURRENT_DIR)/$(BUILD_ARM32_HOST) \
106 NNCC_WORKSPACE=$(BUILD_ARM32_FOLDER) ./nncc configure \
107 $(NNCC_CFG_OPTION) $(NNCC_CFG_OPTION_EXTRA) \
108 $(NNCC_ARM32_DEBUG) $(NNCC_CFG_STRICT) \
109 -DCMAKE_TOOLCHAIN_FILE=$(ARM32_TOOLCHAIN_FILE) \
110 -DCMAKE_INSTALL_PREFIX="$(ARM32_INSTALL_FOLDER)" \
111 -DBUILD_ARM32_NEON=ON \
114 # TODO remove BUILD_ARM32_NEON=ON as default is ON, after a while.
115 # explictly added to prevent using cached 'BUILD_ARM32_NEON=OFF'
120 int_build_arm32_host:
121 NNCC_WORKSPACE=$(BUILD_ARM32_HOST) ./nncc build -j$(BUILD_JOBS)
124 ROOTFS_DIR=$(ROOTFS_ARM) TARGET_ARCH=armv7l \
125 BUILD_HOST_EXEC=$(CURRENT_DIR)/$(BUILD_ARM32_HOST) \
126 NNCC_WORKSPACE=$(BUILD_ARM32_FOLDER) ./nncc build -j$(BUILD_JOBS)
129 # host test; run test in host to generate random input and expected outputs
132 NNCC_WORKSPACE=$(BUILD_ARM32_HOST) ./nncc test
135 # tests: run in ARM32 Ubuntu 18.04 device
138 NNCC_WORKSPACE=$(BUILD_ARM32_FOLDER) ./nncc test
140 ################################################################################
142 all: int_configure_arm32_host int_build_arm32_host int_configure_arm32 int_build_arm32
144 cfg: int_configure_arm32_host int_build_arm32_host int_configure_arm32
146 debug: int_build_arm32
148 # NOTE before run test in ARM32, run test in host is required to prepare test data
149 test_prep: int_test_arm32_host
151 # NOTE run test in ARM32 Ubuntu 18.04 device