11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The CLIB runtime environmentInput and outputYou can customize:●●The functions related to character-based I/OThe formatters used by printf/sprintf and scanf/sscanf.CHARACTER-BASED I/OThe functions putchar and getchar are the fundamental C functions forcharacter-based I/O. For any character-based I/O to be available, you must providedefinitions for these two functions, using whatever facilities the hardware environmentprovides.The creation of new I/O routines is based on the following files:●●putchar.c, which serves as the low-level part of functions such as printfgetchar.c, which serves as the low-level part of functions such as scanf.The code example below shows how memory-mapped I/O could be used to write to amemory-mapped I/O device:__no_init volatile unsigned char DEV_IO @ address;int putchar(int outchar){DEV_IO = outchar;return outchar;}The exact address is a design decision. For example, it can depend on the selectedprocessor variant.For information about how to include your own modified version of putchar andgetchar in your project build process, see Overriding library modules, page 53.FORMATTERS USED BY PRINTF AND SPRINTFThe printf and sprintf functions use a common formatter, called_formatted_write. The full version of _formatted_write is very large, andprovides facilities not required in many embedded applications. To reduce the memoryconsumption, two smaller, alternative versions are also provided in the standard Clibrary.Part 1. Using the compiler77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!