alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | /* |
Kshitij Sisodia | 26bc923 | 2023-03-10 16:33:23 +0000 | [diff] [blame] | 2 | * SPDX-FileCopyrightText: Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 3 | * 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 */ |
alexander | 31ae9f0 | 2022-02-10 16:15:54 +0000 | [diff] [blame] | 23 | #include "log_macros.h" |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 24 | #include "TensorFlowLiteMicro.hpp" /* our inference logic api */ |
| 25 | |
| 26 | #include <cstdio> |
| 27 | |
Kshitij Sisodia | 4cc4021 | 2022-04-08 09:54:53 +0100 | [diff] [blame] | 28 | extern void main_loop(); |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 29 | |
| 30 | #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) |
| 31 | __ASM(" .global __ARM_use_no_argv\n"); |
| 32 | #endif |
| 33 | |
| 34 | /* Print application information. */ |
| 35 | static void print_application_intro() |
| 36 | { |
| 37 | info("%s\n", PRJ_DES_STR); |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 38 | info("Version %s Build date: " __DATE__ " @ " __TIME__ "\n", PRJ_VER_STR); |
Kshitij Sisodia | 26bc923 | 2023-03-10 16:33:23 +0000 | [diff] [blame] | 39 | info("Copyright 2021-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>\n\n"); |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | int main () |
| 43 | { |
Kshitij Sisodia | 4cc4021 | 2022-04-08 09:54:53 +0100 | [diff] [blame] | 44 | if (hal_platform_init()) { |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 45 | /* Application information, UART should have been initialised. */ |
| 46 | print_application_intro(); |
| 47 | |
| 48 | /* Check the version of TensorFlow Lite Micro. */ |
| 49 | PrintTensorFlowVersion(); |
| 50 | |
| 51 | /* Run the application. */ |
Kshitij Sisodia | 4cc4021 | 2022-04-08 09:54:53 +0100 | [diff] [blame] | 52 | main_loop(); |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | /* This is unreachable without errors. */ |
| 56 | info("program terminating...\n"); |
| 57 | |
| 58 | /* Release platform. */ |
Kshitij Sisodia | 4cc4021 | 2022-04-08 09:54:53 +0100 | [diff] [blame] | 59 | hal_platform_release(); |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 60 | return 0; |
| 61 | } |