From 5b47a830225e6db116e42377339cef13358677aa Mon Sep 17 00:00:00 2001 From: Wang_Weigen Date: Thu, 9 Sep 2021 18:00:27 +0800 Subject: [PATCH] solve the compile problem of tflite in xiuos --- .../Applications/knowing_app/Kconfig | 16 ++-- .../Applications/knowing_app/Makefile | 3 + .../Applications/knowing_app/mnist/Makefile | 7 ++ .../Applications/knowing_app/mnist/main.cpp | 1 + .../knowing_app/mnist/mnistmain.c | 31 +++++++ APP_Framework/Framework/Makefile | 2 +- APP_Framework/Framework/knowing/Makefile | 11 +-- .../Framework/knowing/tensorflow-lite/Kconfig | 1 + .../knowing/tensorflow-lite/Makefile | 3 + .../tensorflow-lite-for-mcu/Makefile | 90 +++++++++++++++++++ .../tensorflow-lite-for-mcu/tf_fini_fix.c | 4 + APP_Framework/lib/app_newlib/fs_syscalls.c | 9 ++ APP_Framework/lib/app_newlib/task_syscalls.c | 2 +- Ubiquitous/XiUOS/arch/risc-v/shared/kswitch.h | 14 +-- .../XiUOS/board/kd233/link_userspace.lds | 6 ++ Ubiquitous/XiUOS/path_app.mk | 8 ++ Ubiquitous/XiUOS/path_kernel.mk | 27 +++++- Ubiquitous/XiUOS/resources/can/drv_can.c | 2 +- Ubiquitous/XiUOS/resources/i2c/drv_i2c.c | 2 +- Ubiquitous/XiUOS/resources/include/bus.h | 8 +- Ubiquitous/XiUOS/resources/include/bus_can.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_i2c.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_lcd.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_pin.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_rtc.h | 2 +- .../XiUOS/resources/include/bus_serial.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_spi.h | 2 +- .../XiUOS/resources/include/bus_touch.h | 2 +- Ubiquitous/XiUOS/resources/include/bus_usb.h | 2 +- Ubiquitous/XiUOS/resources/lcd/drv_lcd.c | 2 +- Ubiquitous/XiUOS/resources/pin/drv_pin.c | 2 +- Ubiquitous/XiUOS/resources/rtc/drv_rtc.c | 2 +- .../XiUOS/resources/serial/drv_serial.c | 2 +- Ubiquitous/XiUOS/resources/spi/drv_spi.c | 2 +- Ubiquitous/XiUOS/resources/touch/drv_touch.c | 2 +- Ubiquitous/XiUOS/resources/usb/drv_usb.c | 2 +- 36 files changed, 232 insertions(+), 47 deletions(-) create mode 100755 APP_Framework/Applications/knowing_app/mnist/Makefile create mode 100644 APP_Framework/Applications/knowing_app/mnist/mnistmain.c create mode 100644 APP_Framework/Framework/knowing/tensorflow-lite/Makefile create mode 100644 APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/Makefile create mode 100644 APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/tf_fini_fix.c diff --git a/APP_Framework/Applications/knowing_app/Kconfig b/APP_Framework/Applications/knowing_app/Kconfig index bb8cfa0d..5fa6945b 100755 --- a/APP_Framework/Applications/knowing_app/Kconfig +++ b/APP_Framework/Applications/knowing_app/Kconfig @@ -1,7 +1,13 @@ menu "knowing app" - source "$APP_DIR/Applications/knowing_app/mnist/Kconfig" - source "$APP_DIR/Applications/knowing_app/face_detect/Kconfig" - source "$APP_DIR/Applications/knowing_app/instrusion_detect/Kconfig" - source "$APP_DIR/Applications/knowing_app/helmet_detect/Kconfig" - source "$APP_DIR/Applications/knowing_app/iris_ml_demo/Kconfig" + menuconfig APPLICATION_KNOWING + bool "Using knowing apps" + default n + + if APPLICATION_KNOWING + source "$APP_DIR/Applications/knowing_app/mnist/Kconfig" + source "$APP_DIR/Applications/knowing_app/face_detect/Kconfig" + source "$APP_DIR/Applications/knowing_app/instrusion_detect/Kconfig" + source "$APP_DIR/Applications/knowing_app/helmet_detect/Kconfig" + source "$APP_DIR/Applications/knowing_app/iris_ml_demo/Kconfig" + endif endmenu diff --git a/APP_Framework/Applications/knowing_app/Makefile b/APP_Framework/Applications/knowing_app/Makefile index e69de29b..3357fbf9 100755 --- a/APP_Framework/Applications/knowing_app/Makefile +++ b/APP_Framework/Applications/knowing_app/Makefile @@ -0,0 +1,3 @@ +SRC_DIR := mnist + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/APP_Framework/Applications/knowing_app/mnist/Makefile b/APP_Framework/Applications/knowing_app/mnist/Makefile new file mode 100755 index 00000000..516f61ab --- /dev/null +++ b/APP_Framework/Applications/knowing_app/mnist/Makefile @@ -0,0 +1,7 @@ +SRC_FILES := \ + main.cpp \ + mnistmain.c + CPPPATHS += -I. + + +include $(KERNEL_ROOT)/compiler.mk \ No newline at end of file diff --git a/APP_Framework/Applications/knowing_app/mnist/main.cpp b/APP_Framework/Applications/knowing_app/mnist/main.cpp index 6991dfa4..3f2d3321 100644 --- a/APP_Framework/Applications/knowing_app/mnist/main.cpp +++ b/APP_Framework/Applications/knowing_app/mnist/main.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/APP_Framework/Applications/knowing_app/mnist/mnistmain.c b/APP_Framework/Applications/knowing_app/mnist/mnistmain.c new file mode 100644 index 00000000..8c715e17 --- /dev/null +++ b/APP_Framework/Applications/knowing_app/mnist/mnistmain.c @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2020 AIIT XUOS Lab +* XiOS is licensed under Mulan PSL v2. +* You can use this software according to the terms and conditions of the Mulan PSL v2. +* You may obtain a copy of Mulan PSL v2 at: +* http://license.coscl.org.cn/MulanPSL2 +* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +* See the Mulan PSL v2 for more details. +*/ + +/** +* @file: mnistmain.c +* @brief: start mnist function +* @version: 1.0 +* @author: AIIT XUOS Lab +* @date: 2021/4/30 +* +*/ + +#include + +void mnist_app(void); + +int tfmnist(void) { + mnist_app(); +} +// #ifndef SEPARATE_COMPILE +// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, tfmnist, tfmnist, run mnist demo of tflite); +// #endif \ No newline at end of file diff --git a/APP_Framework/Framework/Makefile b/APP_Framework/Framework/Makefile index fc5bf385..128587c8 100644 --- a/APP_Framework/Framework/Makefile +++ b/APP_Framework/Framework/Makefile @@ -9,7 +9,7 @@ ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK),y) endif ifeq ($(CONFIG_SUPPORT_KNOWING_FRAMEWORK),y) - SRC_DIR += know + SRC_DIR += knowing endif ifeq ($(CONFIG_SUPPORT_CONTROL_FRAMEWORK),y) diff --git a/APP_Framework/Framework/knowing/Makefile b/APP_Framework/Framework/knowing/Makefile index 60ec20c0..d12b2437 100644 --- a/APP_Framework/Framework/knowing/Makefile +++ b/APP_Framework/Framework/knowing/Makefile @@ -1,13 +1,4 @@ -SRC_DIR := -ifeq ($(CONFIG_SUPPORT_KNOW_FRAMEWORK),y) - ifeq ($(CONFIG_USING_TFLITE_MNIST),y) - SRC_DIR += tflite_mnist - endif - - ifeq ($(CONFIG_USING_TFLITE_SIN),y) - SRC_DIR += tflite_sin - endif -endif +SRC_DIR := tensorflow-lite include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Framework/knowing/tensorflow-lite/Kconfig b/APP_Framework/Framework/knowing/tensorflow-lite/Kconfig index 9f8a73a9..c8b5c927 100644 --- a/APP_Framework/Framework/knowing/tensorflow-lite/Kconfig +++ b/APP_Framework/Framework/knowing/tensorflow-lite/Kconfig @@ -1,6 +1,7 @@ menuconfig USING_TENSORFLOWLITEMICRO bool "Tensorflow Lite for Micro" select RT_USING_CPLUSPLUS + select LIB_CPLUSPLUS default n if USING_TENSORFLOWLITEMICRO diff --git a/APP_Framework/Framework/knowing/tensorflow-lite/Makefile b/APP_Framework/Framework/knowing/tensorflow-lite/Makefile new file mode 100644 index 00000000..86c474f3 --- /dev/null +++ b/APP_Framework/Framework/knowing/tensorflow-lite/Makefile @@ -0,0 +1,3 @@ +SRC_DIR := tensorflow-lite-for-mcu + +include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/Makefile b/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/Makefile new file mode 100644 index 00000000..d94a82b4 --- /dev/null +++ b/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/Makefile @@ -0,0 +1,90 @@ +TFLITE_SRCS = \ + source/tensorflow/lite/micro/all_ops_resolver.cc \ + source/tensorflow/lite/micro/debug_log.cc \ + source/tensorflow/lite/micro/memory_helpers.cc \ + source/tensorflow/lite/micro/micro_allocator.cc \ + source/tensorflow/lite/micro/micro_error_reporter.cc \ + source/tensorflow/lite/micro/micro_interpreter.cc \ + source/tensorflow/lite/micro/micro_profiler.cc \ + source/tensorflow/lite/micro/micro_string.cc \ + source/tensorflow/lite/micro/micro_time.cc \ + source/tensorflow/lite/micro/micro_utils.cc \ + source/tensorflow/lite/micro/recording_micro_allocator.cc \ + source/tensorflow/lite/micro/recording_simple_memory_allocator.cc \ + source/tensorflow/lite/micro/simple_memory_allocator.cc \ + source/tensorflow/lite/micro/test_helpers.cc \ + source/tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.cc \ + source/tensorflow/lite/micro/memory_planner/greedy_memory_planner.cc \ + source/tensorflow/lite/micro/memory_planner/linear_memory_planner.cc \ + source/tensorflow/lite/micro/testing/test_conv_model.cc \ + source/tensorflow/lite/c/common.c \ + source/tensorflow/lite/core/api/error_reporter.cc \ + source/tensorflow/lite/core/api/flatbuffer_conversions.cc \ + source/tensorflow/lite/core/api/op_resolver.cc \ + source/tensorflow/lite/core/api/tensor_utils.cc \ + source/tensorflow/lite/kernels/internal/quantization_util.cc \ + source/tensorflow/lite/kernels/kernel_util.cc \ + source/tensorflow/lite/schema/schema_utils.cc \ + source/tensorflow/lite/micro/kernels/activations.cc \ + source/tensorflow/lite/micro/kernels/arg_min_max.cc \ + source/tensorflow/lite/micro/kernels/ceil.cc \ + source/tensorflow/lite/micro/kernels/circular_buffer.cc \ + source/tensorflow/lite/micro/kernels/comparisons.cc \ + source/tensorflow/lite/micro/kernels/concatenation.cc \ + source/tensorflow/lite/micro/kernels/conv_test_common.cc \ + source/tensorflow/lite/micro/kernels/dequantize.cc \ + source/tensorflow/lite/micro/kernels/detection_postprocess.cc \ + source/tensorflow/lite/micro/kernels/elementwise.cc \ + source/tensorflow/lite/micro/kernels/ethosu.cc \ + source/tensorflow/lite/micro/kernels/flexbuffers_generated_data.cc \ + source/tensorflow/lite/micro/kernels/floor.cc \ + source/tensorflow/lite/micro/kernels/hard_swish.cc \ + source/tensorflow/lite/micro/kernels/kernel_runner.cc \ + source/tensorflow/lite/micro/kernels/kernel_util.cc \ + source/tensorflow/lite/micro/kernels/l2norm.cc \ + source/tensorflow/lite/micro/kernels/logical.cc \ + source/tensorflow/lite/micro/kernels/logistic.cc \ + source/tensorflow/lite/micro/kernels/maximum_minimum.cc \ + source/tensorflow/lite/micro/kernels/neg.cc \ + source/tensorflow/lite/micro/kernels/pack.cc \ + source/tensorflow/lite/micro/kernels/pad.cc \ + source/tensorflow/lite/micro/kernels/prelu.cc \ + source/tensorflow/lite/micro/kernels/quantize.cc \ + source/tensorflow/lite/micro/kernels/quantize_common.cc \ + source/tensorflow/lite/micro/kernels/reduce.cc \ + source/tensorflow/lite/micro/kernels/reshape.cc \ + source/tensorflow/lite/micro/kernels/resize_nearest_neighbor.cc \ + source/tensorflow/lite/micro/kernels/round.cc \ + source/tensorflow/lite/micro/kernels/shape.cc \ + source/tensorflow/lite/micro/kernels/split.cc \ + source/tensorflow/lite/micro/kernels/split_v.cc \ + source/tensorflow/lite/micro/kernels/strided_slice.cc \ + source/tensorflow/lite/micro/kernels/sub.cc \ + source/tensorflow/lite/micro/kernels/svdf_common.cc \ + source/tensorflow/lite/micro/kernels/tanh.cc \ + source/tensorflow/lite/micro/kernels/transpose_conv.cc \ + source/tensorflow/lite/micro/kernels/unpack.cc \ + source/tensorflow/lite/micro/kernels/normal/add.cc \ + source/tensorflow/lite/micro/kernels/normal/conv.cc \ + source/tensorflow/lite/micro/kernels/normal/depthwise_conv.cc \ + source/tensorflow/lite/micro/kernels/normal/fully_connected.cc \ + source/tensorflow/lite/micro/kernels/normal/mul.cc \ + source/tensorflow/lite/micro/kernels/normal/pooling.cc \ + source/tensorflow/lite/micro/kernels/normal/softmax.cc \ + source/tensorflow/lite/micro/kernels/normal/svdf.cc + +# ifeq ($(CONFIG_INTELLIGENT_TFLITE),y) +ifeq ($(CONFIG_USING_TENSORFLOWLITEMICRO),y) + SRC_FILES := $(TFLITE_SRCS) tf_fini_fix.c + CPPPATHS += \ + -Isource \ + -Isource/third_party/gemmlowp \ + -Isource/third_party/flatbuffers/include \ + -Isource/third_party/ruy + DEFINES += -DTF_LITE_USE_GLOBAL_CMATH_FUNCTIONS \ + -DTF_LITE_USE_GLOBAL_MAX \ + -DTF_LITE_USE_GLOBAL_MIN \ + -DTF_LITE_STATIC_MEMORY +endif + +include $(KERNEL_ROOT)/compiler.mk diff --git a/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/tf_fini_fix.c b/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/tf_fini_fix.c new file mode 100644 index 00000000..ee7b740d --- /dev/null +++ b/APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/tf_fini_fix.c @@ -0,0 +1,4 @@ +// fix '_fini' not found on gcc risvc 8.2.0 +#if (__riscv == 1) && (__GNUC__ == 8) && (__GNUC_MINOR__ == 2) +void _fini (void) {} +#endif \ No newline at end of file diff --git a/APP_Framework/lib/app_newlib/fs_syscalls.c b/APP_Framework/lib/app_newlib/fs_syscalls.c index 59402915..0b9cae77 100644 --- a/APP_Framework/lib/app_newlib/fs_syscalls.c +++ b/APP_Framework/lib/app_newlib/fs_syscalls.c @@ -96,3 +96,12 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { return write(fd, buf, nbytes); } + +void exit(int __status); +void _exit(int __status){} +void _kill(int k) +{} +int _getpid(void) +{ + +} \ No newline at end of file diff --git a/APP_Framework/lib/app_newlib/task_syscalls.c b/APP_Framework/lib/app_newlib/task_syscalls.c index f75144a8..bdbbb0f7 100644 --- a/APP_Framework/lib/app_newlib/task_syscalls.c +++ b/APP_Framework/lib/app_newlib/task_syscalls.c @@ -40,4 +40,4 @@ void abort(void) } while (1); -} \ No newline at end of file +} diff --git a/Ubiquitous/XiUOS/arch/risc-v/shared/kswitch.h b/Ubiquitous/XiUOS/arch/risc-v/shared/kswitch.h index 1d1c209a..8106c81b 100644 --- a/Ubiquitous/XiUOS/arch/risc-v/shared/kswitch.h +++ b/Ubiquitous/XiUOS/arch/risc-v/shared/kswitch.h @@ -242,7 +242,7 @@ static inline unsigned long KSwitch0(unsigned int knum) { uintptr_t param[1] = {0}; uint8_t num = 0; - SERVICETABLE[knum].fun(knum, param, num); + return SERVICETABLE[knum].fun(knum, param, num); } static inline unsigned long KSwitch1(unsigned int knum, unsigned long arg1) @@ -250,7 +250,7 @@ static inline unsigned long KSwitch1(unsigned int knum, unsigned long arg1) uintptr_t param[1] = {0}; uint8_t num = 0; param[0] = arg1; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } @@ -261,7 +261,7 @@ static inline unsigned long KSwitch2(unsigned int knum, unsigned long arg1, uint8_t num = 0; param[0] = arg1; param[1] = arg2; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } @@ -274,7 +274,7 @@ static inline unsigned long KSwitch3(unsigned int knum, unsigned long arg1, param[1] = arg2; param[2] = arg3; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } static inline unsigned long KSwitch4(unsigned int knum, unsigned long arg1, @@ -287,7 +287,7 @@ static inline unsigned long KSwitch4(unsigned int knum, unsigned long arg1, param[1] = arg2; param[2] = arg3; param[3] = arg4; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } static inline unsigned long KSwitch5(unsigned int knum, unsigned long arg1, @@ -301,7 +301,7 @@ static inline unsigned long KSwitch5(unsigned int knum, unsigned long arg1, param[2] = arg3; param[3] = arg4; param[4] = arg5; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } static inline unsigned long KSwitch6(unsigned int knum, unsigned long arg1, @@ -317,7 +317,7 @@ static inline unsigned long KSwitch6(unsigned int knum, unsigned long arg1, param[3] = arg4; param[4] = arg5; param[5] = arg6; - SERVICETABLE[knum].fun(knum, param, num ); + return SERVICETABLE[knum].fun(knum, param, num ); } #endif diff --git a/Ubiquitous/XiUOS/board/kd233/link_userspace.lds b/Ubiquitous/XiUOS/board/kd233/link_userspace.lds index 53360021..2ff35130 100644 --- a/Ubiquitous/XiUOS/board/kd233/link_userspace.lds +++ b/Ubiquitous/XiUOS/board/kd233/link_userspace.lds @@ -31,6 +31,12 @@ SECTIONS *(.rodata .rodata*) *(.glue_7) *(.glue_7t) + + PROVIDE(__ctors_start__ = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE(__ctors_end__ = .); + PROVIDE(_uetext = ABSOLUTE(.)); } > usram diff --git a/Ubiquitous/XiUOS/path_app.mk b/Ubiquitous/XiUOS/path_app.mk index aded4abe..d7a09ac0 100644 --- a/Ubiquitous/XiUOS/path_app.mk +++ b/Ubiquitous/XiUOS/path_app.mk @@ -15,6 +15,14 @@ ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK), y) APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection # endif +ifeq ($(CONFIG_SUPPORT_KNOWING_FRAMEWORK), y) +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing # +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source # +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/gemmlowp # +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/flatbuffers/include # +APPPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/ruy # +endif + COMPILE_APP: @$(eval CPPPATHS=$(APPPATHS)) @echo $(SRC_APP_DIR) diff --git a/Ubiquitous/XiUOS/path_kernel.mk b/Ubiquitous/XiUOS/path_kernel.mk index 31a0fec0..43888190 100755 --- a/Ubiquitous/XiUOS/path_kernel.mk +++ b/Ubiquitous/XiUOS/path_kernel.mk @@ -164,15 +164,40 @@ ifeq ($(CONFIG_FS_CH376), y) KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 # endif +ifeq ($(CONFIG_TRANSFORM_LAYER_ATTRIUBUTE), y) +ifeq ($(CONFIG_ADD_XIUOS_FETURES), y) KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos/user_api/posix_support/include # -KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor # KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos # +endif + +ifeq ($(CONFIG_ADD_NUTTX_FETURES), y) +# +endif + +ifeq ($(CONFIG_ADD_RTTHREAD_FETURES), y) +# +endif + +endif + KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/general_functions/list # +ifeq ($(CONFIG_SUPPORT_SENSOR_FRAMEWORK), y) +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor # +endif + ifeq ($(CONFIG_SUPPORT_CONNECTION_FRAMEWORK), y) KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/connection # endif +ifeq ($(CONFIG_SUPPORT_KNOWING_FRAMEWORK), y) +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/gemmlowp # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/flatbuffers/include # +KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow-lite/tensorflow-lite-for-mcu/source/third_party/ruy # +endif + ifeq ($(CONFIG_CRYPTO), y) KERNELPATHS += -I$(KERNEL_ROOT)/framework/security/crypto/include # endif diff --git a/Ubiquitous/XiUOS/resources/can/drv_can.c b/Ubiquitous/XiUOS/resources/can/drv_can.c index 9052436f..de7859f1 100644 --- a/Ubiquitous/XiUOS/resources/can/drv_can.c +++ b/Ubiquitous/XiUOS/resources/can/drv_can.c @@ -30,7 +30,7 @@ static void CanDrvLinkInit() } /*Find the regiter driver*/ -DriverType CanDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType CanDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/i2c/drv_i2c.c b/Ubiquitous/XiUOS/resources/i2c/drv_i2c.c index 03d55728..c9533cb0 100644 --- a/Ubiquitous/XiUOS/resources/i2c/drv_i2c.c +++ b/Ubiquitous/XiUOS/resources/i2c/drv_i2c.c @@ -30,7 +30,7 @@ static void I2cDrvLinkInit() } /*Find the regiter driver*/ -DriverType I2cDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType I2cDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/include/bus.h b/Ubiquitous/XiUOS/resources/include/bus.h index f0d3795f..b36b03b1 100644 --- a/Ubiquitous/XiUOS/resources/include/bus.h +++ b/Ubiquitous/XiUOS/resources/include/bus.h @@ -38,7 +38,7 @@ typedef struct HardwareDev *HardwareDevType; typedef struct Driver *DriverType; /* need to add new bus type in ../tool/shell/letter-shell/cmd.c, ensure ShowBus cmd supported*/ -enum BusType +enum BusType_e { TYPE_I2C_BUS = 0, TYPE_SPI_BUS, @@ -86,7 +86,7 @@ enum DevState DEV_UNINSTALL, }; -enum DriverType +enum DriverType_e { TYPE_I2C_DRV = 0, TYPE_SPI_DRV, @@ -168,7 +168,7 @@ struct HardwareDev struct Driver { int8 drv_name[NAME_NUM_MAX]; - enum DriverType driver_type; + enum DriverType_e driver_type; enum DriverState driver_state; uint32 (*configure)(void *drv, struct BusConfigureInfo *configure_info); @@ -182,7 +182,7 @@ struct Driver struct Bus { int8 bus_name[NAME_NUM_MAX]; - enum BusType bus_type; + enum BusType_e bus_type; enum BusState bus_state; int32 (*match)(struct Driver *driver, struct HardwareDev *device); diff --git a/Ubiquitous/XiUOS/resources/include/bus_can.h b/Ubiquitous/XiUOS/resources/include/bus_can.h index 10a18ec8..65ce674c 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_can.h +++ b/Ubiquitous/XiUOS/resources/include/bus_can.h @@ -58,7 +58,7 @@ int CanDriverAttachToBus(const char *drv_name, const char *bus_name); int CanDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType CanDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType CanDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_i2c.h b/Ubiquitous/XiUOS/resources/include/bus_i2c.h index 0ff5909f..4bf20449 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_i2c.h +++ b/Ubiquitous/XiUOS/resources/include/bus_i2c.h @@ -81,7 +81,7 @@ int I2cDriverAttachToBus(const char *drv_name, const char *bus_name); int I2cDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType I2cDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType I2cDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_lcd.h b/Ubiquitous/XiUOS/resources/include/bus_lcd.h index 1db429b5..efba5f3d 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_lcd.h +++ b/Ubiquitous/XiUOS/resources/include/bus_lcd.h @@ -56,7 +56,7 @@ int LcdDriverAttachToBus(const char *drv_name, const char *bus_name); int LcdDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType LcdDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType LcdDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_pin.h b/Ubiquitous/XiUOS/resources/include/bus_pin.h index 6160783e..e0f2069e 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_pin.h +++ b/Ubiquitous/XiUOS/resources/include/bus_pin.h @@ -56,7 +56,7 @@ int PinDriverAttachToBus(const char *drv_name, const char *bus_name); int PinDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType PinDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType PinDriverFind(const char *drv_name, enum DriverType_e drv_type); /*Get the initialized Pin bus*/ BusType PinBusInitGet(void); diff --git a/Ubiquitous/XiUOS/resources/include/bus_rtc.h b/Ubiquitous/XiUOS/resources/include/bus_rtc.h index 41e81923..4f46fe45 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_rtc.h +++ b/Ubiquitous/XiUOS/resources/include/bus_rtc.h @@ -86,7 +86,7 @@ int RtcDriverAttachToBus(const char *drv_name, const char *bus_name); int RtcDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType RtcDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType RtcDriverFind(const char *drv_name, enum DriverType_e drv_type); /*Set Rtc time and date*/ int RtcDrvSetFunction(char *driver_name, struct RtcSetParam *rtc_set_param); diff --git a/Ubiquitous/XiUOS/resources/include/bus_serial.h b/Ubiquitous/XiUOS/resources/include/bus_serial.h index 81c628d4..bb2628d2 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_serial.h +++ b/Ubiquitous/XiUOS/resources/include/bus_serial.h @@ -103,7 +103,7 @@ int SerialDriverAttachToBus(const char *drv_name, const char *bus_name); int SerialDriverRegister(struct Driver *driver); /*Find the regiter driver*/ -DriverType SerialDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType SerialDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_spi.h b/Ubiquitous/XiUOS/resources/include/bus_spi.h index bd99cc40..0439ad1f 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_spi.h +++ b/Ubiquitous/XiUOS/resources/include/bus_spi.h @@ -57,7 +57,7 @@ int SpiDriverAttachToBus(const char *drv_name, const char *bus_name); int SpiDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType SpiDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType SpiDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_touch.h b/Ubiquitous/XiUOS/resources/include/bus_touch.h index e47c06f5..53768753 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_touch.h +++ b/Ubiquitous/XiUOS/resources/include/bus_touch.h @@ -56,7 +56,7 @@ int TouchDriverAttachToBus(const char *drv_name, const char *bus_name); int TouchDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType TouchDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType TouchDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/include/bus_usb.h b/Ubiquitous/XiUOS/resources/include/bus_usb.h index 09e37438..fe8b0db2 100644 --- a/Ubiquitous/XiUOS/resources/include/bus_usb.h +++ b/Ubiquitous/XiUOS/resources/include/bus_usb.h @@ -59,7 +59,7 @@ int UsbDriverAttachToBus(const char *drv_name, const char *bus_name); int UsbDriverRegister(struct Driver *driver); /*Find the register driver*/ -DriverType UsbDriverFind(const char *drv_name, enum DriverType drv_type); +DriverType UsbDriverFind(const char *drv_name, enum DriverType_e drv_type); #ifdef __cplusplus } diff --git a/Ubiquitous/XiUOS/resources/lcd/drv_lcd.c b/Ubiquitous/XiUOS/resources/lcd/drv_lcd.c index dfd6e60a..fca9ba0c 100644 --- a/Ubiquitous/XiUOS/resources/lcd/drv_lcd.c +++ b/Ubiquitous/XiUOS/resources/lcd/drv_lcd.c @@ -29,7 +29,7 @@ static void LcdDrvLinkInit() InitDoubleLinkList(&lcddrv_linklist); } -DriverType LcdDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType LcdDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/pin/drv_pin.c b/Ubiquitous/XiUOS/resources/pin/drv_pin.c index 284c69a0..67b94b79 100644 --- a/Ubiquitous/XiUOS/resources/pin/drv_pin.c +++ b/Ubiquitous/XiUOS/resources/pin/drv_pin.c @@ -29,7 +29,7 @@ static void PinDrvLinkInit() InitDoubleLinkList(&pindrv_linklist); } -DriverType PinDriverFind(const char *drv_name, enum DriverType DrvType) +DriverType PinDriverFind(const char *drv_name, enum DriverType_e DrvType) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/rtc/drv_rtc.c b/Ubiquitous/XiUOS/resources/rtc/drv_rtc.c index 27638f08..bc4a1884 100644 --- a/Ubiquitous/XiUOS/resources/rtc/drv_rtc.c +++ b/Ubiquitous/XiUOS/resources/rtc/drv_rtc.c @@ -29,7 +29,7 @@ static void RtcDrvLinkInit() InitDoubleLinkList(&rtcdrv_linklist); } -DriverType RtcDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType RtcDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/serial/drv_serial.c b/Ubiquitous/XiUOS/resources/serial/drv_serial.c index d033811e..b0cf3a38 100644 --- a/Ubiquitous/XiUOS/resources/serial/drv_serial.c +++ b/Ubiquitous/XiUOS/resources/serial/drv_serial.c @@ -29,7 +29,7 @@ static void SerialDrvLinkInit() InitDoubleLinkList(&serialdrv_linklist); } -DriverType SerialDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType SerialDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/spi/drv_spi.c b/Ubiquitous/XiUOS/resources/spi/drv_spi.c index c59520ba..7dc1508c 100644 --- a/Ubiquitous/XiUOS/resources/spi/drv_spi.c +++ b/Ubiquitous/XiUOS/resources/spi/drv_spi.c @@ -29,7 +29,7 @@ static void SpiDrvLinkInit() InitDoubleLinkList(&spidrv_linklist); } -DriverType SpiDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType SpiDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/touch/drv_touch.c b/Ubiquitous/XiUOS/resources/touch/drv_touch.c index eec5caf8..e2d10782 100644 --- a/Ubiquitous/XiUOS/resources/touch/drv_touch.c +++ b/Ubiquitous/XiUOS/resources/touch/drv_touch.c @@ -29,7 +29,7 @@ static void TouchDrvLinkInit() InitDoubleLinkList(&touchdrv_linklist); } -DriverType TouchDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType TouchDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name); diff --git a/Ubiquitous/XiUOS/resources/usb/drv_usb.c b/Ubiquitous/XiUOS/resources/usb/drv_usb.c index 60332921..28095b40 100644 --- a/Ubiquitous/XiUOS/resources/usb/drv_usb.c +++ b/Ubiquitous/XiUOS/resources/usb/drv_usb.c @@ -30,7 +30,7 @@ static void UsbDrvLinkInit() } /*Find the regiter driver*/ -DriverType UsbDriverFind(const char *drv_name, enum DriverType drv_type) +DriverType UsbDriverFind(const char *drv_name, enum DriverType_e drv_type) { NULL_PARAM_CHECK(drv_name);