cancel
Showing results for 
Search instead for 
Did you mean: 

STVD (/w COMSIC Compiler) not able to debug double / float datatype

daschenbrenner
Associate II
Posted on September 11, 2014 at 08:20

Hello all,

I`m having some issues using the double or float datatype in STVD with the COSMIC C compiler.

I am able to declare those data types but when i start debugging and would like to watch the varibles, STVD shows weird values. for example the simple division  5.0 / 3.0 resolutes in 1,...E-37 which is something like 0.

Using float data type has the same effect.

I was using break points and the command 'quick watch'.

Dennis
6 REPLIES 6
balmukund66
Associate II
Posted on September 12, 2014 at 06:35

Hello ,

Please try this(Image atached).

and Display item :Standard(After right click on the Display item in WATCH).

Thanks& Regards,

Balmukund Prasad

________________

Attachments :

stvd1.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htrk&d=%2Fa%2F0X0000000aY5%2FVR2TZqKCIJtg3UcZDOz0t2NM9NJXh0bBk8kEaBOuQF8&asPdf=false
daschenbrenner
Associate II
Posted on September 15, 2014 at 08:07

Hey,

thanks. Yeah this doesn`t work :(

Dennis

luca239955_stm1_st
Senior II
Posted on September 15, 2014 at 09:49

if you post a small bit of code I can take a look with another debugger: that will allow to determine if it's an issue with the code (or the linker file / linked libraries), the compiler, or the debugger.

Regards,

Luca (Cosmic)

daschenbrenner
Associate II
Posted on October 09, 2014 at 16:09

Hello Luca,

not even simple programs work. For example:

main(){

double test = 0.0;

test = 5 / 3;

}

And watching this variable test shows the same ...

Thanks.

luca239955_stm1_st
Senior II
Posted on October 10, 2014 at 10:59

Hello,

as it is posted, your division will return 1.0, as it makes 5/3 as an integer division and then assigns the result to a float variable. If you add a cast, implicit or explicit

test = 5.0 / 3.0;

it works ok on my simulator/debugger.

Also take care of the fact that, with very simple examples, some variables that are never used later are just optimized away by the compiler.

I suggest you try the following

main(){

volatile float test = 0.0;

test = 5.0 / 3.0;

}

It works ok on my PC (zap debugger): if it still does not work for you I can try to get a copy of STVD and see where it goes wrong.

daschenbrenner
Associate II
Posted on November 04, 2014 at 13:02

Hi Luca,

thanks for your reply.

In this case it was my fault and everything is going fine.

Thanks!