Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 14 additions & 9 deletions example/FVP_Audio/board/Corstone-300/Board-U55.clayer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
layer:
type: Board
description: Board setup for AI/ML with Ethos U55
description: Configuration of SSE-300 FVP for AI/ML with Ethos U55
for-board: ARM::V2M-MPS3-SSE-300-FVP
for-device: ARM::SSE-300-MPS3

Expand All @@ -17,17 +17,18 @@ layer:
- STDOUT
- STDERR
- Heap: 98304
consumes:
- CMSIS-RTOS2

define:
- CMSIS_target_header: \"Corstone-300.h\"
- ETHOSU_MACS: 128
- CORSTONE300_FVP

packs:
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.2.0
- pack: ARM::CMSIS-Ethos-U@^1.0.0-0
- pack: ARM::AVH_FVP
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.3.0
- pack: ARM::CMSIS-Ethos-U@^1.0.0
- pack: ARM::V2M_MPS3_SSE_300_BSP@1.5.0

components:
Expand All @@ -54,13 +55,17 @@ layer:
- component: Device:Native Driver:UART

- component: Machine Learning:NPU Support:Ethos-U Driver&Generic U55
define:
- ETHOSU_MACS: 128

groups:
- group: Board
files:
- file: ./main.c
- file: ./main.h
- file: ./ethos_setup.c
- file: main.c
- file: main.h
- file: ethos_setup.c
- file: ethosu_os_rtos2.c
- file: ethosu_dcache.c

linker:
- regions: ./regions_SSE-300.h
- regions: RTE/Device/SSE-300-MPS3/regions_SSE-300.h
23 changes: 14 additions & 9 deletions example/FVP_Audio/board/Corstone-300/Board-U65.clayer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
layer:
type: Board
description: Board setup for AI/ML with Ethos U65
description: Configuration of SSE-300 FVP for AI/ML with Ethos U65
for-board: ARM::V2M-MPS3-SSE-300-FVP
for-device: ARM::SSE-300-MPS3

Expand All @@ -17,17 +17,18 @@ layer:
- STDOUT
- STDERR
- Heap: 98304
consumes:
- CMSIS-RTOS2

define:
- CMSIS_target_header: \"Corstone-300.h\"
- ETHOSU_MACS: 256
- CORSTONE300_FVP

packs:
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.2.0
- pack: ARM::CMSIS-Ethos-U@^1.0.0-0
- pack: ARM::AVH_FVP
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.3.0
- pack: ARM::CMSIS-Ethos-U@^1.0.0
- pack: ARM::V2M_MPS3_SSE_300_BSP@1.5.0

components:
Expand All @@ -54,13 +55,17 @@ layer:
- component: Device:Native Driver:UART

- component: Machine Learning:NPU Support:Ethos-U Driver&Generic U65
define:
- ETHOSU_MACS: 256

groups:
- group: Board
files:
- file: ./main.c
- file: ./main.h
- file: ./ethos_setup.c
- file: main.c
- file: main.h
- file: ethos_setup.c
- file: ethosu_os_rtos2.c
- file: ethosu_dcache.c

linker:
- regions: ./regions_SSE-300.h
- regions: RTE/Device/SSE-300-MPS3/regions_SSE-300.h
12 changes: 6 additions & 6 deletions example/FVP_Audio/board/Corstone-300/Board.clayer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
layer:
type: Board
description: Board setup for AI/ML
description: Configuration of SSE-300 FVP for AI/ML
for-board: ARM::V2M-MPS3-SSE-300-FVP
for-device: ARM::SSE-300-MPS3

Expand All @@ -23,9 +23,9 @@ layer:
- CORSTONE300_FVP

packs:
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.2.0
- pack: ARM::AVH_FVP
- pack: ARM::CMSIS
- pack: ARM::CMSIS-Compiler@^2.3.0
- pack: ARM::V2M_MPS3_SSE_300_BSP@1.5.0

components:
Expand Down Expand Up @@ -54,8 +54,8 @@ layer:
groups:
- group: Board
files:
- file: ./main.c
- file: ./main.h
- file: main.c
- file: main.h

