Thread: Difference between freestanding and hosted implementations

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    144

    Difference between freestanding and hosted implementations

    Hi, everyone.

    It occurs to me that when I am programming on, say OSX with gcc, the operating system designers and gcc writers between them have given me certain means of input and output. For example, I can use printf() to print a message to the screen.

    But when I am programming an AVR microcontroller, printf() doesn't have much meaning. There is no screen, and no way that the AVR can "print", unless I implement it myself.

    Is this what is meant by the difference between a "hosted" implementation and a "freestanding" one? As in, a hosted implementation gives me certain standard ways of communicating with the environment, and a freestanding one is presumably going to have to rely on something architecture-specific?

    Richard

  2. #2
    Registered User
    Join Date
    Sep 2012
    Posts
    357
    An hosted implementation has access to all of the C Standard library; a free-standing implementation does not necessarily have access to any function defined in the Standard library.

    Specifically, a C99 freestanding implementation, only has to provide the macros and types declared in the standard headers <float.h>, <iso646.h>, <limits.h>, <stdarg.h>, <stdbool.h>, <stddef.h>, and <stdint.h> and need not provide support for complex numbers.

  3. #3
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    printf is used for output streams such as USART.

    Just search avrfreaks for usart.h and set up a stream - You'll be able to get lots of info there on how to do that

    I used a header by Joerg Wunsch which has been slightly modified to suit the ATmega128 CONTROLLER
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 06-29-2008, 08:38 AM
  2. Difference in STL implementations...
    By dudeomanodude in forum C++ Programming
    Replies: 12
    Last Post: 02-05-2008, 06:59 PM
  3. Hash implementations
    By SoFarAway in forum C Programming
    Replies: 6
    Last Post: 07-24-2007, 02:13 AM
  4. Threads implementations.
    By mozala in forum C++ Programming
    Replies: 1
    Last Post: 05-24-2006, 09:56 AM
  5. About the graphics tutorial hosted here..
    By Cobras2 in forum C++ Programming
    Replies: 4
    Last Post: 10-23-2002, 12:40 PM