Renode is often used for deterministic and scalable testing of consumer-grade products like in the case of STM32F412 and STM32H743 microcontrollers used in the ChromiumOS’ FPMCU (Fingerprint Firmware) module found in Chromebooks – an effort described in detail in our previous blog note.
Antmicro’s ongoing collaboration with the Google ChromeOS team involves adding support for other microcontrollers used by the Chromebook products. Most recently, we were able to enable testing of a new platform codenamed helipilot
, based on the ARM Cortex-M4 core Nuvoton NPCX9 embedded controller, to support new cases in both FPMCU and the EC project.
With this addition, we are also glad to welcome the first platform manufactured by Nuvoton to Renode’s open source ecosystem. This blog note will walk you through the extent of the support added so far and testing coverage for the new platform, discuss nuances of this implementation, as well as provide demos you can run yourself in Renode.
NPCX9 platform description and bootloader
Support in Renode introduced as part of this project features developing a Renode platform description covering the memory map of the NPCX9, on top of which we have also added the interrupt system with connections between the implemented blocks, including:
- UART
- SPI
- ITIM32 timer
- TWD module
- MTC timer
- parts of Nuvoton Cryptographic Library (SHA256 and random number generation).
Loading software on the board was one of the more interesting aspects of the project. Typically, software is held in NPCX9 FLASH from which it is then copied by a proprietary bootloader to RAM to be executed by the processor. The bootloader plays a very important part in how FPMCU works due to the fact that it consists of two images, one that is read-only and another that permits both reading and writing and can be updated. Since only one of the images can be loaded into RAM at a given time, software first boots into the read-only image, which then verifies the contents of the read-write image and jumps to it provided that the match is exact. The boot flow makes heavy use of the bootloader's functionality to move different parts of the software between RAM and FLASH to make jumping between these images possible. In order to enable this functionality without the actual bootloader code, we recreated some of its functionality, taking advantage of Renode's Python integration.
Peripheral support for an automatable, scalable testing environment
The project, just like in the earlier stages, focuses on the CrOS Tester framework which runs all EC tests in simulation and builds and executes test binaries via GitHub Actions. In order to assure completeness of the test, we needed to make sure their coverage included elements specific to the Nuvoton SoC. To increase the coverage of the tests used by the EC team (on physical hardware), we included models for the following peripherals in Renode, to make verification of new software changes faster and more scalable:
- MDMA
- RSTCTRL stub (implemented to the extent required by the software targeting the
helipilot
platform) - TRNG stub
- Flash
- platform-specific test for SPI-to-fingerprint sensor communication
Thanks to recent exciting developments in Renode, we were also able to propose some changes to the run-device-tests.py
script, typically used by the EC team to run tests on hardware, to allow for better integration of Renode tests with the current testing flow. This Python-based testing flow uses our new Pyrenode3 project, a binding layer between Renode and Python code, which we have described in a recent note.
Run Nuvoton NPCX9 demos locally
In order to start a TensorFlow Lite demo running in Zephyr RTOS on the board simulated in Renode on your local machine, run:
pip install git+https://github.com/antmicro/renode-run.git
renode-run demo -b npcx9m6f_evb tensorflow_lite_micro
To run this and other demo scripts on the NPCX9 board in Renode, both locally and in Google Colab, you can visit the board’s page inn Renodepedia. The tests you will find there are part of the Renode Zephyr Dashboard, Antmicro’s massive CI setup testing hundreds of Zephyr RTOS targets across a range of demos.
You can also run a demo of the FPMCU software running on the platform in Renode. To use the interactive shell, clone the EC Tester repository and start the script in its root directory by running:
renode-run -- helipilot.resc
Add your platforms to Renode for replicable full-system testing
Adding Renode support for the first platform from Nuvoton helps improve our coverage of the security ecosystem, and with Nuvoton’s recent adoption of the RISC‑V based OpenTitan, for which Renode also features comprehensive support, we’re excited to see further developments in this space. Renode is an excellent tool for testing the security of both consumer and industrial products, as it lets you scale your testing thanks to its fully-replicable, automatable and collaborative testing capabilities for software and hardware co-development.
If you see value in supporting your development of real-world products with simulation-based testing, or you are more broadly interested in transparent, efficient and cost-effective development tools and services, do not hesitate to contact us at contact@antmicro.com.