Re: How to create a standalone C program?



dspfun wrote:

How do you create a standalone C program? With standalone C program I
mean it should run "freestanding" on a CPU without an OS or other
supporting software/libraries linked to the C program. After the bios/
setup has done its initializations and "stuff" I would like to be able
to continue execution with my own C program. The C program will be
really simple to start with, for example just write an integer value
to a memory address.

Thanks!

You should probably ask this question in a group for your system. Generally,
some amount of native assembler code will be required to set up the
environment that C expects. Also you'll have to find some way to make your
system's firmware load your program into memory and pass control to it. The
details are completely system specific and off-topic for this group. Also
you need to take special steps to compile your program as a freestanding
one. In the process you'll lose access to most functions of the Standard
library, and might have to implement your own replacements.

I suggest the following groups:

alt.lang.asm, comp.lang.asm.x86 and alt.os.developement.

Though your question is not exactly topical for any of the above groups,
they might be able to answer your question better, since they can discuss
system specific topics.

.



Relevant Pages

  • Re: How to create a standalone C program?
    ... mean it should run "freestanding" on a CPU without an OS or other ... setup has done its initializations and "stuff" I would like to be able ... to a memory address. ...
    (comp.lang.c)
  • Re: How to create a standalone C program?
    ... mean it should run "freestanding" on a CPU without an OS or other ... setup has done its initializations and "stuff" I would like to be able ... to a memory address. ...
    (comp.lang.c)
  • How to create a standalone C program?
    ... How do you create a standalone C program? ... mean it should run "freestanding" on a CPU without an OS or other ... to a memory address. ...
    (comp.lang.c)
  • Re: How to create a standalone C program?
    ... A freestanding *C program* is not really different from a hosted C program, except that the standard guarantees the existence of only a small subset of the library functions; your compiler may but doesn't have to provide more. ... If e.g. you are writing code for a dishwasher, the #1 magic must start from the CPU reset, which also means your program must be linked at an absolute address. ... If you are writing PC BIOS extension, you can rely on your program being started by BIOS scan, by which time some basic BIOS services may become available. ...
    (comp.lang.c)