-
Notifications
You must be signed in to change notification settings - Fork 626
Summary: Add Initial support to pico2 (Arm Cortex M) #12518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# Copyright 2023-2025 Arm Limited and/or its affiliates. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
cmake_minimum_required(VERSION 3.10) | ||
project(pico) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../) | ||
|
||
|
||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/arm-cortex-m0plus-toolchain.cmake) | ||
|
||
# Only include here, NOT in arm-cortex-m0plus-toolchain.cmake | ||
include(${CMAKE_SOURCE_DIR}/tools/cmake/Codegen.cmake) | ||
|
||
target_sources(executorch_core PRIVATE ${CMAKE_CURRENT_LIST_DIR}/syscall_stubs.c) | ||
#gen_selected_ops(LIB_NAME "portable_ops_lib" ROOT_OPS "aten::add.out") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
## Overview | ||
This document outlines the steps required to run a simple Add Module on the Pico2 microcontroller using executorch. | ||
## Steps | ||
|
||
### (Pre-requisistes) Prepare the Environment for Arm | ||
1. See <a href="docs/source/backends-arm-ethos-u.md"/> for instructions on setting up the environment for Arm. | ||
2. Make sure you have the toolchain configured correctly. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to link Arm page where to download this from? |
||
```bash | ||
which arm-none-eabi-gcc | ||
``` 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' | ||
|
||
### 1. Cross Compile Executorch for Arm Cortex M Target | ||
To begin, navigate to the executorch root directory and execute the following commands: | ||
```bash | ||
mkdir baremetal_build | ||
cd baremetal_build | ||
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 | ||
cmake --build . -j$(nproc) | ||
``` | ||
|
||
### 2. Export PICO_SDK_PATH | ||
Download the Pico SDK from GitHub: https://github.com/raspberrypi/pico-sdk and set the PICO_SDK_PATH environment variable: | ||
```bash | ||
export PICO_SDK_PATH=<path_to_local_pico_sdk_folder> | ||
``` | ||
|
||
### 3. Build the example for Pico2 | ||
Go to the example directory and initiate the build process: | ||
```bash | ||
cd examples/arm/rp_pi/pico2/ | ||
rm -rf build | ||
mkdir build | ||
cd build | ||
cmake .. -DPICO_BOARD=pico2 -DCMAKE_BUILD_TYPE=Release | ||
cmake --build . -j$(nproc) | ||
``` | ||
This will generate the firmware file executorch_pico.uf2. | ||
|
||
### 4. Flash the Firmware | ||
Press and hold the BOOTSEL button on the Pico2. | ||
Connect the Pico2 to your computer; it should mount as RPI-RP2. | ||
Copy the executorch_pico.uf2 file to the mounted drive. | ||
|
||
### 5. Verify the Firmware | ||
Check that the Pico2's LED blinks 10 times to confirm successful firmware execution. | ||
|
||
### 6. (Optional) Check USB Logs on Mac | ||
To view USB logs, use the following command (as an example): | ||
```bash | ||
screen /dev/tty.usbmodem1101 115200 | ||
``` | ||
|
||
These steps complete the process required to run the simple Add Module on the Pico2 microcontroller using executorch. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# Copyright 2023-2025 Arm Limited and/or its affiliates. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# cortex-m0plus cmake | ||
|
||
if(NOT DEFINED EXECUTORCH_BUILD_ARM_BAREMETAL) | ||
# If not defined, assume we're building standalone | ||
set(EXECUTORCH_BUILD_ARM_BAREMETAL ON) | ||
endif() | ||
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be in the toolchain file? |
||
set(CMAKE_SYSTEM_NAME Generic) | ||
set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus) | ||
|
||
if(NOT DEFINED CMAKE_C_COMPILER) | ||
set(CMAKE_C_COMPILER arm-none-eabi-gcc CACHE STRING "C compiler") | ||
endif() | ||
|
||
if(NOT DEFINED CMAKE_CXX_COMPILER) | ||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++ CACHE STRING "C++ compiler") | ||
endif() | ||
|
||
set(CPU_FLAGS "-mcpu=cortex-m0plus -mthumb -mfloat-abi=soft") | ||
# C flags (no RTTI or exceptions here, since RTTI is C++-only) | ||
set(CMAKE_C_FLAGS "${CPU_FLAGS} -O2 -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables") | ||
|
||
# C++ flags (RTTI-related flags go here) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-use-cxa-atexit -ffunction-sections -fdata-sections") | ||
|
||
# Linker flags | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -nostartfiles -flto") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake) | ||
project(executorch_pico C CXX ASM) | ||
pico_sdk_init() | ||
|
||
set(EXECUTORCH_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../../../..) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Replace xxx_pte.c with your model's pte file | ||
add_executable(executorch_pico main.cpp simple_addmodule_pte.c) | ||
pico_enable_stdio_usb(executorch_pico 1) | ||
pico_enable_stdio_uart(executorch_pico 0) | ||
|
||
target_include_directories(executorch_pico PRIVATE | ||
${EXECUTORCH_ROOT}/executorch/runtime/core/portable_type/c10 | ||
) | ||
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS) | ||
|
||
# Set correct flags for Pico (Cortex-M0+) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need these on top of the toolchain file? |
||
target_compile_options(executorch_pico PRIVATE | ||
-mcpu=cortex-m0plus | ||
-mfloat-abi=soft | ||
-mthumb | ||
) | ||
|
||
set(BAREMETAL_BUILD_DIR ${EXECUTORCH_ROOT}/executorch/baremetal_build/) | ||
# Link Executorch and Pico libraries | ||
target_link_libraries(executorch_pico | ||
PRIVATE | ||
${BAREMETAL_BUILD_DIR}/libexecutorch.a | ||
${BAREMETAL_BUILD_DIR}/libexecutorch_core.a | ||
-Wl,--whole-archive | ||
${BAREMETAL_BUILD_DIR}/kernels/portable/libportable_ops_lib.a | ||
-Wl,--no-whole-archive | ||
${BAREMETAL_BUILD_DIR}/kernels/portable/libportable_kernels.a | ||
pico_stdlib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure we don't also include newlib from the compiler, by checking symbols in the baremetal elf. |
||
pico_stdio_usb | ||
) | ||
|
||
# Include Executorch and third-party headers | ||
target_include_directories(executorch_pico PRIVATE | ||
${EXECUTORCH_ROOT} | ||
${EXECUTORCH_ROOT}/executorch/third-party/ | ||
# Add other include paths as needed | ||
) | ||
|
||
#set(CMAKE_C_FLAGS "-Os -ffunction-sections -fdata-sections") | ||
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections") | ||
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also in the toolchain file |
||
|
||
pico_add_extra_outputs(executorch_pico) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* Copyright 2023-2025 Arm Limited and/or its affiliates. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// Model data | ||
#include "simple_addmodule_pte.h" | ||
|
||
// Pico includes | ||
#include "pico/stdio_usb.h" | ||
#include "pico/stdlib.h" | ||
|
||
// Executorch includes | ||
#include <executorch/extension/data_loader/buffer_data_loader.h> | ||
#include <executorch/runtime/core/portable_type/scalar_type.h> | ||
#include <executorch/runtime/executor/method.h> | ||
#include <executorch/runtime/executor/program.h> | ||
#include <executorch/runtime/executor/memory_manager.h> | ||
#include <executorch/runtime/platform/runtime.h> | ||
|
||
// Std c++ includes | ||
#include <memory> | ||
|
||
using namespace executorch::runtime; | ||
using executorch::aten::Tensor; | ||
using executorch::aten::TensorImpl; | ||
using ScalarType = executorch::runtime::etensor::ScalarType; | ||
using executorch::runtime::runtime_init; | ||
|
||
// Define GPIO pins for indicators | ||
const uint INDICATOR_PIN_1 = 25; // Onboard LED | ||
const uint INDICATOR_PIN_2 = 22; // External LED | ||
const uint INDICATOR_PIN_3 = 23; // Onboard LED | ||
|
||
void wait_for_usb() { | ||
const int kMaxRetryCount = 10; | ||
int retry_usb_count = 0; | ||
while (!stdio_usb_connected() && retry_usb_count++ < kMaxRetryCount) { | ||
printf("Retry again! USB not connected \n"); | ||
sleep_ms(100); | ||
} | ||
} | ||
|
||
// Make sure blink_indicator is defined somewhere, or add a stub if not | ||
void blink_indicator(uint pin, int times, int delay_ms = 100) { | ||
for (int i = 0; i < times; ++i) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. somewhere the documentation says 10 times? |
||
gpio_put(pin, 1); | ||
sleep_ms(delay_ms); | ||
gpio_put(pin, 0); | ||
sleep_ms(delay_ms); | ||
} | ||
} | ||
|
||
bool load_and_prepare_model(std::unique_ptr<Program>& program_ptr, std::unique_ptr<Method>& method_ptr, MemoryManager& memory_manager) { | ||
executorch::extension::BufferDataLoader loader(model_pte, model_pte_len); | ||
auto program_result = Program::load(&loader); | ||
if (!program_result.ok()) { | ||
printf("Failed to load model: %d\n", (int)program_result.error()); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
program_ptr = std::make_unique<Program>(std::move(*program_result)); | ||
auto method_name_result = program_ptr->get_method_name(0); | ||
if (!method_name_result.ok()) { | ||
printf("Failed to get method name: %d\n", (int)method_name_result.error()); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
auto method_result = program_ptr->load_method(*method_name_result, &memory_manager); | ||
if (!method_result.ok()) { | ||
printf("Failed to load method: %d\n", (int)method_result.error()); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
method_ptr = std::make_unique<Method>(std::move(*method_result)); | ||
printf("Method loaded [%s]\n", *method_name_result); | ||
return true; | ||
} | ||
|
||
bool run_inference(Method& method) { | ||
float input_data_0[4] = {4.0, 109.0, 13.0, 123.0}; | ||
float input_data_1[4] = {9.0, 27.0, 11.0, 8.0}; | ||
TensorImpl::SizesType sizes[1] = {4}; | ||
TensorImpl::DimOrderType dim_order[] = {0}; | ||
TensorImpl impl0(ScalarType::Float, 1, sizes, input_data_0, dim_order); | ||
TensorImpl impl1(ScalarType::Float, 1, sizes, input_data_1, dim_order); | ||
Tensor input0(&impl0); | ||
Tensor input1(&impl1); | ||
|
||
if (method.set_input(input0, 0) != Error::Ok || method.set_input(input1, 1) != Error::Ok) { | ||
printf("Failed to set input(s)\n"); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
if (method.execute() != Error::Ok) { | ||
printf("Failed to execute\n"); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
const EValue& output = method.get_output(0); | ||
if (output.isTensor()) { | ||
const float* out_data = output.toTensor().const_data_ptr<float>(); | ||
printf("Output: %f, %f, %f, %f\n", out_data[0], out_data[1], out_data[2], out_data[3]); | ||
} else { | ||
printf("Output is not a tensor!\n"); | ||
blink_indicator(INDICATOR_PIN_1, 10); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
int executor_runner() { | ||
stdio_init_all(); | ||
sleep_ms(1000); | ||
|
||
wait_for_usb(); | ||
runtime_init(); | ||
|
||
static uint8_t method_allocator_pool[1024]; | ||
static uint8_t activation_pool[512]; | ||
MemoryAllocator method_allocator(sizeof(method_allocator_pool), method_allocator_pool); | ||
method_allocator.enable_profiling("method allocator"); | ||
Span<uint8_t> memory_planned_buffers[1]{{activation_pool, sizeof(activation_pool)}}; | ||
HierarchicalAllocator planned_memory({memory_planned_buffers, 1}); | ||
MemoryManager memory_manager(&method_allocator, &planned_memory); | ||
|
||
std::unique_ptr<Program> program_ptr; | ||
std::unique_ptr<Method> method_ptr; | ||
if (!load_and_prepare_model(program_ptr, method_ptr, memory_manager)) { | ||
printf("Failed to load and prepare model\n"); | ||
return 1; | ||
} | ||
if (!run_inference(*method_ptr)) { | ||
printf("Failed to run inference\n"); | ||
return 1; | ||
} | ||
|
||
blink_indicator(INDICATOR_PIN_1, 100, 500); | ||
return 0; | ||
} | ||
|
||
int main() { | ||
return executor_runner(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we write a simple python script which generates this from add nn.module? |
||
* All rights reserved. | ||
* Copyright 2023-2025 Arm Limited and/or its affiliates. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include "simple_addmodule_pte.h" | ||
|
||
const uint8_t model_pte[] __attribute__((aligned(8))) = { | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
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, | ||
0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x00, }; | ||
|
||
const unsigned int model_pte_len = sizeof(model_pte); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* All rights reserved. | ||
* Copyright 2023-2025 Arm Limited and/or its affiliates. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
#include <stdint.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern const uint8_t model_pte[] __attribute__((aligned(8))); | ||
extern const unsigned int model_pte_len; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this ok ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rp/raspberrypi :p
Do we want to signal that this is baremetal and not Raspberrry Pi 5 which runs Linux. I will leave it up to upi
Curious why under arm if we want to expand this to RISC-v?