Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Enabling Strict ANSI compile?

Hi all,
I’m not very familiar with compile time options and I’m not sure how to proceed.

For my project I want a function similar to ftoa (float to ascii), and I found in stdlib.h:

char * _EXFUN(gcvt,(double,int,char *));
char * _EXFUN(gcvtf,(float,int,char *));
char * _EXFUN(fcvt,(double,int,int *,int *));
char * _EXFUN(fcvtf,(float,int,int *,int *));
char * _EXFUN(ecvt,(double,int,int *,int *));
char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *));
char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *));
char * _EXFUN(ecvtf,(float,int,int *,int *));
char * _EXFUN(dtoa,(double, int, int, int *, int*, char**));

All of which I would like to try, but they’re enclosed within #ifndef STRICT_ANSI.
So how do I compile as strict ansi? What I’ve tried so far is to create a copy of debug configuration and add “ansi” (also tried -ansi) as build variable under Project properties -> C/C++ Build -> Build Variables. Did not make any difference, still get the “no reference to function found”.

Thank you.

Okay, so I found a way to use C90 standard in Project Properties -> C/C++ Build -> Settings -> Tool Settings tab -> MCU GCC Compiler -> Dialect -> Language Standard.

But given the grief it gave me about coding style all around even in CMSIS and HAL I definitely am not compiling like this :-)

So any hints on a suitable float to ascii function is appreciated!


France

Hi,

Currently when you select the dialect there, you can only select ISO standard conformance, which is a lot more strict than the standard gnu settings. You can select gnu-C-90 dialect by letting the dialect unspecified in the “Language Standard” menu, but adding “-std=gnu90” in the “Other dialect flags” box (or any other supported dialect, see the C Compiler documentation in Other Manuals)

Bernard (Ac6)


Thank you for answering, Bernard.

adding -std=gnu90 in the “Other dialect flags” box compiled fine. But it did not seem to trigger the #ifndef STRICT_ANSI.

By the way, for some reason, when I try to use dtoa I get the “undefined reference to ´dtoa’ ” error. But if I try to use gcvtf which is defined right next to dtoa in stdlib.h I only get the warning “implicit declaration of function ´gcvtf’ “.

I’m looking through GCC 5.3.0 manual but I can’t figure out where to find help with usage of the functions, or their implementations? It’s not like Cube HAL where you would just open stdlib.c and read the comments above the gcvtf implementation, for instance :-)


> I’m looking through GCC 5.3.0 manual but I can’t figure out where to find help with usage of the functions, or their implementations?

Those are not compiler-specific functions, those are standard C library functions, look in your libc documentation/reference.

BTW, why don’t you use the more common and well-known snprintf function?

FYI, gcvt and family are marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removes the specification of gcvt(), recommending the use of sprintf(3) instead (though snprintf(3) may be preferable).


bugmenot, thank you for clarifying. It did come to me that I was looking in the compiler manual for something that is not compiler specific.
I will use snprintf. I was not aware of this, and will be testing later today. Thanks again.


Thanks for the tips! Unfortunately -u _printf_float and snprintf ate so much flash I have to make something simpler and faster myself.