Motherboard Forums


Reply
Thread Tools Display Modes

Standalone and non-standalone applications in embedded systems

 
 
Alex Vinokur
Guest
Posts: n/a
 
      11-01-2005, 06:43 PM
Standalone and non-standalone applications in embedded systems.
What is the basic difference between them?

--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn





 
Reply With Quote
 
 
 
 
Tauno Voipio
Guest
Posts: n/a
 
      11-01-2005, 07:44 PM
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
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      11-02-2005, 04:58 AM
On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <(E-Mail Removed)> 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/~a...FAQ-acllc.html
 
Reply With Quote
 
Alex Vinokur
Guest
Posts: n/a
 
      11-02-2005, 07:26 AM
Jack Klein wrote:
> On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <(E-Mail Removed)> 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

 
Reply With Quote
 
Rene Tschaggelar
Guest
Posts: n/a
 
      11-02-2005, 09:40 AM
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
 
Reply With Quote
 
Jack Klein
Guest
Posts: n/a
 
      11-04-2005, 04:51 AM
On 1 Nov 2005 23:26:05 -0800, "Alex Vinokur"
<(E-Mail Removed)> wrote in comp.arch.embedded:

> Jack Klein wrote:
> > On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <(E-Mail Removed)> 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/~a...FAQ-acllc.html
 
Reply With Quote
 
Alex Vinokur
Guest
Posts: n/a
 
      11-05-2005, 06:23 PM

"Jack Klein" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

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....6d22ce2cda2bd0.
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-newsgrou....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/~bruy...to/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

 
Reply With Quote
 
Chris Hills
Guest
Posts: n/a
 
      11-05-2005, 07:17 PM
In article <436889d8$0$1147$(E-Mail Removed)>, Rene Tschaggelar
<(E-Mail Removed)> 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 /\/\/\/\/
/\/\/ (E-Mail Removed) www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
Chris Hills
Guest
Posts: n/a
 
      11-05-2005, 07:26 PM
In article <(E-Mail Removed)>, Jack Klein
<(E-Mail Removed)> writes
>On 1 Nov 2005 23:26:05 -0800, "Alex Vinokur"
><(E-Mail Removed)> wrote in comp.arch.embedded:
>
>> Jack Klein wrote:
>> > On Tue, 1 Nov 2005 20:43:58 +0200, "Alex Vinokur" <(E-Mail Removed)> 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 /\/\/\/\/
/\/\/ (E-Mail Removed) www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
Chris Hills
Guest
Posts: n/a
 
      11-05-2005, 07:29 PM
In article <(E-Mail Removed). com>, Alex
Vinokur <(E-Mail Removed)> 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....6d22ce2cda2bd0.
>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 /\/\/\/\/
/\/\/ (E-Mail Removed) www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFP with Extended Deadline of Apr. 10: The 2011 InternationalConference on Embedded Systems and Applications (ESA'11), USA, July 18-21, 2011 A. M. G. Solo Embedded 0 04-02-2011 09:53 PM
CFP with Extended Deadline of Mar. 21, 2010: The 2010 International Conference on Embedded Systems and Applications (ESA'10), USA, A. M. G. Solo Embedded 0 03-04-2010 11:55 PM
CFP with Extended Deadline of Mar. 21, 2010: The 2010 InternationalConference on Embedded Systems and Applications (ESA'10), USA, July 2010 A. M. G. Solo Embedded 0 03-04-2010 10:57 PM
CFP with extended deadline of Mar. 17, 2009: The 2009 InternationalConference on Embedded Systems and Applications (ESA'09), USA, July 13-16,2009 A. M. G. Solo Embedded 0 03-10-2009 09:40 PM
embedded systems industry applications Steve Embedded 6 01-12-2007 02:22 PM


All times are GMT. The time now is 09:53 PM.


Welcome!
Welcome to Motherboard Point
 

Advertisment