cancel
Showing results for 
Search instead for 
Did you mean: 

Stack Pointer Alignment ? (printf float problem)

eraycanli
Associate II
Posted on October 22, 2013 at 17:30

Hello,

I am observing variables of my application with IAR Terminal I/O while debugging.

But when trying to printf() float values, like; printf(''%f '', myFloat); Terminal I/O gives %f as output.

After checking over internet, crossed that technical note on IAR's support site:

http://supp.iar.com/Support/?note=85413

So, how can I align Stack Pointer in my code at 8 bytes? Thanks already!
4 REPLIES 4
Posted on October 22, 2013 at 18:16

It's far more probable that you are linking against a library which doesn't support floating point scanf/printf.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 22, 2013 at 18:20

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F3%2c%20IAR6.4%20how%20to%20printf%28%29%20floating%20point&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=292]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F3%2C%20IAR6.4%20how%20to%20printf%28%29%20floating%20point&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=292

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
eraycanli
Associate II
Posted on October 22, 2013 at 18:34

Thanks for help!

From http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf

''Choosing formatters for printf and scanf funcitons''

section says;

''To use any other formatter than the default (Full), choose Project>Options and select

 

the General Options category. Select the appropriate option on the Library options

 

page.''

 

Changed settings to Full and now it works!

So, are there any disadvantages of this to MCU?

Posted on October 22, 2013 at 18:44

If you don't used floating point, or just don't print out values, you can significantly reduce your code foot-print. This can make a difference if it allows you to keep your code in a lower cost device.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..