Skip to content

A toolkit which implements a configuration switching mechanism to allow running multiple instances of WebAssembly Micro Runtime (WAMR) at the same time on single-core microcontrollers

License

Notifications You must be signed in to change notification settings

Orange-OpenSource/cs4wamr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS4WAMR (Context Switching for WAMR)

Overview

The repository proposes a toolkit which implements a configuration switching mechanism to allows running multiple instances of WebAssembly Micro Runtime (WAMR) at the same time on single-core microcontrollers.

Citation

If you cite this work, please use:

B. Buil, C. Gaber, E. Baccelli, S. Bouzefrane. TinyML as a Service on Multi-Tenant Microcontrollers. Proceedings of the 22nd International Conference on Embedded Wireless Systems and Networks (EWSN 2025).

For more information on the work, you can read this publication.

Context-switching mechanism

The mechanism consists of running multiples instances of WAMR by saving the current instance, and creating or loading a new one.

Components

To use the mechanism, the tool is composed in two components:

  • a Firmware Analyzer Tool: to analyze the produce firmware and recuperate information about the memory of WAMR and inject these information in our library
  • a library to perform the context switch. The library is composed in three sub-libraries:
    • static_context_switcher: to perform the swapping,
    • wamr_env: to use multiple instances of WAMR by automatically using multi-static,
    • wamr_env_thread: to use wamr_env for having dedicated thread for the environments.

Usage

Clone the project with submodules using

git clone --recursive https://github.com/Orange-OpenSource/cs4wamr.git

Examples

We propose two examples of usage of the toolkit:

  • tiny-ml: an example of using the toolkit to run machine learning inference on microcontrollers among other applications.
  • demo: an example of using the toolkit to run concurrently multiple containers.

We also propose some performance evaluation on both using the framework and using WAMR directly. Such evaluations are:

  • model-inference: evaluation of inference time natively with microcontrollers, with WAMR interpreter and with WAMR AoT.
  • sizes: measurement of size usage by WAMR and CS4WAMR.
  • switch: evaluation of CS4WAMR performances on switch and snapshot.

Organization

Folders

  • /dependencies: dependencies used by the repository. See this to learn how to use the git submodules.
  • /examples: Example of application to use the WAMR Context Switch Toolkit.
  • /scripts: Scripts to setup and evaluate the project.
  • /src: Source code of the framework.

Supported environment

The toolkit and examples are made for the RIOT-OS. But the toolkit can easily be adapted to other platforms.

The library has been tested on the Arduino Nano 33 BLE, the DWM1001 and the nRF9160DK.

License

Copyright (c) Orange

This code is released under the MIT License. See the LICENSE file for more information.

Contributors

  • Bastien BUIL: Conceptualization and Software
  • Samuel LEGOUIX: Conceptualization
  • Chrystel GABER: Conceptualization

About

A toolkit which implements a configuration switching mechanism to allow running multiple instances of WebAssembly Micro Runtime (WAMR) at the same time on single-core microcontrollers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published