Below are some useful tips for using FVP models in common scenarios:
Application can use following options for printing information to a console:
The application firmware can use UART channels available in the FVP model to print out information, with data being forwarded to a Telnet terminal on the PC via a local TCP/IP connection.
This approach is especially beneficial for full-stack applications that also run on real hardware with UART communication and so can keep uniform structure for virtual and real targets.
Below is useful information for using UART I/O on FVP targets:
printf().xterm and telnet must be installed and be specified in your PATH.<board>.<uart>.out_file to specify the log file. For example for UART0 on Corstone-315: mps4_board.UART0.out_file=./log.txt.<board>.<telnetterminal>.start_telnet. For example for Corsone-315 and UART0: mps4_board.telnetterminal0.start_telnet=0. In this case, the output will not be displayed in any terminal, but will be stored into a log file if this is configured accordingly with the out_file parameter.Applications can also rely on the semihosting mechanism that enables the code running on an FVP model to directly use the input/output facilities of the host computer. With semihosting, we can enable standard C I/O functions, such as printf() and scanf(), to use the host terminal from where the model is started.
This approach can be useful to quickly enable terminal communication and bypass the complexity of using UART and I/O retargeting. It also helps to achieve a simpler implementation for rather CPU-centric test suites with unit testing, module testings and API testing that need to be run on various CPUs and with different compilers.
Below is useful information for using semihosting for terminal output on FVP targets:
semihosting-enable configuration parameter on the CPU instance. For example for FVP_Corstone_SSE-3xx as cpu0.semihosting-enable=1 and for FVP_MPS2_Cortex-M4 as armcortexm4ct.semihosting-enable=1.--specs=rdimon.specs to use the semihosted version of the syscalls.tee in Linux or > in bash.model-config.txt.Semihosting is also required for the following use cases:
The Infrastructure chapter explains how Arm FVPs and other related tools can be programmatically installed into various Continuous Integration (CI) frameworks, such as GitHub. To execute your programs on Arm FVPs in such workflows, the following is important:
<board>.visualisation.disable-visualisation=1 for the board instance on the target FVP. For example, for Corstone-315 FVP it should be mps4_board.visualisation.disable-visualisation=1.vis_hdlcd.disable_visualisation=1.FVP simulation models are targeted to software development and functional testing, and are not suitable for accurate performance comparisons on the CPU level. However, they can be well used to analyze timing on the program level, such as for scheduling RTOS tasks, detecting deadlocks, but also identifying overall performance trends.
Following mechanisms and settings can be used for timing control and measurements:
FVP models can be started with command-line option --stat to print the execution statistics on simulation exit. Here is an example of such statistics output:
Also see section Displaying the total execution time in the Fast Models User Guide.
cpi_div and cpi_mul.core_clk.mul on Corstone-300.The Timing Annotations chapter in the Fast Models User Guide explains the performance estimation concept as implemented in the underlying Fast Models technology. Note that the FVPs are built with Timing Annotations enabled (FASTSIM_DISABLE_TA set to 0).
For interaction with the external world such as via Virtual Streaming Interface (VSI) or Semihosting I/O, the timing differences need to be taken into account as explained in Timing-considerations-for-FVPs.
Embedded applications typically run with an infinite loop that ensures continuous program execution. But for executing regression tests as part of Continuous Integration (CI) workflows it is often required that program execution is stopped after a test is completed, so that the next test can be started.
FVP command line options --cpulimit, --cyclelimit, --timelimit and --simlimit can be used to stop execution after specified activity time, for example, for 20 wall-clock seconds, use --timelimit 20. See FVP command line options for more details.
FVP models have a shutdown_on_eot parameter that enables simple implementation of program exit. The parameter should be set in the Model Configuration, for example for FPV_Corstone_SSE-300:
To trigger the shutdown, an EOT (ASCII 4) symbol can be transmitted to the corresponding serial interface from the program. The code below demonstrates an example, where the execution is stopped after target execution count is achieved. In this implementation the STDIO is assumed to be retargeted to the UART0: