Renode support for the NXP S32K Automotive General-Purpose MCU
Published:
Topics: Open simulation, Open source tools
Antmicro’s automotive customers are using the versatile simulation capabilities of Renode for developing and testing multi-node systems to accelerate the transition towards software-defined vehicles. The framework offers determinism of execution and enables transparent debugging while easily integrating into existing tools and provides simulation models for hundreds of SoC and development board targets.
For one such case we have recently extended Renode support to the NXP S32K MCU family. To cater for a range of automotive use cases, S32K offers scalability in terms of number of cores, available memory and peripherals.
In this article, we will describe the extent of the support for the NXP S32K388 MCU in Renode and show how to simulate and test the MCU in Renode with Zephyr RTOS, which is also seeing increased adoption in the automotive domain.
Supporting the NXP S32K388 MCU in Renode
Renode is based on the concept of versatile building blocks which can be easily assembled into an SoC simulation model, encouraging reuse. Indeed, the NXP S32K388 MCU support was built on top of a number of pre-existing models, including:
- Arm Cortex-M7 in a quad-core configuration with the NVIC interrupt controller
- Tightly Coupled Memory (TCM)
- LPUART
- LPSPI
The project required adding a number of S32K-specific peripherals:
- Real Time Clock
- System Timer Module
- Software Watchdog Timer
- System Integration Unit Lite2
- LPI2C
- GMAC Ethernet controller
- FlexCAN, a controller for the CAN standard popular in the automotive applications - tested in the next section of this article
- FlexIO, a communication controller module capable of emulating various serial protocols including UART, SPI, I2C and SENT
To support the multi-core aspect of the platform, we also expanded the standard interrupt subsystem of Cortex-M with NXP-specific additions of the MSCM model and the Mode Entry Module model.
Running the NXP S32K388 MCU in Renode
Renode comes with a wide array of demos that illustrate the use of various cores and peripherals, and the NXP S32K388 MCU is no different. To execute a demo exposing the Zephyr RTOS shell over UART on a simulated S32K388 MCU, you can start by installing the latest portable version of Renode:
mkdir renode_portable
wget https://builds.renode.io/renode-latest.linux-portable.tar.gz
tar xf renode-latest.linux-portable.tar.gz -C renode_portable --strip-components=1
cd renode_portable
Next, you can load an sample NXPS32K script which exposes the shell:
./renode scripts/single-node/nxp-s32k388_zephyr.resc
Verifying the NXP S32K388 implementation in Zephyr
As the Zephyr RTOS already contains a large collection of drivers for various peripherals, we used those alongside existing Zephyr tests to verify the implementation of our models, e.g. the FlexCAN peripheral supported by the evaluation board for the MCU.
We selected the CAN counter sample provided by Zephyr in both normal and loopback mode to test the fitness of our model; in both of these scenarios the simulated NXP S32K388 CAN controller works as expected.
To verify the CAN implementation using one of our test suites, install the Robot testing framework and additional prerequisites via pip and Python3:
python3 -m pip install -r tests/requirements.txt
Then you can run the included Robot test suite:
./renode-test tests/peripherals/S32K3XX_FlexCAN.robot
The terminal output will be similar to:
Preparing suites
Starting suites
Running suite on Renode pid 14523 using port 49152: tests/peripherals/S32K3XX_FlexCAN.robot
+++++ Starting test 'S32K3XX_FlexCAN.Should Receive CAN Frames On Loopback'
+++++ Finished test 'S32K3XX_FlexCAN.Should Receive CAN Frames On Loopback' in 9.77 seconds with status OK
+++++ Starting test 'S32K3XX_FlexCAN.Should Exchange CAN Frames Between Machines'
+++++ Finished test 'S32K3XX_FlexCAN.Should Exchange CAN Frames Between Machines' in 14.40 seconds with status OK
Suite tests/peripherals/S32K3XX_FlexCAN.robot finished successfully in 24.48 seconds.
Cleaning up suites
Closing Renode pid 14523
Aggregating all robot results
Output: /renode_portable/robot_output.xml
Log: /renode_portable/log.html
Report: /renode_portable/report.html
This test suite verifies that a simulated CANHUBK3 node receives CAN frames on loopback, as well as successfully exchanges CAN frames between two CANHUBK3 machines.
We also provide a Robot test for the EMAC (Ethernet) implementation in Renode, also verified using Zephyr:
./renode-test tests/peripherals/S32K3XX_EMAC.robot
In comparison to the earlier test, this one creates an Ethernet switch and a network server. The firmware running on CANHUBK3 then connects to the network server via a TFTP protocol and downloads thefile1.bin
test file.
In both tests, log and report files are generated on the basis of the robot.output.xml
file created during testing. The test suite log for EMAC is shown below:

(For an interactive version of the report, visit the desktop version of the website)

(For an interactive version of the log, visit the desktop version of the website)
Automate development of industrial-grade S32K-based systems with Renode
If you’re looking to enhance your automotive development with efficient simulation and testing, Renode provides a powerful platform for simulating complex multi-node systems, including the NXP S32K388 MCU. With deterministic execution, transparent debugging, and support for a wide range of peripherals and communication protocols like FlexCAN, Renode is ideal for ensuring that your systems meet the highest standards of reliability and safety.
Renode’s deterministic simulation environment can help you streamline your development cycle, solve integration issues early, and accelerate time to market. Get in touch with us today at contact@antmicro.com to discuss integrating Renode into your development workflows.