Spresense マルチコア開発向けユーティリティライブラリです。
Utility library for Sony Spresense multi-core development.
MultiCoreUtil は、Sony Spresense のマルチコア開発を簡単にするためのユーティリティライブラリです。
MultiCoreUtil provides utility classes for easier multi-core development on Sony Spresense.
Spresense の MP (MultiProcessor) ライブラリを利用したアプリケーション向けに、
- 共有メモリ管理
- コア間データ転送
- 同期制御
などを簡単に扱える機能を提供します。
It provides helper features for applications using the Spresense MP (MultiProcessor) library, including:
- shared memory management
- inter-core data transfer
- synchronization utilities
現在、以下の機能を含みます。
Currently includes the following components.
共有メモリ領域をまとめて確保・管理するユーティリティです。
Utility for allocating and managing shared memory regions.
主な用途:
- MainCore / SubCore 間共有メモリ
- センサデータ共有
- 音声バッファ共有
- フレームバッファ共有
Typical use cases:
- shared memory between MainCore and SubCore
- sensor data sharing
- audio buffer sharing
- frame buffer sharing
コア間通信向けリングバッファです。
Ring buffer for inter-core communication.
以下の特徴を持ちます。
- 固定長
- ノンブロッキング
- 型安全
- テンプレートベース
Features:
- fixed-size
- non-blocking
- type-safe
- template-based implementation
リアルタイム処理やセンサデータ転送に向いています。
Suitable for realtime processing and sensor data transfer.
struct SensorData {
float acc[3];
float gyro[3];
};
InterCoreRingBuffer<SensorData, 128> ringBuf;軽量スピンロック実装です。
Lightweight spin lock implementation.
共有データの保護や、複数コア間の同期制御に利用します。
Used for shared data protection and synchronization across cores.
- Sony Spresense
- Arduino IDE
- Spresense Arduino SDK
- MP (MultiProcessor) library
Arduino の libraries フォルダへ clone してください。
Clone this repository into your Arduino libraries folder.
cd ~/Arduino/libraries
git clone https://github.com/Interested-In-Spresense/MultiCoreUtil.gitArduino IDE を再起動すると利用できます。
Restart Arduino IDE after installation.
必要なヘッダを include してください。
Include the required headers.
#include <SharedMemoryAllocator.h>
#include <InterCoreRingBuffer.h>
#include <MultiCoreSpinLock.h>examples/ フォルダにサンプルコードがあります。
Example sketches are available in the examples/ directory.
-
一部機能は MainCore 側専用です
Some features are intended for MainCore-side usage only. -
InterCoreRingBufferは Single Producer / Single Consumer 前提です
InterCoreRingBufferassumes Single Producer / Single Consumer usage. -
リアルタイム用途では十分なバッファサイズを確保してください
Use sufficient buffer sizes for realtime applications. -
大きなデータは共有メモリ+ポインタ運用を推奨します
For large data, shared memory + pointer-based transfer is recommended.
https://github.com/Interested-In-Spresense/sketches
Spresense 向け各種サンプルスケッチ集です。
Collection of example sketches for Spresense.
MultiCore/ManySensorMultiCore/SpinLockVerification
LGPL v2.1 or later