Skip to content

Commit af70e69

Browse files
sidartGithub Executorch
authored andcommitted
Summary: Add Initial support to pico2 (Arm Cortex M)
Test Plan: TBD Reviewers: Subscribers: Tasks: Tags:
1 parent fc87462 commit af70e69

File tree

9 files changed

+414
-0
lines changed

9 files changed

+414
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ install(FILES tools/cmake/executorch-config.cmake
548548

549549
if(EXECUTORCH_BUILD_ARM_BAREMETAL)
550550
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/arm)
551+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/examples/arm/rp_pi)
551552
list(APPEND _executorch_backends executorch_delegate_ethos_u)
552553
endif()
553554

examples/arm/rp_pi/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
# Copyright 2023-2025 Arm Limited and/or its affiliates.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
cmake_minimum_required(VERSION 3.10)
9+
project(pico)
10+
11+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
12+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../)
13+
14+
15+
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/arm-cortex-m0plus-toolchain.cmake)
16+
17+
# Only include here, NOT in arm-cortex-m0plus-toolchain.cmake
18+
include(${CMAKE_SOURCE_DIR}/tools/cmake/Codegen.cmake)
19+
20+
target_sources(executorch_core PRIVATE ${CMAKE_CURRENT_LIST_DIR}/syscall_stubs.c)
21+
#gen_selected_ops(LIB_NAME "portable_ops_lib" ROOT_OPS "aten::add.out")

