IRNAS / irnas-zephyr-template

Template for Zephyr Projects
3 stars 1 forks source link

Renode sample and documentation #9

Closed MarkoSagadin closed 1 year ago

MarkoSagadin commented 1 year ago

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

Definition of Done

Above is done, reviewed and tested.

MarkoSagadin commented 1 year ago
  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:

MarkoSagadin commented 1 year ago

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)