Intel® Simics® Simulator for Intel® FPGAs: User Guide

ID 784383
Date 11/16/2024
Public
Document Table of Contents

6.2. Capturing Serial Console Output

When debugging target software, it is common to use the serial console in the virtual platform to display debug messages. It is also common to save the output of the serial console into a file so that it can be used as a reference when comparing with other log files obtained from a different debug session. For this, Intel® Simics® simulator provides some commands that allow you to create these log files under the host file system. These commands are described in the following:

<SerialConsoleObject>.con.capture-start filename [-overwrite]
<SerialConsoleObject>.con.capture-stop
<SerialConsoleObject>.con.save-to-file filename [-overwrite]

where:

  • The capture-start command captures all output from the serial console to the file indicated by the filename argument starting from the moment in which this command is called. If -overwrite is specified, the file is overwritten, otherwise it is appended.
  • The capture-stop command is used after calling the capture-start command to stop the capture of the serial console into the file.
  • The save-to-file command saves the current output in the serial console (including scrollback data) to the file indicated by the filename argument. If -overwrite is specified, the file is overwritten, otherwise it is appended.

An example of how these commands are used is shown in the following:

# Intel Simics simulator CLI 

simics> r 200 ms
simics> system.board.fpga.soc_inst.hps_subsys.agilex_hps.console0.con.save-to-file serialPrev.log
Console screen saved to serialPrev.log
simics> system.board.fpga.soc_inst.hps_subsys.agilex_hps.console0.con.capture-start serialAfter.log
simics> r 300 ms
simics> system.board.fpga.soc_inst.hps_subsys.agilex_hps.console0.con.capture-stop
Capture to file 'serialAfter.log' stopped.
simics> r 2 s
simics> ls
serialAfter.log   serialPrev.log

In the capture above, you start the simulation running 200 ms. During this time, some messages are already printed in the serial console. To save the current messages into a file, use the save-to-file command with the file name serialPrev.log. The current content of this file is shown in the following and from these, you can see the initial messages that the system has sent to the serial console:

# simicsPrev.log file

U-Boot SPL 2023.07-rc6 (Nov 02 2023 - 13:56:52 +0300)
Reset state: Cold
MPU          1500000 kHz
L4 Main       400000 kHz
L4 sys free   100000 kHz
L4 MP         200000 kHz
L4 SP         100000 kHz
:
:
U-Boot 2023.07 (Nov 02 2023 - 13:56:52 +0300)socfpga_agilex5
 
CPU:   Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A55/A76)
Model: SoCFPGA Agilex5 SoCDK
DRAM:  2 GiB

After this, you call the capture-start command to request that any new message be saved into the serialAfter.log file and run the simulation for a couple of seconds. The capture finishes by the time you call the capture-stop command. You run the simulation for two seconds, but the new messages displayed in the serial console during this time are not saved into any file. At this point, you called the ls command, and you can see that the two files were created under the project directory. The following capture shows the messages saved in the serialAfter.log file:

# simicsAfter.log file

WDT:   Started with servicing (30s timeout)
MMC:   dwmmc0@ff808000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment
 
In:    serial0@10c02000
Out:   serial0@10c02000
Err:   serial0@10c02000
Net:   
Warning: ethernet@10830000 (eth2) using random MAC address - 
ee:2e:23:61:08:17
eth0: ethernet@10830000
Hit any key to stop autoboot:  1