ARM Technical Support Knowledge Articles


Applies to: uVision Debugger


Information in this article applies to:


I need to simulate a sequence of values on a input pin. Is there an easy way to read data from an array, so that a sequence of values can be written to a variable on a breakpoint during simulation?


uVision provides a powerful scripting language that allows you to create complex input signals. The scripting language is identical to the C Programming Language with a few exceptions. One of these is that arrays are not directly supported. However, there are several work-arounds for this limitation.

One technique for return values from an array is to use a simple debug function that is called periodically:

/* Define a global variable for indexing */
DEFINE unsigned int GetValIdx

/* Return a Value depending on a Index */
FUNC unsigned int GetValue ()  {
  GetValIdx = (GetValIdx + 1) %5;
  switch (GetValIdx)  {
    case 0:  return (0x55);
    case 1:  return (0xCA);
    case 2:  return (0xCB);
    case 3:  return (0xF5);
    case 4:  return (0x05);
    default: return (0x66);

Create a breakpoint invokes this function and assigns a new input value to P2 when your program enters the timer0 function (or any other function in your program). Define this breakpoint as follows:

BS timer0, 1, "P2 = GetValue()"

Of course, you could create a signal function that runs periodically. For example:

signal void setup_P2 (void) {
  while (1) {
    swatch (0.100);  /* Delay 0.1 seconds */
    P2 = GetValue ();  /* change P2 value */

Another technique involves using a specific memory area (S:, T:, U:, or V:) as an input array. Each of these memory spaces may be up to 64KBytes.

To use one of these memory areas, you must MAP it into the address space, define an index for it, and once again create a breakpoint or signal function to read values and assign them to P2 (in this case). For example:

/* Map the user specific memory space */

/* Define a global variable for indexing */
DEFINE unsigned int GetValIdx

/* Define a breakpoint that executions on each entry of timer0 */
BS timer0, 1, "P1 = _RBYTE (S:0 + GetValIdx++)"

The benefit of the specific memory spaces is that you can view and modify the values using the memory window. You may even load and save the contents of specific memory spaces in HEX files using the LOAD and SAVE commands. For example:

/* Store the content of the S: Space */

/* Restore the content of the S: Space */



Article last edited on: 2005-12-15 08:05:06

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential