1.8k views
in System Integration by

Hi, guys

I'm using the instant constructor "string()" to convert a float to string. It is ok when i flash from embedded wizard doing "make install", but i'm working with the system workbench and the compiler is GCC, so when i load the code on my board everything is working, but the var float is not.

this is what i do on all the Onset method:

// The value doesn't change - nothing to do.
if ( pure precio_unidad == value )
  return;

// Remember the property's new value.
pure precio_unidad = value;

// TO DO:
// .. and show the new text in the both text views
unitario_ntext.String =(string(value,0,2)+"€");
// Now you can handle the alternation of the property.

 

by

This is what i get on embedded wizzard "start prototyper"..

 

And this is wwhat i get on the board..

 

Only show the symbol "€" but var float does not.

 

1 Answer

+1 vote
by

Hi,

two ideas, which could cause the problem:

1. Compiler Optimization - can you verify that the compiler optimization is the same as it is in the makefile (-O2) or disable the optimization by setting -O0. Does this change the result?

2. Stack Location - can you ensure that the start address of the stack is 16 byte aligned?

If both does not solve the problem, what is the result that you get (wrong content or system hang-up)?

By the way: If you want to display euros and cents - you can also operate with an integer variable that contains only the cents and build the string by the following statement:

var int32 abs = value;
if ( value < 0 )
  abs = -value;

TextView.String = string( value / 100, 1 ) + "." + string( abs % 100, 2 ) + "€";

Nevertheless, it is important to understand the root cause for the problem you descirbed...

Best regards,

Manfred.

by

I think i couldn't do that because it is a list box, so only give me 2 options (fpv5-d16 and no unit)

 

by

Had the same problem on a STM32F469 with AC6 SW4STM32. Adding -u _printf_float to the linker flags finally solved this problem.

See also here https://devzone.nordicsemi.com/question/5076/using-floats-with-sprintf-gcc-arm-none-eabi-nrf51822/

by
Hi Manfred,

 

i also got problems with the string.parse_float and the string(aFloat) methods.

 

My makefile contains the -mfpu=fpv4-sp-d16 flag and the -mthumb. The interwork was removed long time ago.

After little research i found that the problem should be in the printf call of a syslibrary.

In Atollic the usage is activated by the flag  -specs=nosys.specs and activating the Newlib Standard library instead of the nano.
But the functions are still not working properly on the target system. Any other hints?

 

best regards

Simon
by

Hi Simon,

which version of our Build Environments are you using? If you are using V8.30 and a STM32F7 target - please update to the latest version, where we fixed some troubles with FPU settings:

* Version 8.30.01
  - GCC libraries are created with single precision FPU settings to be
    compatible with all F7 targets (using -mfpu=fpv5-sp-d16 instead of
    -mfpu=fpv5-d16).
  - GCC libraries compiled with GCC ARM Embedded Toolchain 7-2017-q4-major.

Does this help?

Otherwise please check the start address of the stack - is it 16 Byte aligned?

Best regards,

Manfred

by
update from V8.20 to V8.30 was very helpfull thx!

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...