blob: e27d5b587cc509ec897e52cfd855f2b17e10df3d [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
Isabella Gottardiee4920b2022-02-25 14:29:32 +00002 * Copyright (c) 2021-2022 Arm Limited. All rights reserved.
alexander3c798932021-03-26 21:42:19 +00003 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/****************************************************************************\
19 * Main application file for ARM NPU on MPS3 board *
20\****************************************************************************/
21
22#include "hal.h" /* our hardware abstraction api */
alexander31ae9f02022-02-10 16:15:54 +000023#include "log_macros.h"
alexander3c798932021-03-26 21:42:19 +000024#include "TensorFlowLiteMicro.hpp" /* our inference logic api */
25
26#include <cstdio>
27
28extern void main_loop(hal_platform& platform);
29
30#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
31__ASM(" .global __ARM_use_no_argv\n");
32#endif
33
34/* Print application information. */
35static void print_application_intro()
36{
37 info("%s\n", PRJ_DES_STR);
alexander3c798932021-03-26 21:42:19 +000038 info("Version %s Build date: " __DATE__ " @ " __TIME__ "\n", PRJ_VER_STR);
Isabella Gottardiee4920b2022-02-25 14:29:32 +000039 info("Copyright (C) ARM Ltd 2021-2022. All rights reserved.\n\n");
alexander3c798932021-03-26 21:42:19 +000040}
41
42int main ()
43{
44 hal_platform platform;
alexander3c798932021-03-26 21:42:19 +000045 platform_timer timer;
46
47 /* Initialise the HAL and platform. */
Kshitij Sisodia68fdd112022-04-06 13:03:20 +010048 hal_init(&platform, &timer);
alexander3c798932021-03-26 21:42:19 +000049
50 if (0 == hal_platform_init(&platform)) {
51 /* Application information, UART should have been initialised. */
52 print_application_intro();
53
54 /* Check the version of TensorFlow Lite Micro. */
55 PrintTensorFlowVersion();
56
57 /* Run the application. */
58 main_loop(platform);
59 }
60
61 /* This is unreachable without errors. */
62 info("program terminating...\n");
63
64 /* Release platform. */
65 hal_platform_release(&platform);
66 return 0;
67}