linker:
- regions: ./regions_SSE-300.h
- regions: RTE/Device/SSE-300-MPS3/regions_SSE-300.h
22 changes: 16 additions & 6 deletions example/FVP_Audio/board/Corstone-300/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# Board: Arm V2M-MPS3-SSE-300-FVP

## Board Layer for Corstone-300 FVP
## Board Layers for Corstone-300 FVP

This layer works for:
These layers work for:

```yml
board: ARM::V2M-MPS3-SSE-300-FVP
device: ARM::SSE-300-MPS3
```

Select one layer matching the application's NPU requirements:

| Layer file | Use in Application
|:---------------------|:------------------------
| Board.clayer.yml | Without Ethos-U support
| Board-U55.clayer.yml | With Ethos-U55 support
| Board-U65.clayer.yml | With Ethos-U65 support

Use the corresponding FVP configuration file listed below.

### System Configuration

| System Component | Setting
|:------------------------|:----------------------------------
| Heap | 96 kB (configured in linker file)
| Stack (MSP) | 32 kB (configured in linker file)
| Heap | 96 kB (configured in regions header)
| Stack (MSP) | 4 kB (configured in regions header)

### STDIO mapping

Expand Down Expand Up @@ -42,8 +52,8 @@ stores and loads signal values.
|:-----------------------|:----------------------------------------------------
| Driver_vStreamAudioIn | 16-bit PCM audio, 16000 samples/second
| Driver_vStreamAudioOut | 16-bit PCM audio, 16000 samples/second
| Driver_vStreamVideoIn | RGB888 video, resolution 1280 x 720 (W x H)
| Driver_vStreamVideoOut | RGB888 video, resolution 480 x 800 (W x H)
| Driver_vStreamVideoIn | RGB888 video, resolution 640 x 480 (W x H)
| Driver_vStreamVideoOut | RGB888 video, resolution 640 x 480 (W x H)

### FVP Configuration File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ LR_ROM1 __ROM1_BASE __ROM1_SIZE {

#if __RAM1_SIZE > 0
RW_RAM1 __RAM1_BASE __RAM1_SIZE {
; Ethos-U Cache Area
*.o (*ethos_cache_buf)

; NN Activation Tensor (activation buffer / tensor arena)
*.o (*activation_buf)
; Ethos-U writable area
*.o (ethos_arena)

.ANY (+RW +ZI)
}
Expand All @@ -99,8 +96,8 @@ LR_ROM1 __ROM1_BASE __ROM1_SIZE {
#if __ROM2_SIZE > 0
LR_ROM2 __ROM2_BASE __ROM2_SIZE {
ER_ROM2 +0 __ROM2_SIZE {
; NN Model Binary Representation
*.o (nn_model)
; Ethos-U model, command stream and constants
*.o (ethos_model)

.ANY (+RO +XO)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ PHDRS
ram PT_LOAD;
ram_init PT_LOAD;
tls PT_TLS;
#if __RAM1_SIZE > 0
ethos_ram PT_LOAD;
#endif
#if __ROM2_SIZE > 0
ethos_model PT_LOAD;
#endif
}

SECTIONS
Expand Down Expand Up @@ -317,6 +323,20 @@ SECTIONS
} >RAM0 :ram
#endif

/* Ethos-U writable area */
#if __RAM1_SIZE > 0
.ethos_arena (NOLOAD) : ALIGN(32) {
*(ethos_arena)
} >RAM1 AT>RAM1 :ethos_ram
#endif

/* Ethos-U model, command stream and constants */
#if __ROM2_SIZE > 0
.ethos_model : ALIGN(32) {
*(ethos_model)
} >ROM2 AT>ROM2 :ethos_model
#endif

/* Throw away C++ exception handling information */

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ SECTIONS
.cache (NOLOAD):
{
. = ALIGN(32);
*(*ethos_cache_buf) /* Ethos-U Cache Area */
*(*activation_buf) /* NN Activation Tensor (activation buffer / tensor arena) */
*(ethos_arena) /* Ethos-U writable area */
} > RAM1

/* Initialized buffers in fast access RAM */
Expand All @@ -331,7 +330,7 @@ SECTIONS

.rom2 :
{
*(*nn_model) /* NN Model Binary Representation */
*(ethos_model) /* Ethos-U model, command stream and constants */
} > ROM2

.rom3 :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,26 @@ if (!isempty(RAM0_region))
define block PROC_STACK with alignment = 8, size = 0 { };
define block HEAP with alignment = 8, size = __HEAP_SIZE { };
place in RAM0_region { readwrite, block PROC_STACK, block HEAP };
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
/* Reserve the stack seal immediately above the stack. */
define block STACKSEAL with alignment = 8, size = 8 { };
define block CSTACK_WITH_SEAL with fixed order { block CSTACK, block STACKSEAL };
place at end of RAM0_region { block CSTACK_WITH_SEAL };
#else
place at end of RAM0_region { block CSTACK };
#endif
}

