Hello,
I'm debugging code written for the Freescale VF6xx_A5, using IAR's EWARM 6.50, and am having an issue with floating point numbers. When I try to assign a non-zero value to a float, the float is automatically assigned a value of zero. For example, test and dac_vref in the code below are set to zero when the debugger steps through those lines.
double test = 30;
float dac_vref = 3.3; //3.3 V reference
I've tried messing around with the library configuration options both when writing the program inside and outside MQX 4.0.2, but enabling the full library (vs "normal") options hasn't helped.
Thanks.
Solved! Go to Solution.
Which JTAG are you using?
Maybe is a problem with the JTAG. I mean maybe FPU is fine but can not be inspected with JTAG you are using.
Can you check if the value is really zeroed without inspecting the value. I mean you can try something like
if (test > 0)
printf("test is not zero\n");
just to check if the value is really zero in the program or is a problem with JTAG or other thing
Cool, thanks!
I've had this problem writing straight to the stack (IAR Systems\Embedded Workbench 6.5\arm\examples\Freescale\VF6xx\TWR-VF600\src\projects\getting_started) as well as with example projects in MQX 4.0.2. Recently, I've been working without MQX. It doesn't seem to make a difference either way.
All of the FPU registers are showing up as 0.0, and they're all initialized to that value when the program gets to main. In the image below (no MQX), I've just finished stepping through the following three lines inside main (osc_freq being a global variable):
double test = 3.5;
osc_freq = 7.8125;
float testing = 3.45;
Which JTAG are you using?
Maybe is a problem with the JTAG. I mean maybe FPU is fine but can not be inspected with JTAG you are using.
Can you check if the value is really zeroed without inspecting the value. I mean you can try something like
if (test > 0)
printf("test is not zero\n");
just to check if the value is really zero in the program or is a problem with JTAG or other thing
Thanks for all your help, Juan! The problem was the (rather old) JTAG.
Hi noob1024,
Sent you a PM, but on the off-chance some-one else sees this thread.
I'm running into the same issue as you. All FPU registers are showing as "0" (zero) in the FPU registers in IAR EW.
I'm using IAR EW 6.70.x and a yellow IAR branded J-link.
What did you end up doing to solve your issue? Buy a new debugger probe? Upgrade your probes' FW? What probe are / were you using?
Thanks!
Mike
Hi Mike,
Sorry for not getting back to you earlier -- I was out of the office yesterday. I was using a J-link v6 (from 2007) with IAR EWARM 6.50, which was causing the problem. If I use a JTAGjet-Trace-4M, I don't have the problem with the floats.
Do you have the FPU enabled in the project options?
Update: program is debugging correctly in simulator -- I only have the problem with floats getting set to zero when running on the hardware.
I modified a sample in DS-5 and I was able to see the assignation to zero was as expected.
I can see that this values are stored in the VFP unit in double precision registers.
$D8 registers for double test variable and
$D9[31..0] half registers for the float dac_vref
Could you check were this variables are stored in your test? Are they allocated from the VFP unit?
I can see this compilation options in my project
-O0 --cpu=Cortex-A5.neon --fpu=vfpv4 --vectorize -g --c99 --split_sections
I guess the one that enables the fpu (floating point unit) to use vfp (vector floating-point unit version 4).
Make sure this option is there.
Not sure if the rest are needed but you can try them too,
I tested in IAR with GettingStarted examples that come with the IAR installation and I was able to see the proper assignation of the variables.
Check the figures attached, where it is seen the values are properly assigned from the FPU.
In this case from $d8 and $S18
Also make sure that in the general options the VFPv4 + NEON are selected as the FPU (which are the default options in the GettingStarted project)
Look at the sample project at IAR Systems\Embedded Workbench 6.5\arm\examples\Freescale\VF6xx\TWR-VF600\src\projects\getting_started.
I just added these two variables and a printf (to avoid optimization throws away these variables) and then inspect them in FPU module.
Hi Juan,
Thanks for the advice. I tried the command-line code, but ran into a compiler error because I'd previously defined the FPU as VFPv4 + NEON and the device as Freescale VF6xx_A5 (as was shown by the image you sent), inside the General Options -> Target of the Project Options.
Using those options, I still see dac_vref and test being assigned to FPU registers ($S16 and $D8) with values of 0.0. However, the interesting thing is that if I declare a float as a global variable, then its value gets stored in OCRAM. I can assign that float a non-zero decimal value either outside a function or inside a function, and the float value will be properly assigned to the variable. However, if I try to declare a float as a local variable, then value is stored inside an FPU register (e.g. S16) and is automatically set to 0.0. I've been checking the values of variables using Watch, have compiler optimization set to none, and have no linker optimization options selected, so I don't think that optimization is deleting those debugging variables.
Hum, that is weird.
The compile option --fpu=vfpv4 I think only applies for DS5 not for IAR. With DS5 I modified an MQX sample but in IAR was not an MQX sample.
Not sure if this can make a difference. In both cases I did not see the issue.
I will try to test it in an MQX sample with IAR and let you know.
Do you see all the $S and $D registers in the FPU as zeros, or only those that were assigned to these variables?
Could you try modifying the IAR Systems\Embedded Workbench 6.5\arm\examples\Freescale\VF6xx\TWR-VF600\src\projects\getting_started NOT MQX sample to see if you can see the problem there.
Do you know which revision are you working with? I tested with a rev 1.0?