The sprint function prints 0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-13 11:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-13 3:06 PM
Yes, so you're linking a limited capability library not supporting floating point printf/scanf functionality. Build with the proper library/settings. Similar issues with other GNU/GCC / TrueStudio based tools, search the forum, covered a shed load of times.
Or, just use some professional tools like Keil or IAR where things predominantly just work properly without having to read the documentation.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-13 11:30 PM
You can give a link to the forum on this topic?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-14 1:24 AM
Not the GP, try to search the web for "_printf_float". Here's a couple of links.
Your toolchain uses a free "Standard C" library called "newlib". More precisely, it uses the subset of the library called "newlib-nano" which is designed for memory/flash-constrained devices. If you read its documentation [1, 2] (yes, it's ok for professionals to read the documentation of the tools/libraries they use) you can find this:
Floating-point support is split out of the formatted I/O code into
weak functions which are not linked by default. Programs that need
floating-point I/O support must explicitly request linking of one or
both of the floating-point functions: _printf_float or _scanf_float.
This can be done at link time using the -u option which can be passed
to either gcc or ld. The -u option forces the link to resolve those
function references. Floating-point format specifiers are recognized
by default, but if the floating-point functions are not explicitly
linked in, this may result in undefined behavior for programs that
need floating-point I/O support.
