ColdFire simulator can be used to run programs assembled in CF Studio or binaries loaded directly (File/Load Code). To trace program execution following options exist:
Command | Description |
Run | Starts simulation from current instruction |
Restart | Resets simulator and restarts program |
Break | Stops running simulation |
Step Into | Executes single instruction. Steps into JSR/BSR/TRAP instructions |
Step Over | Executes JSR/BSR/TRAP in one step |
Step Out | Runs till the execution leaves current function |
Run to Cursor | Runs to the line with cursor |
Step Into Exception | When simulator stops due to exception (like access violation) this command will pass execution to the exception handler |
Skip to Cursor | Moves program counter to the line with cursor |
Skip Current Instruction | Moves program counter to the next instruction |
Toggle Breakpoint | Toggles execution breakpoint in a current line |
Simulator options can be used to change the following settings:
Configuration files exist in a "Config" folder and can be edited to create new boards. Their format is described in below section.
Terminal window is used for simulated input/output. This functionality is wired to a UART peripheral, as well as monitor routines.
Exception configuration allows you to specify which of the MCU exceptions cause simulator to stop execution. At this point one can examine program state and still elect to run exception handler (Step Into Exception) if it's desirable. Exceptions that do not cause simulator to stop are passed to the exception handler (a regular ColdFire program, typically monitor or OS).
Program "Config" folder contains text files with different board configurations. They describe memory layout and available peripherals. Those files can be edited in a text editor. All "ini" files are available in Options dialog. To create new configuration duplicate one of existing files and give it a new name.
Here's configuration file structure:
Memory section describes all memory banks (up to 8), their location in 32-bit address space, and their size. Simulator supports read-write memory (denoted as RAM or SRAM), and read-only memory (Flash or ROM). Read-only memory can be used to load program into, but write attempts by MCU will result in access violation.
Dummy bank (Null) can also be used to reserve address space. It will read as zeros, while writes are ignored. It can be used to simulate area that can be read by a program.
Memory { RAM { base 0x00000000 size 0x00200000 } Flash { base 0xFFE00000 size 0x00040000 } Dummy { base 0x00fa0000 ; cartridge size 0x00010000 } }
Initial values for Vector Base Register and Module Base Address Register can be specified as follows:
VBR 0x00000000 MBAR 0x10000000
Those values will be used when simulator is reset. They are MCU-specific in real hardware.
MCU's instruction architecture can also be specified in configuration file. Note that it could be overridden in assembler options and Load Code dialog. Available choices include: ISA_A, ISA_B, and ISA_C.
ISA ISA_C
ColdFire MCUs contain several peripherals. Very few of them are simulated. Available choices are: uart (Universal Asynchronous Receiver/Transmitter), timer, icm (Interrupt Control Module), and dummy (null device). Each type needs to request specific version
(like "5206"). Currently that's the only version implemented (apart form icm, which is "simple").
io_offset
is an offset from the MBAR that specifies location of peripheral's registers in I/O area.
interrupt_source
is a unique peripheral identifier used by interrupt controller to distinquish different devices. ICM will decide which interrupt vector to use based upon this number. This is part of a simulated interrupt acknowledge cycle where device provides interrupt vector.
trace 1
can be used to turn on reporting of read and write accesses to a device for debugging purposes.
Peripherals { timer { version "5206" io_offset 0x100 interrupt_source 9 } timer { version "5206" io_offset 0x120 interrupt_source 10 } uart { version "5206" io_offset 0x140 interrupt_source 12 } uart { version "5206" io_offset 0x180 interrupt_source 13 } icm { version "simple" io_offset 0x14 } dummy ; dummy device { io_offset 0x500 io_area_size 0x100 trace 1 } }
Note that any changes to the configuration file as well as selecting different "ini" files in CF Studio require that you quit CF Studio and start it again.