Keil Logo

µVISION DEBUGGER: Script to Output Circular Buffer


Information in this article applies to:

  • µVision Version 2.34

QUESTION

I have a circular buffer in my program that I access using next_in and next_out indexes. Is there a way I can create a debugger script to output the contents of the buffer in order?

ANSWER

Yes.

The following script print_circ_buf accepts the address of the buffer, the length, and the next out and next in indexes. It outputs the address along with its contents.

func void print_circ_buf (
  unsigned long array,
  unsigned length,
  unsigned n_out,
  unsigned n_in) {

unsigned i;

if (n_in >= n_out)
  length = n_in;

for (i=n_out; i

You may wish to define a toolbox button to automatically call this function. For example:

define button "PrintBuffer", "print_circ_buf(circ_buffer, 17, next_out, next_in)"

SEE ALSO

Last Reviewed: Thursday, January 14, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.