Float to ASCII conversion without using sprintf function

Hello,

I am removing all sprintf() function from my souce code as this function does not allow me to set the proper thread stack size. Does anyone have any function that implements this conversion?

Thanks
Andre Moutinho

Parents
  • What do you mean by "proper stack size". sprintf() doesn't stop you from defining a stack size.

    That the analysis tool can't perform a 100% analysis of call depth and stack need? Is that really a problem. Multiple calls to sprintf() with same formatting string should not have any larger difference in stack needs. You can "paint" the stack with magic marker bytes and then check the waterlevel to see how much stack your thread did consume with different parameters. If you have a processor with 128 bytes of RAM, you really have to consider every single byte when trying to decide on stack size. If you have an ARM chip with 8kB or 32kB or whatever, you can normally survive with 128 byte extra for a specific thread just to make sure.

    If you are bored, you can always roll your own implementation to convert a floating point number to a text string - it isn't rocket sience.

Reply
  • What do you mean by "proper stack size". sprintf() doesn't stop you from defining a stack size.

    That the analysis tool can't perform a 100% analysis of call depth and stack need? Is that really a problem. Multiple calls to sprintf() with same formatting string should not have any larger difference in stack needs. You can "paint" the stack with magic marker bytes and then check the waterlevel to see how much stack your thread did consume with different parameters. If you have a processor with 128 bytes of RAM, you really have to consider every single byte when trying to decide on stack size. If you have an ARM chip with 8kB or 32kB or whatever, you can normally survive with 128 byte extra for a specific thread just to make sure.

    If you are bored, you can always roll your own implementation to convert a floating point number to a text string - it isn't rocket sience.

Children
More questions in this forum