Unable to sprintf float value with redlib(semihost-nf)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Unable to sprintf float value with redlib(semihost-nf)

2,809件の閲覧回数
akimata
Contributor IV

Hi,

I'm struggling to sprintf a float value with redlib(semihost-nf). What i've done:

- set PRINTF_FLOAT_ENABLE=1

- set SCANF_FLOAT_ENABLE=1

- removed CR_INTEGER_PRINTF

Example code:

char text_buffer[64]

snprintf(text_buffer, sizeof(text_buffer), "declination: %.2f\r\n" , 5.25);

Any ideas what else might be wrong?

It's working on newlib(semihost) but semihosting on that lib is just too slow and i would rather to stay on redlib.

0 件の賞賛
返信
8 返答(返信)

490件の閲覧回数
georgeliolidis
Contributor I

I had the same problem and i solved it after correcting the preprocess  symbol:

CR_INTEGER_PRINTF  to _CR_INTEGER_PRINTF.

(was missing the preceding underscore)

0 件の賞賛
返信

2,663件の閲覧回数
akimata
Contributor IV

That's what i got in the settings. The weirdest part is that i created new project and it's working just fine there, but i cannot get it to work on my project so i just generated whole new project and copied files there and problem solved!. Still have no clue why didn't it work on my last project tho.

0 件の賞賛
返信

2,664件の閲覧回数
zhiqunhu
Contributor III

Try to remove CR_INTEGER_PRINTF in Preprocessor configuration.

0 件の賞賛
返信

2,664件の閲覧回数
ErichStyger
Specialist I

could it be that you changed something in the linker settings? I would compare those.

0 件の賞賛
返信

2,664件の閲覧回数
ErichStyger
Specialist I

choose a different redlib library. nf means 'no-float'.

0 件の賞賛
返信

2,664件の閲覧回数
ErichStyger
Specialist I

correction: nf means no-files (not no-float)

0 件の賞賛
返信

2,664件の閲覧回数
akimata
Contributor IV

I tried also redlib(semihost) and redlib(semihost-mb) and noone of them works.

0 件の賞賛
返信

2,664件の閲覧回数
ErichStyger
Specialist I

this is what I have:

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

0 件の賞賛
返信