I configured Atmel's ARM Cortex M0's UART for printing strings and integers at the console using std C function printf() in Atmel studio 7.
Case I
I am trying to make printf() type of function print floating point values and for that I followed following suggestions to do so:
arm-none-eabi-gcc : Printing float number using printf
and later on I edited/added the linker flags following texts separately at different time :
-lc -u _printf_float
-lc -lrdimon -u _printf_float
Case II
Though I could not understand everything they said but I followed some of the suggestions to edit makefile from this forum too.
Printf/Sprintf for float point variables not working
and added following text inside the makefile
ldflags-gnu-y += -lc -u _printf_float
Makefile Path (Atmel Studio 7, using ASF) : ../src/ASF/sam0/utils/make/Makefile.sam.in
Now in the main.c I used printf() for printing floating point number as :
float a = 345.65412;
char buffr[20];
/* --- Print Float using printf only --- */
printf("Float Number 1 : %f\r\n", a);
/* --- Print Float using sprintf ---*/
sprintf(buffr, "Float Number ( Using Sprintf) : %3.3f\r\n", a);
printf(buffr);
Output on a UART console app.:
Case I:
Float Number 1 : 2.000000
Float Number ( Using Sprintf) : -0.000
Case II:
Float Number 1 :
Float Number ( Using Sprintf) :
Does anyone know configuring linker to make printf(), sprintf() or vprintf() work for printing floating point number on the console for ARM Cortex M0 (SAM B 11) in Atmel Studio 7 ?