Jump to content
Sign in to follow this  
abc

CCS questions

Recommended Posts

I think I'll post my CCS questions here under one thread, to avoid flooding the list.

 

(I am using CCSv6)

 

Q1.  given a char* p, is there a way to evaluate it as a string? I.e. to see all its characters? The best I've come up with is 1) to use memory, and 2) to see it as an array; both have deficiencies in that they allow to see either only char or only in at a time.

 

Q2. How do I disable optimization?

 

Thank you

 

Share this post


Link to post
Share on other sites

I think I'll post my CCS questions here under one thread, to avoid flooding the list.

 

(I am using CCSv6)

 

Q1.  given a char* p, is there a way to evaluate it as a string? I.e. to see all its characters? The best I've come up with is 1) to use memory, and 2) to see it as an array; both have deficiencies in that they allow to see either only char or only in at a time.

Yes, I use memory and change the type to char.

 

 

Q2. How do I disable optimization?

 

Thank you

It is in properties. See pic

codecomposerstudio_optimization.JPG

Share this post


Link to post
Share on other sites

@@bluehash, thank you! How could I miss that? Thought I looked everywhere.

 

That I think fully answers my Q2.  Below is my tentative answer to Q1 (displaying strings):

 

The lack of an easy way to evaluate a null-terminated string seemed a bit odd to me, but I've just found that, in the Expressions view, if you right-click on a char* 's "value" column and go Number Format -> String , it will display the first 10 characters of the string - good for starters. If you then right-click on the triangle to the left of the variable's name, it shows an array of chars of up to 1K chars. Next, I can right-click on the Value column of each individual char (taking care not to left-click first), and go Number Format -> Decimal as needed, on per-char basis. This way, I get a complete string, and I have the freedom to see some characters in ascii, some in decimal (octal, binary, hex) - useful, for instance, when I need to see an ascii string with \n \r \0 etc. A bit of a headache, but works for me. Maybe I'll find a better way as I learn more (a custom converter perhaps?)

Share this post


Link to post
Share on other sites

@@bluehash, I disabled optimisation as you said, but it does not seem to disable it completely. For instance, it still would not allow me to set a breakpoint at 

int i = 0; i++;

However, a breakpoint at 

volatile int i = 0; i++;

works fine. Wonder why?a

 

(i is unused in both cases)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×