Skip to content

Commit e20d889

Browse files
Merge pull request #145 from kshitij-sisodia-arm/feature/od-vsi-support
MLECO-4536: Adding VSI video support
2 parents 7454494 + e18f3f2 commit e20d889

23 files changed

+3155
-57
lines changed

cmsis-pack-examples/README.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
- [Prerequisites](#prerequisites)
1515
- [Visual Studio Code](#visual-studio-code)
1616
- [Packs](#packs)
17+
- [Virtual Streaming Interface](#virtual-streaming-interface)
1718
- [Building the examples](#building-the-examples)
1819
- [Launch project in Visual Studio Code](#launch-project-in-visual-studio-code)
1920
- [Download Software Packs](#download-software-packs)
2021
- [Generate and build the project](#generate-and-build-the-project)
21-
- [Execute project](#execute-project)
22+
- [Execute Project](#execute-project)
23+
- [Working with Virtual Streaming Interface](#working-with-virtual-streaming-interface)
2224
- [Application output](#application-output)
2325
- [Trademarks](#trademarks)
2426
- [Licenses](#licenses)
@@ -107,6 +109,33 @@ CMSIS-Pack defines a standardized way to deliver software components, device par
107109
support information and code. A list of available CMSIS-Packs can be found
108110
[here](https://developer.arm.com/tools-and-software/embedded/cmsis/cmsis-packs).
109111

112+
## Virtual Streaming Interface
113+
114+
[Virtual Streaming Interface)](https://arm-software.github.io/AVH/main/simulation/html/group__arm__vsi.html)
115+
(VSI) is available for certain
116+
[Fixed Virtual Platform](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms) (FVP) or
117+
[Arm Virtual Hardware](https://developer.arm.com/Tools%20and%20Software/Arm%20Virtual%20Hardware) (AVH)
118+
targets. For VSI supported examples, you may need to install some dependencies.
119+
120+
For more details and up-to-date requirements, see
121+
[Python environment setup](https://arm-software.github.io/AVH/main/simulation/html/group__arm__vsi__pyenv.html)
122+
which mentions:
123+
124+
> The following packages are required on Linux systems (Ubuntu 20.04 and later):
125+
> - libatomic1
126+
> - python3.9
127+
> - python3-pip
128+
129+
In addition to the above, the VSI Python scripts depend on `opencv-python` package. We recommend using
130+
a virtual environment and installing this with pip.
131+
132+
```shell
133+
$ pip install opencv-python
134+
```
135+
136+
**NOTE**: The requirement for Python version is driven by the FVP executable. Versions <= 11.26 require
137+
Python3.9 but this may change for future releases.
138+
110139
# Building the examples
111140

112141
## Launch project in Visual Studio Code
@@ -181,12 +210,12 @@ Build complete
181210

182211
The built artifacts will be located under the `out/` directory in the project root.
183212

184-
## Execute project
213+
## Execute Project
185214

186215
The project is configured for execution on Arm Virtual Hardware which removes the requirement for
187216
a physical hardware board.
188217

189-
- When using a Fixed Virtual Platform installed locally:
218+
- When using a Fixed Virtual Platform (FVP) installed locally:
190219
```shell
191220
$ <path_to_installed_FVP> -a ./out/kws/AVH-SSE-300-U55/Debug/kws.Debug+AVH-SSE-300-U55.axf -f ./FVP/FVP_Corstone_SSE-300/fvp_config.txt
192221
```
@@ -218,6 +247,21 @@ For example:
218247
$ cp ./out/kws/STM32F746-DISCO/Release/kws.Release+STM32F746-DISCO.bin /media/user/DIS_F746NG/ && sync
219248
```
220249

250+
### Working with Virtual Streaming Interface
251+
252+
The object detection example for Arm Corstone-300 and Corstone-310 supports Virtual Streaming Interface (VSI).
253+
This allows the locally installed FVP application (or an AVH instance) to read images in from a camera connected to
254+
your local machine and stream these over to the application running within the FVP.
255+
256+
To run the VSI application, append the command line with the v_path argument. For example:
257+
258+
```shell
259+
$ <path_to_installed_FVP> \
260+
-a ./out/object-detection-vsi/AVH-SSE-300-U55/Release/object-detection-vsi.axf \
261+
-C ethosu.num_macs=256 \
262+
-C mps3_board.v_path=./device/corstone/vsi/video/python/
263+
```
264+
221265
## Application output
222266

223267
Once the project can be built successfully, the execution on target hardware will show output of
@@ -378,4 +422,21 @@ spot immediately. Please help us improve this section by reporting them via GitH
378422
Currently Keil Studio Cloud only supports running with the Arm® Ethos™-U55 on AVH
379423
virtual targets.
380424
You can build the project but will have to run it on your local machine on an
381-
installation of the equivalent Fixed Virtual Platform containing Arm® Ethos™-U65 NPU.
425+
installation of the equivalent Fixed Virtual Platform containing Arm® Ethos™-U65 NPU.
426+
427+
7. The newer versions of BSP packs for Arm® Corstone™-300 and Arm® Corstone™-310 require CMSIS 6.
428+
There are warnings about some unsatisfied requirements because of this. For example:
429+
```shell
430+
MISSING ARM::Device:[email protected]
431+
require CMSIS:[email protected]
432+
MISSING ARM::Device:Native Driver:[email protected]
433+
require CMSIS:[email protected]
434+
MISSING ARM::Device:Native Driver:[email protected]
435+
require CMSIS:[email protected]
436+
MISSING ARM::Device:Native Driver:[email protected]
437+
require CMSIS:[email protected]
438+
MISSING ARM::Device:Startup&C [email protected]
439+
require CMSIS:[email protected]
440+
```
441+
These are expected to be resolved once we bump up the version of CMSIS core pack. Currently,
442+
this is blocked by other dependencies.

cmsis-pack-examples/device/alif-ensemble/alif-ensemble-E7-device.clayer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ layer:
6767
- component: AlifSemiconductor::Device:SOC Peripherals:PINCONF
6868
- component: AlifSemiconductor::Device:SOC Peripherals:MHU
6969
- component: AlifSemiconductor::Device:Startup
70-
- component: ARM::CMSIS Driver:USART
7170
- component: ARM::CMSIS Driver:USART:Custom
7271

7372
- component: AlifSemiconductor::Device:SOC Peripherals:DMA

cmsis-pack-examples/device/corstone/src/BoardInit.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ static void arm_ethosu_npu_irq_handler(void)
6666
/** @brief Initialises the NPU IRQ */
6767
static void arm_ethosu_npu_irq_init(void)
6868
{
69-
const IRQn_Type ethosu_irqnum = (IRQn_Type)ETHOS_U55_IRQn;
69+
#if defined(CORSTONE310_FVP)
70+
const IRQn_Type ethosu_irqnum = (IRQn_Type)NPU0_IRQn;
71+
#else
72+
const IRQn_Type ethosu_irqnum = (IRQn_Type)ETHOS_U55_IRQn;
73+
#endif
7074

7175
/* Register the EthosU IRQ handler in our vector table.
7276
* Note, this handler comes from the EthosU driver */
@@ -87,7 +91,11 @@ static int arm_ethosu_npu_init(void)
8791
arm_ethosu_npu_irq_init();
8892

8993
/* Initialise Ethos-U device */
90-
void* const ethosu_base_address = (void*)(ETHOS_U55_APB_BASE_S);
94+
#if defined(CORSTONE310_FVP)
95+
void* const ethosu_base_address = (void*)(NPU0_APB_BASE_NS);
96+
#else
97+
void* const ethosu_base_address = (void*)(ETHOS_U55_APB_BASE_S);
98+
#endif
9199

92100
debug("Cache arena: 0x%p\n", get_cache_arena());
93101

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
* Copyright (c) 2021-2022 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the License); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/*
20+
* Virtual Streaming Interface (VSI)
21+
*/
22+
23+
#ifndef __ARM_VSI_H
24+
#define __ARM_VSI_H
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
#ifndef __IM
31+
#define __IM volatile const /*! Defines 'read only' structure member permissions */
32+
#endif
33+
#ifndef __OM
34+
#define __OM volatile /*! Defines 'write only' structure member permissions */
35+
#endif
36+
#ifndef __IOM
37+
#define __IOM volatile /*! Defines 'read/write' structure member permissions */
38+
#endif
39+
40+
#include <stdint.h>
41+
42+
/// Structure type to access the virtual streaming interface
43+
typedef struct
44+
{
45+
/// Interrupt Request (IRQ)
46+
struct {
47+
__IOM uint32_t Enable; /*!< (R/W) IRQ Enable */
48+
__OM uint32_t Set; /*!< (-/W) IRQ Set */
49+
__OM uint32_t Clear; /*!< (-/W) IRQ Clear */
50+
__IM uint32_t Status; /*!< (R/-) IRQ Status */
51+
} IRQ;
52+
uint32_t reserved1[60];
53+
/// Time counter with 1MHz input frequency
54+
struct {
55+
__IOM uint32_t Control; /*!< (R/W) Timer Control */
56+
__IOM uint32_t Interval; /*!< (R/W) Timer Interval Value (in microseconds) */
57+
__IM uint32_t Count; /*!< (R/-) Timer Overflow Count */
58+
} Timer;
59+
uint32_t reserved2[61];
60+
/// Direct Memory Access (DMA) Controller
61+
struct {
62+
__IOM uint32_t Control; /*!< (R/W) DMA Control */
63+
__IOM uint32_t Address; /*!< (R/W) DMA Memory Start Address */
64+
__IOM uint32_t BlockSize; /*!< (R/W) DMA Block Size (in bytes, multiple of 4) */
65+
__IOM uint32_t BlockNum; /*!< (R/W) DMA Number of Blocks (must be 2^n) */
66+
__IM uint32_t BlockIndex; /*!< (R/-) DMA Block Index */
67+
} DMA;
68+
uint32_t reserved3[59];
69+
__IOM uint32_t Regs[64]; /*!< (R/W) User Registers */
70+
} ARM_VSI_Type;
71+
72+
/* VSI Timer Control Definitions for Timer.Control register */
73+
#define ARM_VSI_Timer_Run_Pos 0U /*!< Timer Control: Run Position */
74+
#define ARM_VSI_Timer_Run_Msk (1UL << ARM_VSI_Timer_Run_Pos) /*!< Timer Control: Run Mask */
75+
#define ARM_VSI_Timer_Periodic_Pos 1U /*!< Timer Control: Periodic Position */
76+
#define ARM_VSI_Timer_Periodic_Msk (1UL << ARM_VSI_Timer_Periodic_Pos) /*!< Timer Control: Periodic Mask */
77+
#define ARM_VSI_Timer_Trig_IRQ_Pos 2U /*!< Timer Control: Trig_IRQ Position */
78+
#define ARM_VSI_Timer_Trig_IRQ_Msk (1UL << ARM_VSI_Timer_Trig_IRQ_Pos) /*!< Timer Control: Trig_IRQ Mask */
79+
#define ARM_VSI_Timer_Trig_DMA_Pos 3U /*!< Timer Control: Trig_DAM Position */
80+
#define ARM_VSI_Timer_Trig_DMA_Msk (1UL << ARM_VSI_Timer_Trig_DMA_Pos) /*!< Timer Control: Trig_DMA Mask */
81+
82+
/* VSI DMA Control Definitions for DMA.Control register */
83+
#define ARM_VSI_DMA_Enable_Pos 0U /*!< DMA Control: Enable Position */
84+
#define ARM_VSI_DMA_Enable_Msk (1UL << ARM_VSI_DMA_Enable_Pos) /*!< DMA Control: Enable Mask */
85+
#define ARM_VSI_DMA_Direction_Pos 1U /*!< DMA Control: Direction Position */
86+
#define ARM_VSI_DMA_Direction_Msk (1UL << ARM_VSI_DMA_Direction_Pos) /*!< DMA Control: Direction Mask */
87+
#define ARM_VSI_DMA_Direction_P2M (0UL*ARM_VSI_DMA_Direction_Msk) /*!< DMA Control: Direction P2M */
88+
#define ARM_VSI_DMA_Direction_M2P (1UL*ARM_VSI_DMA_Direction_Msk) /*!< DMA Control: Direction M2P */
89+
90+
/* Memory mapping of 8 VSI peripherals */
91+
#define ARM_VSI0_BASE (0x4FF00000UL) /*!< VSI 0 Base Address */
92+
#define ARM_VSI1_BASE (0x4FF10000UL) /*!< VSI 1 Base Address */
93+
#define ARM_VSI2_BASE (0x4FF20000UL) /*!< VSI 2 Base Address */
94+
#define ARM_VSI3_BASE (0x4FF30000UL) /*!< VSI 3 Base Address */
95+
#define ARM_VSI4_BASE (0x4FF40000UL) /*!< VSI 4 Base Address */
96+
#define ARM_VSI5_BASE (0x4FF50000UL) /*!< VSI 5 Base Address */
97+
#define ARM_VSI6_BASE (0x4FF60000UL) /*!< VSI 6 Base Address */
98+
#define ARM_VSI7_BASE (0x4FF70000UL) /*!< VSI 7 Base Address */
99+
#define ARM_VSI0 ((ARM_VSI_Type *)ARM_VSI0_BASE) /*!< VSI 0 struct */
100+
#define ARM_VSI1 ((ARM_VSI_Type *)ARM_VSI1_BASE) /*!< VSI 1 struct */
101+
#define ARM_VSI2 ((ARM_VSI_Type *)ARM_VSI2_BASE) /*!< VSI 2 struct */
102+
#define ARM_VSI3 ((ARM_VSI_Type *)ARM_VSI3_BASE) /*!< VSI 3 struct */
103+
#define ARM_VSI4 ((ARM_VSI_Type *)ARM_VSI4_BASE) /*!< VSI 4 struct */
104+
#define ARM_VSI5 ((ARM_VSI_Type *)ARM_VSI5_BASE) /*!< VSI 5 struct */
105+
#define ARM_VSI6 ((ARM_VSI_Type *)ARM_VSI6_BASE) /*!< VSI 6 struct */
106+
#define ARM_VSI7 ((ARM_VSI_Type *)ARM_VSI7_BASE) /*!< VSI 7 struct */
107+
108+
#ifdef __cplusplus
109+
}
110+
#endif
111+
112+
#endif /* __ARM_VSI_H */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Origin of files in this directory
2+
3+
- `include`: https://github.com/ARM-software/AVH/tree/1d9e2b02001a6e5d8f2fd622e5cf301144604007/interface/include
4+
- `video`: https://github.com/ARM-software/AVH/tree/1d9e2b02001a6e5d8f2fd622e5cf301144604007/interface/video
5+
6+
**Note**: Files in this repository and files from [AVH repository](https://github.com/ARM-software/AVH/)
7+
should be under the same license terms.
8+
9+
* See [AVH repository LICENSE](https://github.com/ARM-software/AVH/blob/1d9e2b02001a6e5d8f2fd622e5cf301144604007/LICENSE)
10+
* This repository's [LICENSE](../../../LICENSE)

0 commit comments

Comments
 (0)