examples/arm/rp_pi/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Overview
2+
This document outlines the steps required to run a simple Add Module on the Pico2 microcontroller using executorch.
3+
## Steps
4+
5+
### (Pre-requisistes) Prepare the Environment for Arm
6+
1. See <a href="docs/source/backends-arm-ethos-u.md"/> for instructions on setting up the environment for Arm.
7+
2. Make sure you have the toolchain configured correctly.
8+
```bash
9+
which arm-none-eabi-gcc
10+
``` should return something like 'executorch/examples/arm/ethos-u-scratch/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc'
11+
12+
### 1. Cross Compile Executorch for Arm Cortex M Target
13+
To begin, navigate to the executorch root directory and execute the following commands:
14+
```bash
15+
mkdir baremetal_build
16+
cd baremetal_build
17+
cmake .. -DCMAKE_TOOLCHAIN_FILE=./examples/arm/rp_pi/pico2/arm-cortex-m0plus-toolchain.cmake -DEXECUTORCH_BUILD_ARM_BAREMETAL=ON -DCMAKE_BUILD_TYPE=Release -DROOT_OPS=aten::add.out
18+
cmake --build . -j$(nproc)
19+
```
20+
21+
### 2. Export PICO_SDK_PATH
22+
Download the Pico SDK from GitHub: https://github.com/raspberrypi/pico-sdk and set the PICO_SDK_PATH environment variable:
23+
```bash
24+
export PICO_SDK_PATH=<path_to_local_pico_sdk_folder>
25+
```
26+
27+
### 3. Build the example for Pico2
28+
Go to the example directory and initiate the build process:
29+
```bash
30+
cd examples/arm/rp_pi/pico2/
31+
rm -rf build
32+
mkdir build
33+
cd build
34+
cmake .. -DPICO_BOARD=pico2 -DCMAKE_BUILD_TYPE=Release
35+
cmake --build . -j$(nproc)
36+
```
37+
This will generate the firmware file executorch_pico.uf2.
38+
39+
### 4. Flash the Firmware
40+
Press and hold the BOOTSEL button on the Pico2.
41+
Connect the Pico2 to your computer; it should mount as RPI-RP2.
42+
Copy the executorch_pico.uf2 file to the mounted drive.
43+
44+
### 5. Verify the Firmware
45+
Check that the Pico2's LED blinks 10 times to confirm successful firmware execution.
46+
47+
### 6. (Optional) Check USB Logs on Mac
48+
To view USB logs, use the following command (as an example):
49+
```bash
50+
screen /dev/tty.usbmodem1101 115200
51+
```
52+
53+
These steps complete the process required to run the simple Add Module on the Pico2 microcontroller using executorch.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
# Copyright 2023-2025 Arm Limited and/or its affiliates.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
# cortex-m0plus cmake
9+
10+
if(NOT DEFINED EXECUTORCH_BUILD_ARM_BAREMETAL)
11+
# If not defined, assume we're building standalone
12+
set(EXECUTORCH_BUILD_ARM_BAREMETAL ON)
13+
endif()
14+
set(CMAKE_SYSTEM_NAME Generic)
15+
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus)
16+
17+
if(NOT DEFINED CMAKE_C_COMPILER)
18+
set(CMAKE_C_COMPILER arm-none-eabi-gcc CACHE STRING "C compiler")
19+
endif()
20+
21+
if(NOT DEFINED CMAKE_CXX_COMPILER)
22+
set(CMAKE_CXX_COMPILER arm-none-eabi-g++ CACHE STRING "C++ compiler")
23+
endif()
24+
25+
set(CPU_FLAGS "-mcpu=cortex-m0plus -mthumb -mfloat-abi=soft")
26+
# C flags (no RTTI or exceptions here, since RTTI is C++-only)
27+
set(CMAKE_C_FLAGS "${CPU_FLAGS} -O2 -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables")
28+
29+
# C++ flags (RTTI-related flags go here)
30+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-use-cxa-atexit -ffunction-sections -fdata-sections")
31+
32+
# Linker flags
33+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -nostartfiles -flto")
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
3+
project(executorch_pico C CXX ASM)
4+
pico_sdk_init()
5+
6+
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..)
7+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
8+
9+
# Replace xxx_pte.c with your model's pte file
10+
add_executable(executorch_pico main.cpp simple_addmodule_pte.c)
11+
pico_enable_stdio_usb(executorch_pico 1)
12+
pico_enable_stdio_uart(executorch_pico 0)
13+
14+
target_include_directories(executorch_pico PRIVATE
15+
${EXECUTORCH_ROOT}/executorch/runtime/core/portable_type/c10
16+
)
17+
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)
18+
19+
# Set correct flags for Pico (Cortex-M0+)
20+
target_compile_options(executorch_pico PRIVATE
21+
-mcpu=cortex-m0plus
22+
-mfloat-abi=soft
23+
-mthumb
24+
)
25+
26+
set(BAREMETAL_BUILD_DIR ${EXECUTORCH_ROOT}/executorch/baremetal_build/)
27+
# Link Executorch and Pico libraries
28+
target_link_libraries(executorch_pico
29+
PRIVATE
30+
${BAREMETAL_BUILD_DIR}/libexecutorch.a
31+
${BAREMETAL_BUILD_DIR}/libexecutorch_core.a
32+
-Wl,--whole-archive
33+
${BAREMETAL_BUILD_DIR}/kernels/portable/libportable_ops_lib.a
34+
-Wl,--no-whole-archive
35+
${BAREMETAL_BUILD_DIR}/kernels/portable/libportable_kernels.a
36+
pico_stdlib
37+
pico_stdio_usb
38+
)
39+
40+
# Include Executorch and third-party headers
41+
target_include_directories(executorch_pico PRIVATE
42+
${EXECUTORCH_ROOT}
43+
${EXECUTORCH_ROOT}/executorch/third-party/
44+
# Add other include paths as needed
45+
)
46+
47+
#set(CMAKE_C_FLAGS "-Os -ffunction-sections -fdata-sections")
48+
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections")
49+
50+
pico_add_extra_outputs(executorch_pico)

