Atmel Studio 7, is there way to have mixed type for watched variable

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found Atmel Studio 7 in watch variable rather limited compared to other I used (Eclipse and NetBeans) where it provides multi-type (ascii, hex and decimal) in one go. The choice of type seems limited to just hex and number. It also lacks a feature to display pointer array on pointer variable which is a useful tool for debugging. 

 

Any suggestion how to expand or add feature?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm, yes but really HOW TO USE IT?

 

I have uINT8[] array but I like to see ASCII translation (char) alike other IDE. I could not see in Amtel Studio menu list

 

I have uINT8 test[20] and then uINT8 * meme = &test[0]

 

I need to display array list of the pointer meme alike other IDE. I could not see in Amtel Studio menu list

 

Is there addon option to extends this feature?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want to see the char* in a uint8_t[], just cast it in the watch window. i.e you don't want to watch array, as it's a array of uint8. You want to watch (char*)array to look at the array members, or (char*)array,s to interpret the array as a string.
.
If you want to watch the same thing in multiple ways, just have multiple watches.
.
If you have a pointer, but it points to a array, just add ,n to the watch, where n is the number of elements from the pointer that you want to watch.
.
By default, the watch window will deduce how to represent s symbol from the symbol information itself. If you want to look at a symbol in another representation, any C style casts (or any C expression) can be watched as well.

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

Last Edited: Fri. Dec 28, 2018 - 04:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So how to recast in AS7, not in source code. 

 

It seems not right to modify source code for stake of debugging, I may forget to remove it.

 

How to override AS7 to force array list and different type.

 

It seems to be missing feature in AS7, is there plugin solution?

 

HOW TO USE IT?, can anyone has some example or demo so I can learn.

 

R. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just as I told you, cast as you do in code in the watch window I.e use () when you watch

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As an example:

 

Have a close look at the Type column to see what the cast is doing when it changes the type.

 

  • a: Create a watch of a and deduce the type uint8_t[10]. We can then watch all the elements as an array where each number is a uint8_t
  • a,3: Create a watch of a, treat it like a uint8_t* and assume display it like it had 3 elements (no matter what it is)
  • (char*)a: Cast the a to a char*. However, since on AVR, uint8_t is implemented as a char, so it does render as a int
  • a,s: Assume that a is a pointer to 'something string like (some amount of char-like data with a NULL at the end). Render as a string
  • a[2], i: Watch the third element of a, as a integer
  • a[2], b: Watch the third element of a, as binary
  • a[2], o: Watch the third element of a, as octal
  • a[2], x: Watch the third element of a, as hex
  • a[2], c: Watch the third element of a, as a char

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Fantastic, this is an answer I'm looking for....thanks!

Can you send this project file in zip?

riscy00 at gmail.com or share in this forum.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why? You can see everything in the screenshot... (Also, not at home for a couple of days)

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I unable to modify for DataSysTick,s statement for typedef struct. 

 

//================================================================
// Test Status Flag
//================================================================
typedef struct tagzSERMEMDataFrame{
    union {
        uCH8 DataArray[32];
        struct
        {
            uCH8 DataSysTick[11];                // ASCII in Systick Data
            uCH8 DataPageNumber[7];                // Page Number in ASCII
            uCH8 DataTempKelvin[7];                // Temp readout in ASCII
            uCH8 DataFailedCounter[3];            // Number of failure in ASCII. 
            uCH8 DataCheckSum;                    // Check Sum for the page (to be implemented later)
        };
    };
}_SERMEMDataFrame ;
//================================================================
// Test Status Flag
//================================================================
typedef struct tagzSERMEMPageTest{
    union {
        uCH8 Page[256];
        struct
        {
            _SERMEMDataFrame DataFrame;
            uCH8 Pattern1[112];
            uCH8 Pattern2[112];
        };
    };
} _SERMEMPageTest ;
extern  _SERMEMPageTest  SERMEMPageTest;

Last Edited: Mon. Dec 31, 2018 - 10:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

This is not working, what did I miss?

(a) It did not provide pointer address for this array. 

(b) it did not provide string based on ,s as suggested.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To add ,s to DataSysTick, you should add a watch on (char*)SERMEMPageTest.DataFrame.DataSysTick,s
.
Again, ,s will only work if what you watch is string-like from the type system. Whatever uINT8[] is based on seems to not be string-like...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Okay that good but cannot generate 20 array like you did

NB: this is uINT8 Uart_RXBuffer[]