From f50dab2bde93034d60931c3396b066bc25aa42b3 Mon Sep 17 00:00:00 2001 From: chunyexixiaoyu <834670833@qq.com> Date: Wed, 21 Jul 2021 13:37:48 +0800 Subject: [PATCH] APP_Framework/Framework/:add rt-thread transform layer --- .../Applications/knowing_app/mnist/main.cpp | 6 ++- .../Framework/transform_layer/SConscript | 14 +++++++ .../transform_layer/rtthread/SConscript | 11 +++++ .../transform_layer/rtthread/transform.h | 41 +++++++++++++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 APP_Framework/Framework/transform_layer/SConscript create mode 100644 APP_Framework/Framework/transform_layer/rtthread/SConscript create mode 100644 APP_Framework/Framework/transform_layer/rtthread/transform.h diff --git a/APP_Framework/Applications/knowing_app/mnist/main.cpp b/APP_Framework/Applications/knowing_app/mnist/main.cpp index 02b5284d..6991dfa4 100644 --- a/APP_Framework/Applications/knowing_app/mnist/main.cpp +++ b/APP_Framework/Applications/knowing_app/mnist/main.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "tensorflow/lite/micro/all_ops_resolver.h" @@ -34,7 +34,7 @@ extern "C" void mnist_app() { return; } - tensor_arena = (uint8_t *)rt_malloc(kTensorArenaSize); + tensor_arena = (uint8_t *)malloc(kTensorArenaSize); if (tensor_arena == nullptr) { TF_LITE_REPORT_ERROR(error_reporter, "malloc for tensor_arena failed"); return; @@ -90,5 +90,7 @@ extern "C" void mnist_app() { } extern "C" { +#ifdef __RT_THREAD_H__ MSH_CMD_EXPORT(mnist_app, run mnist app); +#endif } diff --git a/APP_Framework/Framework/transform_layer/SConscript b/APP_Framework/Framework/transform_layer/SConscript new file mode 100644 index 00000000..f307e3f7 --- /dev/null +++ b/APP_Framework/Framework/transform_layer/SConscript @@ -0,0 +1,14 @@ +import os +Import('RTT_ROOT') +from building import * + +cwd = GetCurrentDir() +objs = [] +list = os.listdir(cwd) + +for d in list: + path = os.path.join(cwd, d) + if os.path.isfile(os.path.join(path, 'SConscript')): + objs = objs + SConscript(os.path.join(path, 'SConscript')) + +Return('objs') diff --git a/APP_Framework/Framework/transform_layer/rtthread/SConscript b/APP_Framework/Framework/transform_layer/rtthread/SConscript new file mode 100644 index 00000000..a6582ad2 --- /dev/null +++ b/APP_Framework/Framework/transform_layer/rtthread/SConscript @@ -0,0 +1,11 @@ +import os +from building import * +Import('RTT_ROOT') +Import('rtconfig') +cwd = GetCurrentDir() +DEPENDS = [""] + +SOURCES = [] +path = [cwd] +objs = DefineGroup('transform', src = SOURCES, depend = DEPENDS,CPPPATH = path) +Return("objs") \ No newline at end of file diff --git a/APP_Framework/Framework/transform_layer/rtthread/transform.h b/APP_Framework/Framework/transform_layer/rtthread/transform.h new file mode 100644 index 00000000..03ffd1d8 --- /dev/null +++ b/APP_Framework/Framework/transform_layer/rtthread/transform.h @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2020 AIIT XUOS Lab +* XiUOS 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 transform.h + * @brief Interface function declarations required by the framework + * @version 1.0 + * @author AIIT XUOS Lab + * @date 2021.06.04 + */ + +#ifndef TRANSFORM_H +#define TRANSFORM_H +#include +#include +#include +#include +#include +#include +#include +#ifdef RT_USING_POSIX_TERMIOS +#include +#endif +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file