title: Print floating point number using printf() at ARM Cortex M0 uart console
body: <p>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. </p>
  
  <p><strong>Case I</strong></p>
  
  <p>I am trying to make printf() type of function print floating point values and for that I followed following suggestions to do so:</p>
  
  <p><a href="https://stackoverflow.com/questions/12703307/arm-none-eabi-gcc-printing-float-number-using-printf">arm-none-eabi-gcc : Printing float number using printf</a></p>
  
  <p>and later on I edited/added the linker flags following texts separately at different time :</p>
  
  <pre><code>-lc -u _printf_float
  -lc -lrdimon -u _printf_float 
  </code></pre>
  
  <p><strong>Case II</strong></p>
  
  <p>Though I could not understand everything they said but I followed some of the suggestions to edit makefile from this forum too.</p>
  
  <p><a href="https://answers.launchpad.net/gcc-arm-embedded/+question/245658" rel="nofollow">Printf/Sprintf for float point variables not working</a> </p>
  
  <p>and added following text inside the makefile </p>
  
  <pre><code>ldflags-gnu-y += -lc -u _printf_float 
  </code></pre>
  
  <p>Makefile Path (Atmel Studio 7, using ASF) :   <em>../src/ASF/sam0/utils/make/Makefile.sam.in</em></p>
  
  <p>Now in the main.c I used printf() for printing floating point number as :</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>Output on a UART console app.: </p>
  
  <p><strong>Case I</strong>:</p>
  
  <pre><code>Float Number 1 : 2.000000
  Float Number ( Using Sprintf) : -0.000
  </code></pre>
  
  <p><strong>Case II</strong>:</p>
  
  <pre><code>Float Number 1 : 
  Float Number ( Using Sprintf) :
  </code></pre>
  
  <p>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 ?</p>