examples/arm/rp_pi/pico2/main.cpp

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
/* Copyright (c) Meta Platforms, Inc. and affiliates.
2+
* All rights reserved.
3+
* Copyright 2023-2025 Arm Limited and/or its affiliates.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
// Model data
10+
#include "simple_addmodule_pte.h"
11+
12+
// Pico includes
13+
#include "pico/stdio_usb.h"
14+
#include "pico/stdlib.h"
15+
16+
// Executorch includes
17+
#include <executorch/extension/data_loader/buffer_data_loader.h>
18+
#include <executorch/runtime/core/portable_type/scalar_type.h>
19+
#include <executorch/runtime/executor/method.h>
20+
#include <executorch/runtime/executor/program.h>
21+
#include <executorch/runtime/executor/memory_manager.h>
22+
#include <executorch/runtime/platform/runtime.h>
23+
24+
// Std c++ includes
25+
#include <memory>
26+
27+
using namespace executorch::runtime;
28+
using executorch::aten::Tensor;
29+
using executorch::aten::TensorImpl;
30+
using ScalarType = executorch::runtime::etensor::ScalarType;
31+
using executorch::runtime::runtime_init;
32+
33+
// Define GPIO pins for indicators
34+
const uint INDICATOR_PIN_1 = 25; // Onboard LED
35+
const uint INDICATOR_PIN_2 = 22; // External LED
36+
const uint INDICATOR_PIN_3 = 23; // Onboard LED
37+
38+
void wait_for_usb() {
39+
const int kMaxRetryCount = 10;
40+
int retry_usb_count = 0;
41+
while (!stdio_usb_connected() && retry_usb_count++ < kMaxRetryCount) {
42+
printf("Retry again! USB not connected \n");
43+
sleep_ms(100);
44+
}
45+
}
46+
47+
// Make sure blink_indicator is defined somewhere, or add a stub if not
48+
void blink_indicator(uint pin, int times, int delay_ms = 100) {
49+
for (int i = 0; i < times; ++i) {
50+
gpio_put(pin, 1);
51+
sleep_ms(delay_ms);
52+
gpio_put(pin, 0);
53+
sleep_ms(delay_ms);
54+
}
55+
}
56+
57+
bool load_and_prepare_model(std::unique_ptr<Program>& program_ptr, std::unique_ptr<Method>& method_ptr, MemoryManager& memory_manager) {
58+
executorch::extension::BufferDataLoader loader(model_pte, model_pte_len);
59+
auto program_result = Program::load(&loader);
60+
if (!program_result.ok()) {
61+
printf("Failed to load model: %d\n", (int)program_result.error());
62+
blink_indicator(INDICATOR_PIN_1, 10);
63+
return false;
64+
}
65+
program_ptr = std::make_unique<Program>(std::move(*program_result));
66+
auto method_name_result = program_ptr->get_method_name(0);
67+
if (!method_name_result.ok()) {
68+
printf("Failed to get method name: %d\n", (int)method_name_result.error());
69+
blink_indicator(INDICATOR_PIN_1, 10);
70+
return false;
71+
}
72+
auto method_result = program_ptr->load_method(*method_name_result, &memory_manager);
73+
if (!method_result.ok()) {
74+
printf("Failed to load method: %d\n", (int)method_result.error());
75+
blink_indicator(INDICATOR_PIN_1, 10);
76+
return false;
77+
}
78+
method_ptr = std::make_unique<Method>(std::move(*method_result));
79+
printf("Method loaded [%s]\n", *method_name_result);
80+
return true;
81+
}
82+
83+
bool run_inference(Method& method) {
84+
float input_data_0[4] = {4.0, 109.0, 13.0, 123.0};
85+
float input_data_1[4] = {9.0, 27.0, 11.0, 8.0};
86+
TensorImpl::SizesType sizes[1] = {4};
87+
TensorImpl::DimOrderType dim_order[] = {0};
88+
TensorImpl impl0(ScalarType::Float, 1, sizes, input_data_0, dim_order);
89+
TensorImpl impl1(ScalarType::Float, 1, sizes, input_data_1, dim_order);
90+
Tensor input0(&impl0);
91+
Tensor input1(&impl1);
92+
93+
if (method.set_input(input0, 0) != Error::Ok || method.set_input(input1, 1) != Error::Ok) {
94+
printf("Failed to set input(s)\n");
95+
blink_indicator(INDICATOR_PIN_1, 10);
96+
return false;
97+
}
98+
if (method.execute() != Error::Ok) {
99+
printf("Failed to execute\n");
100+
blink_indicator(INDICATOR_PIN_1, 10);
101+
return false;
102+
}
103+
const EValue& output = method.get_output(0);
104+
if (output.isTensor()) {
105+
const float* out_data = output.toTensor().const_data_ptr<float>();
106+
printf("Output: %f, %f, %f, %f\n", out_data[0], out_data[1], out_data[2], out_data[3]);
107+
} else {
108+
printf("Output is not a tensor!\n");
109+
blink_indicator(INDICATOR_PIN_1, 10);
110+
return false;
111+
}
112+
return true;
113+
}
114+
115+
int executor_runner() {
116+
stdio_init_all();
117+
sleep_ms(1000);
118+
119+
wait_for_usb();
120+
runtime_init();
121+
122+
static uint8_t method_allocator_pool[1024];
123+
static uint8_t activation_pool[512];
124+
MemoryAllocator method_allocator(sizeof(method_allocator_pool), method_allocator_pool);
125+
method_allocator.enable_profiling("method allocator");
126+
Span<uint8_t> memory_planned_buffers[1]{{activation_pool, sizeof(activation_pool)}};
127+
HierarchicalAllocator planned_memory({memory_planned_buffers, 1});
128+
MemoryManager memory_manager(&method_allocator, &planned_memory);
129+
130+
std::unique_ptr<Program> program_ptr;
131+
std::unique_ptr<Method> method_ptr;
132+
if (!load_and_prepare_model(program_ptr, method_ptr, memory_manager)) {
133+
printf("Failed to load and prepare model\n");
134+
return 1;
135+
}
136+
if (!run_inference(*method_ptr)) {
137+
printf("Failed to run inference\n");
138+
return 1;
139+
}
140+
141+
blink_indicator(INDICATOR_PIN_1, 100, 500);
142+
return 0;
143+
}
144+
145+
int main() {
146+
return executor_runner();
147+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* Copyright (c) Meta Platforms, Inc. and affiliates.
2+
* All rights reserved.
3+
* Copyright 2023-2025 Arm Limited and/or its affiliates.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#include "simple_addmodule_pte.h"
10+
11+
const uint8_t model_pte[] __attribute__((aligned(8))) = {
12+
0x1c, 0x00, 0x00, 0x00, 0x45, 0x54, 0x31, 0x32, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x10, 0x00, 0x00, 0x00,
13+
0x44, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
14+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15+
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x28, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x18, 0x00, 0x1c, 0x00,
16+
0x20, 0x00, 0x24, 0x00, 0x16, 0x00, 0x00, 0x00, 0x9c, 0x03, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
17+
0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18+
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0xfe, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x00,
19+
0x09, 0x00, 0x00, 0x00, 0x61, 0x74, 0x65, 0x6e, 0x3a, 0x3a, 0x61, 0x64, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x04, 0x00,
20+
0x08, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x24, 0xff, 0xff, 0xff,
21+
0x00, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22+
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
23+
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
24+
0x44, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25+
0x00, 0x00, 0x00, 0x00, 0x68, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x16, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00,
26+
0x00, 0x00, 0x10, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00,
27+
0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x08, 0x00,
28+
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0xba, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
29+
0x8c, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0e, 0x00,
30+
0x07, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x14, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00,
31+
0x00, 0x00, 0x10, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xe4, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
32+
0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00,
33+
0x48, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x5b, 0x31, 0x2c, 0x20, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22,
34+
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a,
35+
0x20, 0x5b, 0x5d, 0x7d, 0x5d, 0x00, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x5b, 0x31, 0x2c, 0x20, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69,
36+
0x6e, 0x73, 0x2e, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x6e, 0x75, 0x6c, 0x6c, 0x22, 0x2c, 0x20, 0x22, 0x63,
37+
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a, 0x20, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69,
38+
0x6e, 0x73, 0x2e, 0x74, 0x75, 0x70, 0x6c, 0x65, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x20, 0x22, 0x6e, 0x75, 0x6c, 0x6c, 0x22, 0x2c, 0x20, 0x22, 0x63,
39+
0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a, 0x20, 0x5b, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22,
40+
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a,
41+
0x20, 0x5b, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x20,
42+
0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a, 0x20, 0x5b, 0x5d, 0x7d, 0x5d, 0x7d, 0x2c, 0x20, 0x7b, 0x22,
43+
0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x73, 0x2e, 0x64, 0x69, 0x63, 0x74, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
44+
0x22, 0x3a, 0x20, 0x22, 0x5b, 0x5d, 0x22, 0x2c, 0x20, 0x22, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x22, 0x3a, 0x20, 0x5b, 0x5d, 0x7d, 0x5d, 0x7d, 0x5d,
45+
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x00, };
46+
47+
const unsigned int model_pte_len = sizeof(model_pte);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* Copyright (c) Meta Platforms, Inc. and affiliates.
2+
* All rights reserved.
3+
* Copyright 2023-2025 Arm Limited and/or its affiliates.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
#pragma once
10+
#include <stdint.h>
11+
12+
#ifdef __cplusplus
13+
extern "C" {
14+
#endif
15+
16+
extern const uint8_t model_pte[] __attribute__((aligned(8)));
17+
extern const unsigned int model_pte_len;
18+
19+
#ifdef __cplusplus
20+
}
21+
#endif

0 commit comments

Comments
 (0)