5   Booting RTEMS

The Real-Time Executive for Multiprocessor Systems operating system, known as RTEMS, usually builds and links into a single binary file. This file usually includes the user application. This mean that booting RTEMS is a fairly simple task with Simics.

Booting RTEMS can be acomplished in several ways. One way is to run the regular PMON firmware and inject the binary in SREC format over the emulated serial port e.g. by copy-paste to the console window. This method is cumbersome, however.

A much easier and faster method is to use the PMON emulation that can be accessed through Simics's Python layer to do the initial firmware set-up, and then load RTEMS as either an ELF or an SREC file with the load-binary command. After the file has been loaded, it is possible to execute RTEMS by setting PC?to the start address provided by the binary.

RTEMS typically zeros the entire memory area during boot. In order to avoid repeating this process—which is completely unnecessary in Simics and can take some considerable time if the amount of memory is large—a checkpoint can be saved after the first boot in order to avoid repeating this excercise.

Another way is to patch the call to memset from RTEMS_Malloc_Initialize and turn the call into a nop instruction. It is also possible to identify when the memory-zeroing loop starts in the boot process and which register is used as the counter. As the following example shows, the register can then be patched on-the-fly:

# Load dhrystone binary, skipping memory zeroing
  set-pc (load-binary "rtems-dhrystone.elf")
  c 105089
  %o2 = 16