Today, I learn more about Intel Architecture and UEFI on the Minnowboard, by using the built-in commands and macros within SourcePoint.
SourcePoint has a very powerful built-in programming language that is very similar to ‘C’. This language gives access to a plethora of commands for JTAG-based run-control, target access, dumping of registers/memory/IO, etc. These allow for command-line control of the debugging environment, as well as creation of scripts for automation of often-repeated tasks. The command language complements source-level debugging, and is particularly useful for hardware qualification and validation. The command language primitives in fact form the foundation of a lot of the SourcePoint functionality, such as the Intel CScripts.
The command language syntax, data type support, use of expressions, control variables, and other aspects are defined within the SourcePoint User Guide. I found the use of the command language to be very easy. You can use the command language directly from the Command window; below are some examples:
The first command issued was invoked by simply typing in:
printf(“Hello World!\n”)
Anyone familiar with ‘C’ will recognize this statement. As expected, it prints out “Hello World!” to the console.
The following command, msr(17), prints out the contents of the mode-specific register at address 17H. Those familiar with Intel Architecture may recognize this as the MSR_PLATFORM_ID.
You can see from the “for” loop that it is possible to create complex statements in a single line. It’s also possible to chain together multiple statements on a single line, and even wrap them onto several lines.
The clock() macro returns the elapsed time (in ms) since SourcePoint started. The value is ‘051961C5’H; which is 85549.509 seconds, or about 24 hours.
The next command, cpuid_eax, executes the assembly language CPUID instruction and returns the result in EAX (and to the screen). You can see that the result is ‘30679'H.
“devicelist” displays the attributes of the devices in the chain known to SourcePoint. The uncore and the two device cores are visible.
Of course, it is possible to create command macro text files which contain multiple commands. Creating command files helps to automate oft-repeated operations. Command files are also referred to as macro files, script files or include files. There are several ways to execute a command file:
- Use the include command in the Command window.
- Drag and drop a command file from Windows Explorer to the Command window.
- Select File | Macro | Load Macro from the main menu.
- Select File | Macro | Configure Macros to attach a command file to a user-defined toolbar button, and then press the button.
- Select File | Macro | Configure Macros to attach a command file to an event. Examples of events include: go, stop, project load, power cycle, etc. When the event occurs, the macro will automatically execute.
- Define a breakpoint and specify a command file to execute when the breakpoint hits.
An example of a macro file which reads the Bay Trail-I MSRs up to ‘6E0’H consists of only seven lines:
define ord8 i=0
define ord8 msrvalue = 0
while (i < 6E0) {
msrvalue = msr(i)
printf(“%x %x \n”, i, msrvalue)
i += 1
}
The results can be compared against the MSR definitions for the Silvermont architecture, which are also contained in the Intel Software Developers Manuals. Pretty cool, huh?
To have a look at the SourcePoint GUI, go here.
More information on SourcePoint Command macros can be found here.
Use of the SourcePoint command environment to invoke the Intel CScripts is found in our eBook here (note: requires registration).
You can see the prior Minnowboard Chronicles here: Episode 8.
The next one is here: Episode 10.