Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Development Studio Forum Discussions

HongLI_Guo
Level 1
Level 1
5 sign-ins First like given First reply posted

Dear all:

When the floating point is set to exact mode,

HongLI_Guo_0-1662717847924.png

The debugging result is as follows, and the value cannot be calculated and displayed normally.

HongLI_Guo_1-1662718038704.png

 

0 Likes
1 Solution
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

Hi HOngli,

dw_0-1663061246597.png

 

Could you please try -lc_fpu and fp-model=1 ?

dw

View solution in original post

0 Likes
9 Replies
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

Hi Hongli,

From your debug window, the pcg has correct value, is it right?

When you are using UART monitor, what is processed for pcg? 

i.e.

pcg = {...}

calc(pcg);

printf(pcg);

 

dw

0 Likes
HongLI_Guo
Level 1
Level 1
5 sign-ins First like given First reply posted

Hi dw, thank you for your reply.

Regarding the PCG value of the debug window, later debugging found that this value is not correct. The "sqrt ()" function is not executed during the project, which means that the square root of the variable does not change its value.

The value displayed in the debug window is the final value to be displayed without any processing, as shown in the picture below.

image.png

0 Likes
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

https://resources.tasking.com/sites/default/files/uberflip_docs/file_254.pdf

Please refer to above user manual page 639 for description.

dw_0-1663033811715.png

 

I used fp-model=1 (precise) and do a simple sqrt, it's like above showed.

My Tasking path is:

C:\Program Files\TASKING\TriCore v6.3r1\ctc

 

dw_1-1663033866450.png

dw

0 Likes
HongLI_Guo
Level 1
Level 1
5 sign-ins First like given First reply posted

My Settings are the same as yours: fp-model=1 (precise)

HongLI_Guo_0-1663052435323.png

But I got a different result here.

HongLI_Guo_1-1663052641911.png

When debug sets a breakpoint at line 75, run to the breakpoint and see the variable 'res', which is not assigned.

HongLI_Guo_2-1663052737700.png

I used AURIX Development Studio1.6 and MCU is SAK-TC297TX-128. I hope you can help me solve this problem. Thank you very much.

0 Likes
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

Hi Hongli

Please use global variable instead, then add it into Expressions Window.

dw_0-1663054672795.png

 

dw

0 Likes
HongLI_Guo
Level 1
Level 1
5 sign-ins First like given First reply posted

Hi dw

The running result is shown in the following figure.

HongLI_Guo_0-1663055336668.png

Hongli

0 Likes
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

Hi HOngli,

dw_0-1663061246597.png

 

Could you please try -lc_fpu and fp-model=1 ?

dw

0 Likes
HongLI_Guo
Level 1
Level 1
5 sign-ins First like given First reply posted

Hi dw,

According to what you said -lc_fpu and fp-model=1 

HongLI_Guo_2-1663063702461.pngHongLI_Guo_3-1663063723765.png

Amazingly, I got the right number. Can you tell me the general reason? I'd appreciate it.

HongLI_Guo_4-1663064205399.png

 

Hongli

 

0 Likes
dw
Moderator
Moderator
Moderator
100 likes received 750 replies posted 10 likes given

 

Please refer to above Tasking user manual for chapter 7.3. Linking with Libraries

If you use single precise floating,  then link libcs_fpu.a. otherwise, link libc_fpu.a

-lc_fpu is with -fpmodel  =1 and -lcs_fpu is with -fpmodel=3

You could try this combination.

dw

0 Likes