/* Ethos-U writable area */
#if __RAM1_SIZE > 0
do not initialize { section ethos_arena };
define block ETHOS_ARENA with alignment = 32
{ section ethos_arena };
place in RAM1_region { block ETHOS_ARENA };
#endif

/* Ethos-U model, command stream and constants */
#if __ROM2_SIZE > 0
define block ETHOS_MODEL with alignment = 32 { readonly section ethos_model };
place in ROM2_region { block ETHOS_MODEL };
#endif
29 changes: 15 additions & 14 deletions example/FVP_Audio/board/Corstone-300/ethos_setup.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*---------------------------------------------------------------------------
* Copyright (c) 2025 Arm Limited (or its affiliates). All rights reserved.
/*
* Copyright 2025-2026 Arm Limited and/or its affiliates.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -14,7 +14,7 @@
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*---------------------------------------------------------------------------*/
*/

#include <stdio.h>

Expand All @@ -26,18 +26,18 @@

#if defined(ETHOSU65) || defined(ETHOSU85)
/* Define Ethos-U NPU cache buffer size */
#ifndef ETHOS_CACHE_BUF_SIZE
#define ETHOS_CACHE_BUF_SIZE 393216
#ifndef ETHOS_CACHE_SIZE
#define ETHOS_CACHE_SIZE 0
#endif

/* Define Ethos-U cache buffer alignment */
#ifndef ETHOS_CACHE_BUF_ALIGNMENT
#define ETHOS_CACHE_BUF_ALIGNMENT 32
#ifndef ETHOS_CACHE_ALIGNMENT
#define ETHOS_CACHE_ALIGNMENT 32
#endif

/* Define Ethos-U NPU cache buffer attributes */
#ifndef ETHOS_CACHE_BUF_ATTRIBUTES
#define ETHOS_CACHE_BUF_ATTRIBUTES __attribute__((section("ethos_cache_buf"), aligned(ETHOS_CACHE_BUF_ALIGNMENT)))
#ifndef ETHOS_CACHE_ATTRIBUTES
#define ETHOS_CACHE_ATTRIBUTES __attribute__((section("ethos_cache"), aligned(ETHOS_CACHE_ALIGNMENT)))
#endif
#endif

Expand All @@ -54,8 +54,9 @@
/* Ethos NPU driver instance. */
static struct ethosu_driver EthosDriver;

#if defined(ETHOSU65) || defined(ETHOSU85)
static uint8_t ethos_cache[ETHOS_CACHE_BUF_SIZE] ETHOS_CACHE_BUF_ATTRIBUTES;
#if (defined(ETHOSU65) || defined(ETHOSU85)) && (ETHOS_CACHE_SIZE > 0)
/* Ethos-U NPU cache buffer */
static uint8_t ethos_cache_buf[ETHOS_CACHE_SIZE] ETHOS_CACHE_ATTRIBUTES;
#endif

/*
Expand All @@ -76,9 +77,9 @@ void ethos_setup (void) {
/* Initialize Ethos-U NPU driver. */
rval = ethosu_init(&EthosDriver, /* Ethos-U device driver */
ethos_base_addr, /* Ethos-U base address */
#if defined(ETHOSU65) || defined(ETHOSU85)
ethos_cache, /* Cache memory pointer */
sizeof(ethos_cache), /* Cache memory size */
#if (defined(ETHOSU65) || defined(ETHOSU85)) && (ETHOS_CACHE_SIZE > 0)
ethos_cache_buf, /* Cache memory pointer */
sizeof(ethos_cache_buf), /* Cache memory size */
#else
0, /* Cache memory pointer */
0, /* Cache memory size */
Expand Down
Loading
Loading