IRNAS / irnas-zephyr-template

Template for Zephyr Projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Renode sample and documentation

MarkoSagadin opened this issue · comments

Context

Renode is a virtual development tool for multi-node embedded networks (both wired and wireless) and is intended to enable a scalable workflow for creating effective, tested and secure IoT systems.

https://github.com/renode/renode

Renode can take unmodified binaries (that you would run a physical board) and run them in a virtual environment.

On the surface it seems that Renode has a ton of features that would be useful in our embedded development.

Required steps

  • Research what Renode can bring to the table
  • Write out Implementation steps

Definition of Done

Above is done, reviewed and tested.

  1. Building advanced testing suites for Zephyr devices with Twister, Renode and Robot Framework - https://antmicro.com/blog/2023/05/building-advanced-testing-suites-with-zephyr-twister-renode-and-robot-framework/
  2. Providing synchronized multi-sensor data in Renode with RESD - https://antmicro.com/blog/2022/12/synchronized-multi-sensor-data-in-renode-with-resd/:
    • state saving and replaying, advanced hooks and events, comprehensive tracing, multi-core debugging, etc.
    • Adds a file format for data streams, each datapoint contains a timestamp, a global timestamp can be used
  3. Simulating NB-IoT networking in Renode - https://antmicro.com/blog/2023/03/nb-iot-support-in-renode/
    • Allows for simulation of the modem connecting and disconnecting, which is difficult to test in real life scenarios
  4. Testing Zephyr software using new CMock/Unity module and Renode - https://antmicro.com/blog/2023/03/testing-zephyr-software-with-cmock-unity/
    • Integration of CMock and Unity testing modules, we're familiar with those
  5. Bluetooth Mesh networking pathfinding algorithm development using Renode - https://antmicro.com/blog/2022/11/shortest-path-finding-in-bluetooth-mesh-using-renode/
    • Renode features a probabilistic packet loss simulation. Testing various levels of packet loss is virtually impossible in the real world - https://renode.readthedocs.io/en/latest/networking/wireless.html
    • You can control qualities of a wireless network: either all packets are delivered or they are only delivered if nodes are inside some specified distance or you use probabilistic loss of packets which depends on the distance.
      you can change the physical distance of the nodes inside a wireless network.
    • You can simulate and evaluate the performance of mesh networks.
  6. Demystifying software - different methods of execution tracing with Renode - https://antmicro.com/blog/2022/09/execution-tracing-in-renode/
  7. Renodepedia - From Zephyr’s structured data to traceable and testable open hardware with Renode - https://antmicro.com/blog/2022/08/renodepedia/
    • A collection of hardware, and data such as memory maps, execution traces and metrics, as well as UART output from real runs
    • Enables browsing of SoC, should new hardware be explored at some point in the future
  8. Developing and testing BLE products on nRF52840 in Renode and Zephyr - https://antmicro.com/blog/2022/04/developing-and-testing-ble-on-nrf52840-with-renode-and-zephyr/
  9. Precursor: Renode for developing advanced products with embedded GUIs - https://antmicro.com/blog/2022/03/precursor-developing-advanced-products-with-renode/
    • You can test GUI, you can upload raw bitmaps and verify against them, you can have a functional emulated touch-screen.
  10. Renode-based CI for TensorFlow Lite MCU - https://antmicro.com/blog/2021/03/renode-based-ci-for-tensorflow-lite-micro/
    • You can load raw data to a accelereometer senor and test against it. Same can be done for image or sound.
    • You can write your own peripheral files that you can use for simulation. C# is expected to be used, but you can also write more complex logic in Python.

Not connected to blogs:

  • You can debug chips with multiple cores, this is good as nrf5340 as two cores.
  • You can save the state of entire emulation and share it with team to solve the problems collaboratively.
  • Antmicro wrote pyrenode, a Python library to talk to the Renode programatically.
  • You can create a BLE peripheral in one simulation window and a BLE central peripheral in another and have them to talk to each other.
  • Renode supports Robot Framework, a generic open source automation framework.

Implementation steps

  1. Create samples/renode sample in this repo.
  2. Create a simple firmware for nrf52840dk that:
    • Has enabled GPIO shell
    • Has interrupt configured on a specific GPIO line
    • Implements a shell command that can take a single sample from lis2dw12 accelerometer and calculate gravity vector.
    • Implements a shell command that can start/stop BLE advertising with fixed payload.
  3. Write .robot test file that tests above firmware
  4. Write .resc test file that can start Renode simulation for nrf52840 board
  5. Write shell scripts that can be used for the development (easy to use, gdb setup). Place them into scripts/renode folder.
  6. Write documentation in the README:
    • What sample does
    • How it can be run
    • How to install Renode (installation script is probably best for this)