1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Standalone and non-standalone applications in embedded systems

Discussion in 'Embedded' started by Alex Vinokur, Nov 1, 2005.

  1. Alex Vinokur

    Alex Vinokur Guest

    Alex Vinokur, Nov 1, 2005
    #1
    1. Advertising

  2. Alex Vinokur

    Tauno Voipio Guest

    Alex Vinokur wrote:
    > Standalone and non-standalone applications in embedded systems.
    > What is the basic difference between them?



    An operating system. The stand-alone version does not
    have one.

    --

    Tauno Voipio
    tauno voipio (at) iki fi
     
    Tauno Voipio, Nov 1, 2005
    #2
    1. Advertising

  3. Alex Vinokur

    Jack Klein Guest

    On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <> wrote
    in comp.arch.embedded:

    > Standalone and non-standalone applications in embedded systems.
    > What is the basic difference between them?


    I think you are referring to what the C and C++ languages refer to
    free-standing and hosted environments, respectively.

    A hosted environment has an operating system, or at least a run time
    that looks like one. Code running on such a system has access to the
    entire standard language library. At least in theory, although in
    embedded systems even hosted environments are often subsets of the
    full language/library.

    A free-standing environment, on the other hand, is a very common small
    embedded system environment, a little start-up code and then the
    application with no OS in between.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Nov 2, 2005
    #3
  4. Alex Vinokur

    Alex Vinokur Guest

    Jack Klein wrote:
    > On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <> wrote
    > in comp.arch.embedded:
    >
    > > Standalone and non-standalone applications in embedded systems.
    > > What is the basic difference between them?

    >
    > I think you are referring to what the C and C++ languages refer to
    > free-standing and hosted environments, respectively.
    >
    > A hosted environment has an operating system, or at least a run time
    > that looks like one. Code running on such a system has access to the
    > entire standard language library.


    Does code access to the library as to shared/DLL library?
    Does code need hosted environment if it (the code) doesn't use
    shared/DLL library (i.e., library functions are linked with the
    executable file while linkage stage)?

    > At least in theory, although in
    > embedded systems even hosted environments are often subsets of the
    > full language/library.
    >
    > A free-standing environment, on the other hand, is a very common small
    > embedded system environment, a little start-up code and then the
    > application with no OS in between.

    [snip]

    How does code/application run _without OS_ in free-standing
    environment?
    In other words:
    * who invokes the application?
    * how does system without OS "understand" what it has to do with the
    code/executable?

    Thanks.
    Alex Vinokur
    email: alex DOT vinokur AT gmail DOT com
    http://mathforum.org/library/view/10978.html
    http://sourceforge.net/users/alexvn
     
    Alex Vinokur, Nov 2, 2005
    #4
  5. Alex Vinokur wrote:

    >
    > How does code/application run _without OS_ in free-standing
    > environment?
    > In other words:
    > * who invokes the application?
    > * how does system without OS "understand" what it has to do with the
    > code/executable?


    The simplest :
    You have the reset vector pointing to the code.
    The code has to boot the system

    The next step :
    The machine has some firmware that boots itself, then control is
    passed to something, in this case the application.

    Rene
    --
    Ing.Buero R.Tschaggelar - http://www.ibrtses.com
    & commercial newsgroups - http://www.talkto.net
     
    Rene Tschaggelar, Nov 2, 2005
    #5
  6. Alex Vinokur

    Jack Klein Guest

    On 1 Nov 2005 23:26:05 -0800, "Alex Vinokur"
    <> wrote in comp.arch.embedded:

    > Jack Klein wrote:
    > > On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <> wrote
    > > in comp.arch.embedded:
    > >
    > > > Standalone and non-standalone applications in embedded systems.
    > > > What is the basic difference between them?

    > >
    > > I think you are referring to what the C and C++ languages refer to
    > > free-standing and hosted environments, respectively.
    > >
    > > A hosted environment has an operating system, or at least a run time
    > > that looks like one. Code running on such a system has access to the
    > > entire standard language library.

    >
    > Does code access to the library as to shared/DLL library?
    > Does code need hosted environment if it (the code) doesn't use
    > shared/DLL library (i.e., library functions are linked with the
    > executable file while linkage stage)?


    You are talking about mechanisms, and the C language talks about
    availability.

    In a hosted environment, such as Windows or Linux, your implementation
    must be able to compile and build this program:

    #include <stdio.h>

    int main(void)
    {
    printf("Hello, World!\n");
    return 0;
    }

    A fully conforming hosted implementation must provide all 15, 18, or
    24 (depending on the version of the C standard, 1989/1990, 1995, or
    1999 that it conforms to), and all of the functions, types, and macros
    that the standard defines to be introduced by those headers.

    A fully conforming free-standing implementation only has to provide
    the headers <float.h>, <limits.h>, <stdarg.h>, <stddef.h>, plus
    <iso646.h> if it conforms to C95 and <stdbool.h> and <stdint.h> if it
    conforms to C99. These files define a few types, like size_t, and
    macros, but do not prototype one single library function.

    So a free-standing implementation need not be able to cope with the
    program above. It is not required to provide <stdio.h> or the
    printf() function. But it must understand all the keywords and data
    types, such as 'int', 'double', 'struct', and so on, and all the
    operators such as '+', sizeof, and the rest.

    Also it very rare in free-standing embedded systems for main() (or
    whatever else the start up function is called, because it does not
    have to be main() in free-standing environments) to ever return.
    Usually it runs forever, or until some turns it off.

    > > At least in theory, although in
    > > embedded systems even hosted environments are often subsets of the
    > > full language/library.
    > >
    > > A free-standing environment, on the other hand, is a very common small
    > > embedded system environment, a little start-up code and then the
    > > application with no OS in between.

    > [snip]
    >
    > How does code/application run _without OS_ in free-standing
    > environment?
    > In other words:
    > * who invokes the application?
    > * how does system without OS "understand" what it has to do with the
    > code/executable?


    Every processor from the smallest 8-bitter to a 64 bit X86 has some
    mechanism to start executing code when it comes out of reset. So in
    just about every situation, there is some sort of non-volatile storage
    such as ROM or flash memory there. In a PC, it is the BIOS. In an
    embedded system, it is some sort of start up code, usually a
    combination of hardware specific initialization and start up code
    provided by the compiler vendor.

    So typically the start up code in a free-standing embedded system
    initializes the hardware, then jumps to the compiler start up code,
    which initializes the C run time environment and then calls main(), or
    whatever else the first application function is called. And typically
    this function never returns.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Nov 4, 2005
    #6
  7. Alex Vinokur

    Alex Vinokur Guest

    "Jack Klein" <> wrote in message
    news:...

    Jack, thanks a lot for your very useful and helpful _conceptual_
    explanation.

    [snip]

    > A fully conforming free-standing implementation only has to provide
    > the headers <float.h>, <limits.h>, <stdarg.h>, <stddef.h>, plus
    > <iso646.h> if it conforms to C95 and <stdbool.h> and <stdint.h> if it
    > conforms to C99. These files define a few types, like size_t, and
    > macros, but do not prototype one single library function.
    >


    First. It seems that now I understood Dan Pop's answer on my question
    (about the abort() function) at
    http://groups.google.com/group/comp.lang.c/msg/ef6d22ce2cda2bd0.
    abort() is in <stdlib.h> (that doesn't belong to "must"-list of
    headers), so RTOS vendor may define its own behaviour for abort().

    Second. What is relationship between RTOS and host, between RTOS and
    target?
    RTOS is required on host to develop an embedded system.
    What about RTOS on target?

    [snip]
    > Every processor from the smallest 8-bitter to a 64 bit X86 has some
    > mechanism to start executing code when it comes out of reset. So in
    > just about every situation, there is some sort of non-volatile storage
    > such as ROM or flash memory there. In a PC, it is the BIOS. In an
    > embedded system, it is some sort of start up code, usually a
    > combination of hardware specific initialization and start up code
    > provided by the compiler vendor.
    >
    > So typically the start up code in a free-standing embedded system
    > initializes the hardware, then jumps to the compiler start up code,
    > which initializes the C run time environment and then calls main(), or
    > whatever else the first application function is called. And typically
    > this function never returns.

    [snip]


    I didn't find brief and informative explanations like above in
    comp.arch.embedded Newsgroup FAQs at
    http://www.faqs.org/faqs/by-newsgroup/comp/comp.arch.embedded.html.

    Perhaps, it is worth creating such FAQ related to conceptual aspects of
    embedded systems.

    I found two good sources related to embedded systems:
    * "Programming Embedded Systems with C and C++" by Michael Barr
    http://www.oreilly.com/catalog/embsys/
    * "Real-Time and Embedded Guide by Herman Bruyninckx" at
    http://people.mech.kuleuven.be/~bruyninc/rthowto/rtHOWTO.pdf

    But brief and informative _conceptual_ FAQs for comp.arch.embedded
    could be useful.


    --
    Alex Vinokur
    email: alex DOT vinokur AT gmail DOT com
    http://mathforum.org/library/view/10978.html
    http://sourceforge.net/users/alexvn
     
    Alex Vinokur, Nov 5, 2005
    #7
  8. Alex Vinokur

    Chris Hills Guest

    In article <436889d8$0$1147$>, Rene Tschaggelar
    <> writes
    >Alex Vinokur wrote:
    >
    >>
    >> How does code/application run _without OS_ in free-standing
    >> environment?
    >> In other words:
    >> * who invokes the application?
    >> * how does system without OS "understand" what it has to do with the
    >> code/executable?

    >
    >The simplest :
    >You have the reset vector pointing to the code.
    >The code has to boot the system
    >
    >The next step :
    >The machine has some firmware that boots itself, then control is
    >passed to something, in this case the application.
    >
    >Rene


    In an embedded system the application code IS the firmware

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Nov 5, 2005
    #8
  9. Alex Vinokur

    Chris Hills Guest

    In article <>, Jack Klein
    <> writes
    >On 1 Nov 2005 23:26:05 -0800, "Alex Vinokur"
    ><> wrote in comp.arch.embedded:
    >
    >> Jack Klein wrote:
    >> > On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <> wrote
    >> > in comp.arch.embedded:
    >> >
    >> > > Standalone and non-standalone applications in embedded systems.
    >> > > What is the basic difference between them?
    >> >
    >> > I think you are referring to what the C and C++ languages refer to
    >> > free-standing and hosted environments, respectively.
    >> >
    >> > A hosted environment has an operating system, or at least a run time
    >> > that looks like one. Code running on such a system has access to the
    >> > entire standard language library.

    >>
    >> Does code access to the library as to shared/DLL library?
    >> Does code need hosted environment if it (the code) doesn't use
    >> shared/DLL library (i.e., library functions are linked with the
    >> executable file while linkage stage)?

    >
    >You are talking about mechanisms, and the C language talks about
    >availability.
    >
    >In a hosted environment, such as Windows or Linux, your implementation
    >must be able to compile and build this program:
    >
    >#include <stdio.h>
    >
    >int main(void)
    >{
    > printf("Hello, World!\n");
    > return 0;
    >}
    >
    >A fully conforming hosted implementation must provide all 15, 18, or
    >24 (depending on the version of the C standard, 1989/1990, 1995, or
    >1999 that it conforms to), and all of the functions, types, and macros
    >that the standard defines to be introduced by those headers.
    >
    >A fully conforming free-standing implementation only has to provide
    >the headers <float.h>, <limits.h>, <stdarg.h>, <stddef.h>, plus
    ><iso646.h> if it conforms to C95 and <stdbool.h> and <stdint.h> if it
    >conforms to C99. These files define a few types, like size_t, and
    >macros, but do not prototype one single library function.
    >
    >So a free-standing implementation need not be able to cope with the
    >program above. It is not required to provide <stdio.h> or the
    >printf() function. But it must understand all the keywords and data
    >types, such as 'int', 'double', 'struct', and so on, and all the
    >operators such as '+', sizeof, and the rest.
    >
    >Also it very rare in free-standing embedded systems for main() (or
    >whatever else the start up function is called, because it does not
    >have to be main() in free-standing environments) to ever return.
    >Usually it runs forever, or until some turns it off.
    >
    >> > At least in theory, although in
    >> > embedded systems even hosted environments are often subsets of the
    >> > full language/library.
    >> >
    >> > A free-standing environment, on the other hand, is a very common small
    >> > embedded system environment, a little start-up code and then the
    >> > application with no OS in between.

    >> [snip]
    >>
    >> How does code/application run _without OS_ in free-standing
    >> environment?
    >> In other words:
    >> * who invokes the application?
    >> * how does system without OS "understand" what it has to do with the
    >> code/executable?

    >
    >Every processor from the smallest 8-bitter to a 64 bit X86 has some
    >mechanism to start executing code when it comes out of reset. So in
    >just about every situation, there is some sort of non-volatile storage
    >such as ROM or flash memory there. In a PC, it is the BIOS. In an
    >embedded system, it is some sort of start up code, usually a
    >combination of hardware specific initialization and start up code
    >provided by the compiler vendor.
    >
    >So typically the start up code in a free-standing embedded system
    >initializes the hardware, then jumps to the compiler start up code,
    >which initializes the C run time environment and then calls main(), or
    >whatever else the first application function is called. And typically
    >this function never returns.
    >


    The initialisation code is usually written in assembler. This runs from
    the hardware reset vector. It sets up the memory, the processor and
    stack (if there is one) and them jumps (one way, no return) to "main"
    (or what ever it is called).

    This is why void main(void) is ONLY valid in self-hosted embedded type
    systems. There is no return.

    In embedded systems usually ALL the code is in ROM/EPROM/Flash etc. and
    there is a separate area of RAM for the variables.

    Embedded code can be written with no libraries etc. Also DLL's are
    windows devices.



    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Nov 5, 2005
    #9
  10. Alex Vinokur

    Chris Hills Guest

    In article <>, Alex
    Vinokur <> writes
    >First. It seems that now I understood Dan Pop's answer on my question
    >(about the abort() function) at
    >http://groups.google.com/group/comp.lang.c/msg/ef6d22ce2cda2bd0.
    >abort() is in <stdlib.h> (that doesn't belong to "must"-list of
    >headers), so RTOS vendor may define its own behaviour for abort().
    >
    >Second. What is relationship between RTOS and host, between RTOS and
    >target?
    >RTOS is required on host to develop an embedded system.
    >What about RTOS on target?


    Alex,

    If this is not home work... what are you trying to do? And why do you
    want to know about embedded systems and RTOS?

    You need the RTOS on the target (obviously) but not on the host. IE
    most of use develop on Windows or Unix but use a wide variety of RTOS
    that are not Windows or Unix.

    Only once have I developed on the same OS as was going to be used on the
    target.

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Nov 5, 2005
    #10
  11. Alex Vinokur

    Alex Vinokur Guest

    Chris Hills wrote:
    [snip]
    > If this is not home work... what are you trying to do? And why do you
    > want to know about embedded systems and RTOS?

    [snip]

    It is not homework. I started to work with embedded systems and RTOS
    and would like to know not only technical, but conceptual things
    related to issue.

    Alex Vinokur
    email: alex DOT vinokur AT gmail DOT com
    http://mathforum.org/library/view/10978.html
    http://sourceforge.net/users/alexvn
     
    Alex Vinokur, Nov 6, 2005
    #11
  12. Alex Vinokur

    Chris Hills Guest

    In article <>, Alex
    Vinokur <> writes
    >Chris Hills wrote:
    >[snip]
    >> If this is not home work... what are you trying to do? And why do you
    >> want to know about embedded systems and RTOS?

    >[snip]
    >
    >It is not homework. I started to work with embedded systems and RTOS
    >and would like to know not only technical, but conceptual things
    >related to issue.


    Fair enough.

    The only thing all embedded systems have in common is that they are
    different :) 4-128 bits, Harvard and Von Nueman architectures, with
    and without an OS (that may or may not be an RTOS). It may have only ROM
    and a few registers, or megabytes of RAM, no hard disks or arrays of
    them.

    There are many concepts depending on the direction you come from . Many
    use an In Circuit Emulator whilst others swear by a logic analyser.

    Some use God's own Language whilst others know it is the language of the
    Devil and use the Real God's Own Language.... BTW one of the languages
    is C but I am not telling which side of the argument it is on :)

    An author and trainer of very great experience I know asked me (and a
    large group of others) what their definition of a process, a thread and
    a task was. He had as many different answers as people.

    It can be the same with asking "what is an embedded systems and how do
    they work?"

    It depends where the person comes from and their experience. I know some
    people in embedded systems who have never used an RTOS OR an MCU....
    They do everything in ASICS and FPGA.

    Incidentally the embedded world is probably a LOT larger than the PC or
    mainframe programming world.

    Good luck.


    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Nov 6, 2005
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Vinokur
    Replies:
    10
    Views:
    575
    PeteS
    Oct 19, 2005
  2. John
    Replies:
    19
    Views:
    601
    Paul Keinanen
    Nov 13, 2006
  3. Steve
    Replies:
    6
    Views:
    259
  4. AES
    Replies:
    1
    Views:
    278
    Carl Witthoft
    Mar 20, 2005
  5. Replies:
    19
    Views:
    628
    Mark Borgerson
    Nov 28, 2011
Loading...

Share This Page